



      CHARACTER*1 FUNCTION FIRSTCHARAT(IAT) 

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT
      LOGICAL       WIFITI







      IF (.NOT.WIFITI(IAT)) THEN
         CALL GVSTTI ('?M0897',IAT)
         CALL SHOSOU
         FIRSTCHARAT=' '
         CALL GVSKIL
         GOTO 998
      END IF



      IF (ONESAT(IAT)(1:1).EQ.' ') THEN
         FIRSTCHARAT=ONESAT(IAT)(2:2)
      ELSE
         FIRSTCHARAT=ONESAT(IAT)(1:1)
      END IF



  998 CONTINUE


      RETURN
      END   
      CHARACTER*2 FUNCTION FIRST2CHARAT(IAT) 

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT
      CHARACTER*5   LOCAT
      LOGICAL       GVFIBN







      IF (.NOT.GVFIBN(IAT,1,NUMATF)) THEN
         CALL GVSTTB ('?M0897')
         CALL GVSCTB (FIRST2CHARAT,2)
         GOTO 998
      END IF



      CALL GVSSTX (LOCAT,ONESAT(IAT))
      CALL GVSSHL (LOCAT)



      CALL GVSSTX (FIRST2CHARAT,LOCAT(1:2))



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION CH2EQCH2(TEXT1,TEXT2)

















      IMPLICIT      NONE
      CHARACTER*2   TEXT1, TEXT2, TEXT3, TEXT4
      INTEGER       I, J







      CH2EQCH2=TEXT1.EQ.TEXT2



      IF (.NOT.CH2EQCH2) THEN
         J=0
         DO 10 I=1,2
            IF (ICHAR(TEXT1(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT3(J:J)=TEXT1(I:I)
            END IF
 10      CONTINUE
         IF (J+1.LE.2) THEN
            DO 11 I=J+1,2
               TEXT3(I:I)=' '
 11         CONTINUE
         END IF
         J=0
         DO 20 I=1,2
            IF (ICHAR(TEXT2(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT4(J:J)=TEXT2(I:I)
            END IF
 20      CONTINUE
         IF (J+1.LE.2) THEN
            DO 21 I=J+1,2
               TEXT4(I:I)=' '
 21         CONTINUE
         END IF
         CH2EQCH2=TEXT3.EQ.TEXT4
      END IF





      RETURN
      END   
      LOGICAL FUNCTION CH4EQCH4(TEXT1,TEXT2)

















      IMPLICIT      NONE
      INTEGER       I, J
      CHARACTER*4   TEXT1, TEXT2, TEXT3, TEXT4







      CH4EQCH4=TEXT1.EQ.TEXT2



      IF (.NOT.CH4EQCH4) THEN
         J=0
         DO 10 I=1,4
            IF (ICHAR(TEXT1(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT3(J:J)=TEXT1(I:I)
            END IF
 10      CONTINUE
         IF (J+1.LE.4) THEN
            DO 11 I=J+1,4
               TEXT3(I:I)=' '
 11         CONTINUE
         END IF
         J=0
         DO 20 I=1,4
            IF (ICHAR(TEXT2(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT4(J:J)=TEXT2(I:I)
            END IF
 20      CONTINUE
         IF (J+1.LE.4) THEN
            DO 21 I=J+1,4
               TEXT4(I:I)=' '
 21         CONTINUE
         END IF
         CH4EQCH4=TEXT3.EQ.TEXT4
      END IF





      RETURN
      END   
      LOGICAL FUNCTION CH5EQCH5(TEXT1,TEXT2)

















      IMPLICIT      NONE
      CHARACTER*5   TEXT1, TEXT2, TEXT3, TEXT4
      INTEGER       I, J







      CH5EQCH5=TEXT1.EQ.TEXT2



      IF (.NOT.CH5EQCH5) THEN
         J=0
         DO 10 I=1,5
            IF (ICHAR(TEXT1(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT3(J:J)=TEXT1(I:I)
            END IF
 10      CONTINUE
         IF (J+1.LE.5) THEN
            DO 11 I=J+1,5
               TEXT3(I:I)=' '
 11         CONTINUE
         END IF
         J=0
         DO 20 I=1,5
            IF (ICHAR(TEXT2(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT4(J:J)=TEXT2(I:I)
            END IF
 20      CONTINUE
         IF (J+1.LE.5) THEN
            DO 21 I=J+1,5
               TEXT4(I:I)=' '
 21         CONTINUE
         END IF
         CH5EQCH5=TEXT3.EQ.TEXT4
      END IF





      RETURN
      END   
      LOGICAL FUNCTION CH5EQCH4(TEXT1,TEXT2)

















      IMPLICIT      NONE
      CHARACTER*5   TEXT1, TEXT3
      CHARACTER*4   TEXT2, TEXT4
      INTEGER       I, J







      CH5EQCH4=TEXT1(1:4).EQ.TEXT2.AND.TEXT1(5:5).EQ.' '



      IF (.NOT.CH5EQCH4) THEN
         J=0
         DO 10 I=1,5
            IF (ICHAR(TEXT1(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT3(J:J)=TEXT1(I:I)
            END IF
 10      CONTINUE
         IF (J+1.LE.5) THEN
            DO 11 I=J+1,5
               TEXT3(I:I)=' '
 11         CONTINUE
         END IF
         J=0
         DO 20 I=1,4
            IF (ICHAR(TEXT2(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT4(J:J)=TEXT2(I:I)
            END IF
 20      CONTINUE
         IF (J+1.LE.4) THEN
            DO 21 I=J+1,4
               TEXT4(I:I)=' '
 21         CONTINUE
         END IF
         CH5EQCH4=TEXT3(1:4).EQ.TEXT4.AND.TEXT3(5:5).EQ.' '
      END IF





      RETURN
      END   
