



C

C


C


C


C


C


C


C


C


C


C


C


C


C


C


C

C


C


C


C

C







C


C


C


C


C


C


C


C


C


C


C


C


C


C


C


C


C





C


C


C


C


C


C


C


C


C


C


C


C


C


C



C


C




C


C


C


C


C


C


C
      INTEGER FUNCTION GVFFCP(CROW,CHAR,NUM,LENC)














      IMPLICIT      NONE
      INTEGER       NUM, LENC, I
      CHARACTER*(*) CROW(NUM)
      CHARACTER*(*) CHAR







      GVFFCP=0



      IF (LENC.GT.0) THEN



         IF (NUM.GT.0) THEN



            DO 10 I=1,NUM
               IF (LENC.EQ.1) THEN
                  IF (CHAR.EQ.CROW(I)) THEN
                     GVFFCP=I
                     GOTO 998
                  END IF
               ELSE
                  IF (CHAR(1:LENC).EQ.CROW(I)(1:LENC)) THEN
                     GVFFCP=I
                     GOTO 998
                  END IF
               END IF
   10       CONTINUE
            GOTO 998
         ELSE IF (NUM.EQ.0) THEN



            CALL GVSTTE ('?TLSB29')
            GOTO 998
         ELSE IF (NUM.LT.0) THEN



            CALL GVSTTI ('?TLSB30',NUM)
         END IF



      ELSE IF (LENC.EQ.0) THEN
         CALL GVSTTE ('?TLSB31')
      ELSE IF (LENC.LT.0) THEN
         CALL GVSTTI ('?TLSB32',LENC)
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION GVFICN(CHAR)










      IMPLICIT      NONE
      CHARACTER*1   CHAR
      INTEGER       ICH







      ICH=ICHAR(CHAR)
      GVFICN=(ICH.GE.ICHAR('A').AND.ICH.LE.ICHAR('Z')).OR.
     +       (ICH.GE.ICHAR('a').AND.ICH.LE.ICHAR('z')).OR.
     +       (ICH.GE.ICHAR('0').AND.ICH.LE.ICHAR('9'))





      RETURN
      END
      LOGICAL FUNCTION GVFISC(CHAR)










      IMPLICIT      NONE
      CHARACTER*1   CHAR
      INTEGER       ICH







      ICH=ICHAR(CHAR)
      GVFISC=(ICH.GE.ICHAR('A').AND.ICH.LE.ICHAR('Z')).OR.
     +       (ICH.GE.ICHAR('a').AND.ICH.LE.ICHAR('z'))





      RETURN
      END
      LOGICAL FUNCTION GVFISN(CHAR)










      IMPLICIT      NONE
      CHARACTER*1   CHAR
      INTEGER       ICH







      ICH=ICHAR(CHAR)
      GVFISN=ICH.GE.ICHAR('0').AND.ICH.LE.ICHAR('9')





      RETURN
      END
      INTEGER FUNCTION GVFLEN(TEXT)












      IMPLICIT      NONE
      CHARACTER*(*) TEXT
      INTEGER       I, ICH







      GVFLEN=0



      DO 10 I=LEN(TEXT),1,-1
         ICH=ICHAR(TEXT(I:I))
         IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
            GVFLEN=I
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFNIT(TEXT,IERR)











      IMPLICIT      NONE
      INTEGER       I, IERR, LENTXT, GVFLEN, IC
      CHARACTER*(*) TEXT







      IF (GVFLEN(TEXT).LE.0) THEN
         IERR=1
         GVFNIT=0
         GOTO 998
      END IF



      IERR=0
      LENTXT=GVFLEN(TEXT)
      GVFNIT=0



      DO 10 I=1,LENTXT
         IC=INDEX('0123456789',TEXT(I:I))
         IF (IC.GT.0) THEN
            GVFNIT=IC-1
            GOTO 998
         END IF
   10 CONTINUE



      IERR=1



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFPLS(TEXT,SUBTXT)















      IMPLICIT      NONE
      CHARACTER*(*) TEXT, SUBTXT
      INTEGER       LENTXT, LENSUB, I







      LENTXT=LEN(TEXT)
      LENSUB=LEN(SUBTXT)
      GVFPLS=0



      IF (LENTXT.EQ.0.OR.LENSUB.GT.LENTXT.OR.LENSUB.EQ.0) GOTO 998



      DO 10 I=LENTXT-LENSUB+1,1,-1
         IF (TEXT(I:I+LENSUB-1).EQ.SUBTXT) THEN
            GVFPLS=I
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFPOS(TEXTIN,SUBIN)












      IMPLICIT       NONE
      INTEGER        LENTXT, LENSUB, I, ICH, GVFLEN, GVFPOSB
      CHARACTER*80   LOCSUB, SUB
      CHARACTER*100  LOCTXT, TEXT
      CHARACTER*(*)  TEXTIN
      CHARACTER*(*)  SUBIN







      IF (LEN(TEXTIN).GT.80) THEN
         GVFPOS=GVFPOSB(TEXTIN,SUBIN)
         GOTO 998
      END IF



      GVFPOS=0
      IF (LEN(TEXT).LE.0) THEN
         CALL GVSKIL
         GOTO 998
      END IF







         TEXT=TEXTIN
         SUB=SUBIN





      IF (SUBIN(1:1).EQ.'?') THEN
         LENSUB=GVFLEN(SUB)
      ELSE
         LENSUB=LEN(SUBIN)
      END IF
      LENTXT=MIN(LEN(TEXT),GVFLEN(TEXT)+LENSUB)



      IF (LENTXT.EQ.0.OR.LENSUB.GT.LENTXT) GOTO 998
      LENSUB=MAX(GVFLEN(SUBIN),1)



      DO 20 I=1,LENTXT
         ICH=ICHAR(TEXT(I:I))
         IF (ICH.GE.ICHAR('a').AND.ICH.LE.ICHAR('z')) THEN
            LOCTXT(I:I)=CHAR(ICH-ICHAR('a')+ICHAR('A'))
         ELSE
            LOCTXT(I:I)=CHAR(ICH)
         END IF
   20 CONTINUE
      DO 30 I=1,LENSUB
         ICH=ICHAR(SUB(I:I))
         IF (ICH.GE.ICHAR('a').AND.ICH.LE.ICHAR('z')) THEN
            LOCSUB(I:I)=CHAR(ICH-ICHAR('a')+ICHAR('A'))
         ELSE
            LOCSUB(I:I)=CHAR(ICH)
         END IF
   30 CONTINUE



      GVFPOS=INDEX(LOCTXT(1:LENTXT),LOCSUB(1:LENSUB))
      IF (GVFPOS.GT.LEN(TEXTIN)) GVFPOS=0



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFPOSB(TEXTIN,SUBIN)












      IMPLICIT       NONE
      INTEGER        LENTXT, LENSUB, I, ICH, GVFLEN
      CHARACTER*80   LOCSUB, SUB
      CHARACTER*(*)  TEXTIN
      CHARACTER*(*)  SUBIN
      CHARACTER*10000 LOCTXT, TEXT







      GVFPOSB=0
      IF (LEN(TEXT).LE.0) THEN
         CALL GVSKIL
         GOTO 998
      END IF



      CALL GVSSTX (TEXT,TEXTIN)
      CALL GVSSTX (SUB,SUBIN)




      IF (SUBIN(1:1).EQ.'?') THEN
         LENSUB=GVFLEN(SUB)
      ELSE
         LENSUB=LEN(SUBIN)
      END IF
      LENTXT=MIN(LEN(TEXT),GVFLEN(TEXT)+LENSUB)



      IF (LENTXT.EQ.0.OR.LENSUB.GT.LENTXT) GOTO 998
      LENSUB=MAX(GVFLEN(SUBIN),1)



      DO 20 I=1,LENTXT
         ICH=ICHAR(TEXT(I:I))
         IF (ICH.GE.ICHAR('a').AND.ICH.LE.ICHAR('z')) THEN
            LOCTXT(I:I)=CHAR(ICH-ICHAR('a')+ICHAR('A'))
         ELSE
            LOCTXT(I:I)=CHAR(ICH)
         END IF
   20 CONTINUE
      DO 30 I=1,LENSUB
         ICH=ICHAR(SUB(I:I))
         IF (ICH.GE.ICHAR('a').AND.ICH.LE.ICHAR('z')) THEN
            LOCSUB(I:I)=CHAR(ICH-ICHAR('a')+ICHAR('A'))
         ELSE
            LOCSUB(I:I)=CHAR(ICH)
         END IF
   30 CONTINUE



      GVFPOSB=INDEX(LOCTXT(1:LENTXT),LOCSUB(1:LENSUB))



  998 CONTINUE


      RETURN
      END

      INTEGER FUNCTION GVFSCP(TEXT1,TEXT2,IERR)












      IMPLICIT      NONE
      INTEGER       IERR, GVFLEN, LEN1, LEN2, I
      CHARACTER*(*) TEXT1, TEXT2







      LEN1=GVFLEN(TEXT1)
      LEN2=GVFLEN(TEXT2)
      IERR=0
      GVFSCP=0



      IF (LEN1.LE.0.OR.LEN2.LE.0) THEN
         GVFSCP=+999
         IERR=1
         GOTO 998
      END IF



      DO 10 I=1,MIN(LEN1,LEN2)
         IF (TEXT1(I:I).GT.TEXT2(I:I)) THEN
            GVFSCP=-1
            GOTO 998
         ELSE IF (TEXT2(I:I).GT.TEXT1(I:I)) THEN
            GVFSCP=+1
            GOTO 998
         END IF
   10 CONTINUE



      IF (LEN1.GT.LEN2) THEN
         GVFSCP=-1
         GOTO 998
      ELSE IF (LEN2.GT.LEN1) THEN
         GVFSCP=+1
         GOTO 998
      END IF



  998 CONTINUE


      RETURN
      END

      SUBROUTINE GVSBOX (INTEXT)










      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      CHARACTER*(*) INTEXT
      CHARACTER*60  TEXT
      CHARACTER*80  LOCLIN
      INTEGER       GVFLEN, I







      CALL GVSCTB (TEXT,60)
      IF (GVFLEN(INTEXT).GT.0) THEN
         DO 10 I=1,MIN(60,GVFLEN(INTEXT))
            TEXT(I:I)=INTEXT(I:I)
   10    CONTINUE
      END IF
      IF (TEXT(1:1).EQ.'?') THEN
         IF (GVFLEN(TEXT).LE.1) THEN
            CALL GVSTTE ('?M4414')
            CALL GVSKIL
         END IF
         CALL GETTEXT (TEXT)
      END IF



      IF (GVFLEN(TEXT).LT.1) THEN
         CALL GVSTTB ('?TLSB68')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (GVFLEN(TEXT).GT.60) CALL GVSTTB ('?TLSB69')



      CALL GVSFMT ('?FMT216')
      WRITE (LOCLIN,FMT,ERR=999)
      CALL GVSTT6 (LOCLIN)
      CALL GVSFMT ('?FMT217')
      WRITE (LOCLIN,FMT,ERR=999)
      CALL GVSTT6 (LOCLIN)
      CALL GVSFMT ('?FMT218')
      WRITE (LOCLIN,FMT,ERR=999) TEXT(1:60)
      CALL GVSTT6 (LOCLIN)
      CALL GVSFMT ('?FMT217')
      WRITE (LOCLIN,FMT,ERR=999)
      CALL GVSTT6 (LOCLIN)
      CALL GVSFMT ('?FMT216')
      WRITE (LOCLIN,FMT,ERR=999)
      CALL GVSTT6 (LOCLIN)
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('GVSBOX')



  998 CONTINUE


      RETURN
      END

      SUBROUTINE GVSCC3 (TEXT1,TEXT2,TEXT3,TEXT4)









      IMPLICIT      NONE
      CHARACTER*(*) TEXT1, TEXT2, TEXT3, TEXT4
      INTEGER       GVFLEN







      IF (GVFLEN(TEXT2)+GVFLEN(TEXT3)+
     +    GVFLEN(TEXT4).GT.LEN(TEXT1)) THEN
         CALL GVSTTE ('?TLSB37')
         CALL GVSTT6 (TEXT2)
         CALL GVSTT6 (TEXT3)
         CALL GVSTT6 (TEXT4)
         CALL GVSKIL
         GOTO 998
      END IF




      CALL GVSCCC (TEXT1,TEXT2,TEXT3)
      CALL GVSCPC (TEXT1,TEXT4)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCC4 (TEXT1,TEXT2,TEXT3,TEXT4,TEXT5)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      CHARACTER*(*) TEXT1, TEXT2, TEXT3, TEXT4, TEXT5
      INTEGER       GVFLEN







      IF (GVFLEN(TEXT2)+GVFLEN(TEXT3)+GVFLEN(TEXT4)+
     +    GVFLEN(TEXT5).GT.LEN(TEXT1)) THEN
         CALL GVSTTE ('?TLSB38')
         CALL GVSKIL
         GOTO 998
      END IF
      IF ((GVFLEN(TEXT2).EQ.0.OR.GVFLEN(TEXT3).EQ.0.OR.
     +     GVFLEN(TEXT4).EQ.0.OR.GVFLEN(TEXT5).EQ.0).AND.
     +    WIFPAR(1012).GE.2) THEN
         CALL GVSTT6 ('?M1562')
         CALL GVST6C ('?M1563',TEXT2,.FALSE.)
         CALL GVST6C ('?M1563',TEXT3,.FALSE.)
         CALL GVST6C ('?M1563',TEXT4,.FALSE.)
         CALL GVST6C ('?M1563',TEXT5,.FALSE.)
         CALL GVSKIL
      END IF





      CALL GVSCCC (TEXT1,TEXT2,TEXT3)
      CALL GVSCPC (TEXT1,TEXT4)
      CALL GVSCPC (TEXT1,TEXT5)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCC5 (TEXT1,TEXT2,TEXT3,TEXT4,TEXT5,TEXT6)









      IMPLICIT      NONE
      CHARACTER*(*) TEXT1, TEXT2, TEXT3, TEXT4, TEXT5, TEXT6
      INTEGER       GVFLEN







      IF (GVFLEN(TEXT2)+GVFLEN(TEXT3)+GVFLEN(TEXT4)+
     +    GVFLEN(TEXT5)+GVFLEN(TEXT6).GT.LEN(TEXT1)) THEN
         CALL GVSTTE ('?TLSB38A')
         GOTO 998
      END IF





      CALL GVSCCC (TEXT1,TEXT2,TEXT3)
      CALL GVSCPC (TEXT1,TEXT4)
      CALL GVSCPC (TEXT1,TEXT5)
      CALL GVSCPC (TEXT1,TEXT6)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCC6 (TEXT1,TEXT2,TEXT3,TEXT4,TEXT5,TEXT6,TEXT7)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      CHARACTER*(*) TEXT1, TEXT2, TEXT3, TEXT4, TEXT5, TEXT6, TEXT7
      INTEGER       GVFLEN







      IF (GVFLEN(TEXT2)+GVFLEN(TEXT3)+GVFLEN(TEXT4)+
     +    GVFLEN(TEXT5)+GVFLEN(TEXT6)+GVFLEN(TEXT7).GT.
     +    LEN(TEXT1)) THEN
         CALL GVSTTE ('?TLSB38B')
         GOTO 998
      END IF





      CALL GVSCCC (TEXT1,TEXT2,TEXT3)
      CALL GVSCPC (TEXT1,TEXT4)
      CALL GVSCPC (TEXT1,TEXT5)
      CALL GVSCPC (TEXT1,TEXT6)
      CALL GVSCPC (TEXT1,TEXT7)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCC7 (TEXT1,TEXT2,TEXT3,TEXT4,TEXT5,TEXT6,TEXT7,
     + TEXT8)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      CHARACTER*(*) TEXT1, TEXT2, TEXT3, TEXT4, TEXT5, TEXT6, TEXT7,
     +              TEXT8
      INTEGER       GVFLEN







      IF (GVFLEN(TEXT2)+GVFLEN(TEXT3)+GVFLEN(TEXT4)+GVFLEN(TEXT5)+
     +    GVFLEN(TEXT6)+GVFLEN(TEXT7)+GVFLEN(TEXT8).GT.
     +    LEN(TEXT1)) THEN
         CALL GVSTTE ('?TLSB38B')
         GOTO 998
      END IF





      CALL GVSCCC (TEXT1,TEXT2,TEXT3)
      CALL GVSCPC (TEXT1,TEXT4)
      CALL GVSCPC (TEXT1,TEXT5)
      CALL GVSCPC (TEXT1,TEXT6)
      CALL GVSCPC (TEXT1,TEXT7)
      CALL GVSCPC (TEXT1,TEXT8)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCCC (TEXT1,INTEXT2,INTEXT3)











      IMPLICIT      NONE
      INTEGER       GVFLEN, LEN1, LEN2, LEN3, LENPOS, I
      CHARACTER*(*) TEXT1, INTEXT2, INTEXT3
      CHARACTER*500 TEXT2, TEXT3
      LOGICAL       FIRST







      FIRST=.TRUE.



      CALL GVSSTX (TEXT1,'?M4417')
      IF (GVFLEN(INTEXT2).LE.0) THEN
         CALL GVSTT6 ('?TLSD72A')
         CALL GVSTT6 (INTEXT3)
         CALL GVSKIL
      END IF
      IF (GVFLEN(INTEXT3).LE.0) THEN
         CALL GVSTT6 (INTEXT2)
         CALL GVSTT6 ('?TLSD72B')
         CALL GVSKIL
      END IF
      IF (GVFLEN(INTEXT2).GT.500.OR.GVFLEN(INTEXT3).GT.500) THEN
         CALL GVSTT6 ('?TLSD73')
         CALL GVSKIL
      END IF
      CALL GVSSTX (TEXT2,INTEXT2(1:MIN(500,GVFLEN(INTEXT2))))
      CALL GVSSTX (TEXT3,INTEXT3(1:MIN(500,GVFLEN(INTEXT3))))



    1 CONTINUE
      LEN2=GVFLEN(TEXT2)
      LEN3=GVFLEN(TEXT3)
      LEN1=LEN2+LEN3



      LENPOS=LEN(TEXT1)
      IF (LEN1.GT.LENPOS) THEN




         CALL GVSTTE ('?TLSB39')
         CALL GVSTT6 (TEXT2)
         CALL GVSTT6 (TEXT3)
         CALL GVSKIL
         IF (FIRST) THEN
            FIRST=.FALSE.
            CALL GVSCST (TEXT2)
            CALL GVSCST (TEXT3)
            GOTO 1
         END IF
         GOTO 998
      END IF



      IF (.NOT.FIRST) CALL GVSTT6 ('?TLSB40')



      DO 10 I=1,LEN2
         TEXT1(I:I)=TEXT2(I:I)
   10 CONTINUE
      DO 20 I=1,LEN3
         TEXT1(LEN2+I:LEN2+I)=TEXT3(I:I)
   20 CONTINUE
      DO 30 I=LEN1+1,LENPOS
         TEXT1(I:I)=' '
   30 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCC3Q (TEXT1,INTEXT2,INTEXT3,INTEXT4)











      IMPLICIT      NONE
      INTEGER       LEN1, LEN2, LEN3, LEN4, I, ICH
      LOGICAL       IN2, IN3, IN4
      CHARACTER*(*) TEXT1, INTEXT2, INTEXT3, INTEXT4
      CHARACTER*500 TEXT2, TEXT3, TEXT4







      IF (INTEXT2(1:1).EQ.'?') THEN
         IN2=.FALSE.
         CALL GVSSTX (TEXT2,INTEXT2)
      ELSE
         IN2=.TRUE.
      END IF
      IF (INTEXT3(1:1).EQ.'?') THEN
         IN3=.FALSE.      
         CALL GVSSTX (TEXT3,INTEXT3)
      ELSE
         IN3=.TRUE.
      END IF
      IF (INTEXT4(1:1).EQ.'?') THEN
         IN4=.FALSE.      
         CALL GVSSTX (TEXT4,INTEXT4)
      ELSE
         IN4=.TRUE.
      END IF



      LEN1=LEN(TEXT1)
      LEN2=0
      LEN3=0
      LEN4=0
      IF (IN2) THEN
         DO 1 I=LEN(INTEXT2),1,-1
            ICH=ICHAR(INTEXT2(I:I))
            IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
               LEN2=I
               GOTO 2
            END IF
 1       CONTINUE
 2       CONTINUE
      ELSE
         DO 11 I=LEN(TEXT2),1,-1
            ICH=ICHAR(TEXT2(I:I))
            IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
               LEN2=I
               GOTO 12
            END IF
 11      CONTINUE
 12      CONTINUE
      END IF

      IF (IN3) THEN
         DO 3 I=LEN(INTEXT3),1,-1
            ICH=ICHAR(INTEXT3(I:I))
            IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
               LEN3=I
               GOTO 4
            END IF
 3       CONTINUE
 4       CONTINUE
      ELSE
         DO 13 I=LEN(TEXT3),1,-1
            ICH=ICHAR(TEXT3(I:I))
            IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
               LEN3=I
               GOTO 14
            END IF
 13      CONTINUE
 14      CONTINUE
      END IF

      IF (IN4) THEN
         DO 5 I=LEN(INTEXT4),1,-1
            ICH=ICHAR(INTEXT4(I:I))
            IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
               LEN4=I
               GOTO 6
            END IF
 5       CONTINUE
 6       CONTINUE
      ELSE
         DO 15 I=LEN(TEXT4),1,-1
            ICH=ICHAR(TEXT4(I:I))
            IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
               LEN4=I
               GOTO 16
            END IF
 15      CONTINUE
 16      CONTINUE
      END IF



      IF (IN2) THEN
         DO 100 I=1,LEN2
            TEXT1(I:I)=INTEXT2(I:I)
 100     CONTINUE
      ELSE
         DO 101 I=1,LEN2
            TEXT1(I:I)=TEXT2(I:I)
 101     CONTINUE
      END IF

      IF (IN3) THEN
         DO 200 I=1,LEN3
            TEXT1(LEN2+I:LEN2+I)=INTEXT3(I:I)
 200     CONTINUE
      ELSE
         DO 201 I=1,LEN3
            TEXT1(LEN2+I:LEN2+I)=TEXT3(I:I)
 201     CONTINUE
      END IF

      IF (IN4) THEN
         DO 300 I=1,LEN4
            TEXT1(LEN2+LEN3+I:LEN2+LEN3+I)=INTEXT4(I:I)
 300     CONTINUE
      ELSE
         DO 301 I=1,LEN4
            TEXT1(LEN2+LEN3+I:LEN2+LEN3+I)=TEXT4(I:I)
 301     CONTINUE
      END IF
      IF (LEN1.GT.LEN2+LEN3+LEN4) THEN
         DO 400 I=LEN2+LEN3+LEN4+1,LEN1
            TEXT1(I:I)=' '
 400     CONTINUE
      END IF





      RETURN
      END
      SUBROUTINE GVSCCCB (TEXT1,INTEXT2,INTEXT3)











      IMPLICIT      NONE
      INTEGER       GVFLEN, LEN1, LEN2, LEN3, LENPOS, I
      CHARACTER*(*) TEXT1, INTEXT2, INTEXT3
      CHARACTER*80  TEXT2, TEXT3
      LOGICAL       FIRST







      FIRST=.TRUE.



      CALL GVSSTX (TEXT1,'?M4417')
      IF (GVFLEN(INTEXT2).LE.0) CALL GVSTT6 ('?TLSD72A2')
      IF (GVFLEN(INTEXT3).LE.0) CALL GVSTT6 ('?TLSD72B')
      IF (GVFLEN(INTEXT2).LE.0.OR.GVFLEN(INTEXT3).LE.0) THEN
         CALL GVSKIL
         GOTO 998
      END IF
      IF (GVFLEN(INTEXT2).GT.80.OR.GVFLEN(INTEXT3).GT.80) THEN
         CALL GVSTT6 ('?TLSD73')
      END IF
      CALL GVSSTX (TEXT2,INTEXT2(1:MIN(80,GVFLEN(INTEXT2))))
      CALL GVSSTX (TEXT3,INTEXT3(1:MIN(80,GVFLEN(INTEXT3))))



    1 CONTINUE
      LEN2=GVFLEN(TEXT2)
      LEN3=GVFLEN(TEXT3)
      LEN1=LEN2+LEN3+1



      LENPOS=LEN(TEXT1)
      IF (LEN1.GT.LENPOS) THEN




         CALL GVSTTE ('?TLSB39')
         CALL GVSTT6 (TEXT2)
         CALL GVSTT6 (TEXT3)
         IF (FIRST) THEN
            FIRST=.FALSE.
            CALL GVSCST (TEXT2)
            CALL GVSCST (TEXT3)
            GOTO 1
         END IF
         GOTO 998
      END IF



      IF (.NOT.FIRST) CALL GVSTT6 ('?TLSB40')



      IF (LEN2.EQ.0) THEN
         TEXT1=TEXT3
         GOTO 998
      END IF



      DO 10 I=1,LEN2
         TEXT1(I:I)=TEXT2(I:I)
   10 CONTINUE
      TEXT1(LEN2+1:LEN2+1)=' '
      DO 20 I=1,LEN3
         TEXT1(LEN2+I+1:LEN2+I+1)=TEXT3(I:I)
   20 CONTINUE
      DO 30 I=LEN2+LEN3+2,LENPOS
         TEXT1(I:I)=' '
   30 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCLC (TEXT)








      IMPLICIT      NONE
      INTEGER       GVFLEN, LENTXT, L, NUMUPP
      CHARACTER*(*) TEXT
      CHARACTER*1   LOWERC(26)
      SAVE          LOWERC
      DATA LOWERC /'a','b','c','d','e','f','g','h','i','j','k','l','m',
     +             'n','o','p','q','r','s','t','u','v','w','x','y','z'/







      LENTXT=GVFLEN(TEXT)



      IF (LENTXT.GT.0) THEN
         DO 20 L=1,LENTXT



            NUMUPP=INDEX('ABCDEFGHIJKLMNOPQRSTUVWXYZ',TEXT(L:L))
            IF (NUMUPP.NE.0) TEXT(L:L)=LOWERC(NUMUPP)
   20    CONTINUE
      END IF





      RETURN
      END

      SUBROUTINE GVSCPC (TEXT1,TEXT2)











      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, LEN1, LEN2
      CHARACTER*(*) TEXT1, TEXT2







      LEN1=GVFLEN(TEXT1)
      LEN2=GVFLEN(TEXT2)



      IF (LEN2.EQ.0) THEN
         IF (WIFPAR(1012).EQ.1) THEN
            CALL GVSTTB ('?TLSB41')
            CALL GVSKIL
         END IF
         GOTO 998
      END IF
      IF (LEN1.EQ.0) THEN
         CALL GVSSTX (TEXT1,TEXT2)
         GOTO 998
      END IF



      CALL GVSSTX (TEXT1(LEN1+1:LEN(TEXT1)),TEXT2)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCBC (TEXT1,TEXT2)













      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       LEN1, LEN2, ICH, I
      CHARACTER*(*) TEXT1, TEXT2







      LEN1=0
      LEN2=0
      DO 10 I=LEN(TEXT1),1,-1
         ICH=ICHAR(TEXT1(I:I))
         IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
            LEN1=I
            GOTO 11
         END IF
 10   CONTINUE
 11   CONTINUE
      DO 20 I=LEN(TEXT2),1,-1
         ICH=ICHAR(TEXT2(I:I))
         IF (ICH.NE.ICHAR(' ').AND.ICH.NE.0) THEN
            LEN2=I
            GOTO 21
         END IF
 20   CONTINUE
 21   CONTINUE



      IF (LEN2.EQ.0) THEN
         IF (WIFPAR(1012).EQ.1) THEN
            CALL GVSTTB ('?TLSB41')
            CALL GVSKIL
         END IF
         GOTO 998
      END IF
      IF (LEN1.EQ.0) THEN
         CALL GVSSTX (TEXT1,TEXT2)
         GOTO 998
      END IF



      TEXT1(LEN1+1:LEN1+1)=' '






      CALL GVSSTX (TEXT1(LEN1+2:LEN(TEXT1)),TEXT2)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCST (TEXT)








      IMPLICIT      NONE
      CHARACTER*(*) TEXT
      CHARACTER*36  CHROK1,CHROK2
      INTEGER       I, LENTXT
      DATA CHROK1   /'1234567890qwertyuiopasdfghjklzxcvbnm'/
      DATA CHROK2   /'$_%&,;:?-+QWERTYUIOPASDFGHJKLZXCVBNM'/







      LENTXT=LEN(TEXT)



      DO 10 I=1,LENTXT
         IF (INDEX(CHROK1,TEXT(I:I)).EQ.0.AND.
     +       INDEX(CHROK2,TEXT(I:I)).EQ.0) THEN
            TEXT(I:I)=' '
         END IF
   10 CONTINUE





      RETURN
      END
      SUBROUTINE GVSCTB (CROW,NUM)













      IMPLICIT      NONE
      INTEGER       NUM, I
      CHARACTER*1   CROW(NUM)







      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            CROW(I) = ' '
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD09')
         CALL GVSKIL
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD10',NUM)
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCUC (TEXT)








      IMPLICIT      NONE
      CHARACTER*(*) TEXT
      INTEGER       I, ICH







      IF (ICHAR(TEXT(1:1)).EQ.ICHAR('$')) GOTO 998



      DO 20 I=1,LEN(TEXT)
         ICH=ICHAR(TEXT(I:I))
         IF (ICH.GE.ICHAR('a').AND.ICH.LE.ICHAR('z'))
     +    TEXT(I:I)=CHAR(ICH-ICHAR('a')+ICHAR('A'))
   20 CONTINUE



  998 CONTINUE


      RETURN
      END

      SUBROUTINE GVSFMT (TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IS, I
      CHARACTER*(*) TEXT







      IF (TEXT(1:1).NE.'?') THEN
         CALL GVST6C ('?M5028',TEXT,.FALSE.)
         CALL GVSKIL
         GOTO 998
      END IF



      IS=MIN(LEN(TEXT),LEN(FMT))
      DO 10 I=1,IS
         FMT(I:I)=TEXT(I:I)
 10   CONTINUE
      DO 20 I=IS+1,LEN(FMT)
         FMT(I:I)=' '
 20   CONTINUE



      CALL GETTEXT (FMT)



 998  CONTINUE


      RETURN
      END   
      SUBROUTINE GVSFMTL (FMT,TEXT)

















      IMPLICIT      NONE
      INTEGER       I, IS
      CHARACTER*(*) TEXT
      CHARACTER*(*) FMT







      IF (TEXT(1:1).NE.'?') THEN
         CALL GVST6C ('?M5028',TEXT,.FALSE.)
         CALL GVSKIL
         GOTO 998
      END IF



      IS=MIN(LEN(TEXT),LEN(FMT))
      DO 10 I=1,IS
         FMT(I:I)=TEXT(I:I)
 10   CONTINUE
      DO 20 I=IS+1,LEN(FMT)
         FMT(I:I)=' '
 20   CONTINUE



      CALL GETTEXT (FMT)



 998  CONTINUE


      RETURN
      END   

      SUBROUTINE GVSLIN









      IMPLICIT      NONE







      CALL GVSTT6 
     + ('============================================================')





      RETURN
      END
      SUBROUTINE GVSLUN (IUNIT)







      IMPLICIT      NONE
      INTEGER       IUNIT







      CALL GVSTTU (IUNIT,
     + '============================================================')





      RETURN
      END
      SUBROUTINE GVSNL6 (NL)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       NL, I
      LOGICAL       GVFFOP
      CHARACTER*40  LFT







      IF (WIFPAR(405).NE.0) GOTO 998



      CALL GVSFMTL (LFT,'?FMT1350')
      IF (NL.GT.0) THEN
         IF (GVFFOP(16)) WRITE (16,LFT,ERR=998)
         DO 10 I=1,NL
            WRITE (6,LFT,ERR=998)
            IF (GVFFOP(PDBUNT)) WRITE (PDBUNT,LFT,ERR=998)
   10    CONTINUE
         GOTO 998
      ELSE IF (NL.EQ.0) THEN



         CALL GVSTTB ('?TLSD33')
         GOTO 998
      ELSE IF (NL.LT.0) THEN



         CALL GVSTTI ('?TLSD34',NL)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSNLU (NUMUNT,NL)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       NL, NUMUNT, I
      CHARACTER*40  LFT







      IF (WIFPAR(405).NE.0) GOTO 998



      CALL GVSFMTL (LFT,'?FMT1350')
      IF (NL.GT.0) THEN
         DO 10 I=1,NL
            WRITE (NUMUNT,LFT,ERR=999)
   10    CONTINUE
         GOTO 998
      ELSE IF (NL.EQ.0) THEN



         CALL GVSTTB ('?TLSD35')
         GOTO 998
      ELSE IF (NL.LT.0) THEN



         CALL GVSTTI ('?TLSD36',NL)
      END IF
      GOTO 998
  999 CONTINUE



  998 CONTINUE


      RETURN
      END

      SUBROUTINE GVSRDB (TEXT)







      IMPLICIT      NONE
      CHARACTER*(*) TEXT
      INTEGER       I, J
      LOGICAL       WASBLK, ISBLK







      IF (LEN(TEXT).LE.1) GOTO 998



      WASBLK=.FALSE.
      J=0
      DO 10 I=1,LEN(TEXT)
         ISBLK=(ICHAR(TEXT(I:I)).EQ.ICHAR(' '))
         IF (.NOT.(WASBLK.AND.ISBLK)) THEN
            J=J+1
            IF (J.LT.I) TEXT(J:J)=TEXT(I:I)
         END IF
         WASBLK=ISBLK
  10  CONTINUE
      IF (J.GE.LEN(TEXT)) GOTO 998
      DO 20 I=J+1,LEN(TEXT)
         TEXT(I:I)=' '
  20  CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSSHL (TEXT)








      IMPLICIT      NONE
      CHARACTER*(*) TEXT
      INTEGER       I, J, START







      DO 10 J=1,LEN(TEXT)
         IF (ICHAR(TEXT(J:J)).NE.ICHAR(' ')) THEN
            START=J
            GOTO 11
         END IF
 10   CONTINUE
      GOTO 998



 11   CONTINUE
      IF (START.EQ.1) GOTO 998



      I=1
      DO 20 J=START,LEN(TEXT)
         TEXT(I:I)=TEXT(J:J)
         I=I+1
 20   CONTINUE



      DO 30 J=I,LEN(TEXT)
         TEXT(J:J)=' '
 30   CONTINUE



  998 CONTINUE


      RETURN
      END

      SUBROUTINE GVSSHR (TEXT,LENGTH)












      IMPLICIT      NONE
      INTEGER       LENGTH, I, GVFLEN
      CHARACTER*(*) TEXT







      IF (LENGTH.LT.0) THEN
         CALL GVSTTE ('?M1972')
         CALL GVSKIL
         GOTO 998
      ELSE IF (LENGTH.EQ.0) THEN
         CALL GVSTTE ('?M1973')
         CALL GVSKIL
         GOTO 998
      ELSE IF (LENGTH.EQ.1) THEN
         CALL GVSTTE ('?M1974')
         GOTO 998
      END IF
      IF (GVFLEN(TEXT).LE.0) GOTO 998



   10 CONTINUE
      IF (TEXT(LENGTH:LENGTH).NE.' ') GOTO 998



      DO 20 I=LENGTH,2,-1
         TEXT(I:I)=TEXT(I-1:I-1)
   20 CONTINUE
      TEXT(1:1)=' '
      GOTO 10



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSSTX (TEXT1,TEXT2)











      IMPLICIT      NONE
      INTEGER       LEN1, LEN2, I, LENTXT
      CHARACTER*(*) TEXT1, TEXT2
      CHARACTER*80  LOCLIN







      LEN1=LEN(TEXT1)
      IF (LEN1.LE.0) THEN
         CALL GVSTTI ('?M4296',LEN1)
         CALL GVSKIL
         GOTO 998
      END IF



      LEN2=LEN(TEXT2)



      IF (TEXT2(1:1).EQ.'?') THEN



         DO 10 I=1,LEN2
            LOCLIN(I:I)=TEXT2(I:I)
 10      CONTINUE
         DO 20 I=LEN2+1,80
            LOCLIN(I:I)=' '
 20      CONTINUE



         CALL GETTEXT (LOCLIN)



         DO 30 I=1,MIN(LEN1,80)
            TEXT1(I:I)=LOCLIN(I:I)
 30      CONTINUE
         IF (LEN1.GT.80) THEN
            DO 40 I=81,LEN1
               TEXT1(I:I)=' '
 40         CONTINUE
         END IF
         GOTO 998
      END IF



      LENTXT=MIN(LEN1,LEN2)



      DO 50 I=1,LENTXT
         TEXT1(I:I)=TEXT2(I:I)
 50   CONTINUE



      IF (LENTXT.LT.LEN1) THEN
         DO 60 I=LENTXT+1,LEN1
            TEXT1(I:I)=' '
 60      CONTINUE
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVST6C (INTEXT1,INTEXT2,BLANK)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, I, LEN1, LEN2, LEN3
      CHARACTER*(*) INTEXT1, INTEXT2
      CHARACTER*1000 TEXT1, TEXT2, TEXT
      LOGICAL       BLANK







      IF (WIFPAR(405).NE.0) GOTO 998



      IF (INTEXT1(1:1).EQ.'?') THEN

         CALL GVSSTX (TEXT1,INTEXT1)
      ELSE
         CALL GVSCTB (TEXT1,1000)
         IF (GVFLEN(INTEXT1).GE.1) THEN
            DO 10 I=1,MIN(1000,GVFLEN(INTEXT1))
               TEXT1(I:I)=INTEXT1(I:I)
   10       CONTINUE
         ELSE
            IF (GVFLEN(INTEXT2).LE.0) THEN
               CALL GVSNL6 (1)
            ELSE
               CALL GVSTT6 (INTEXT2)
            END IF
            GOTO 998
         END IF
      END IF
      IF (INTEXT2(1:1).EQ.'?') THEN

         CALL GVSSTX (TEXT2,INTEXT2)
      ELSE
         CALL GVSCTB (TEXT2,1000)
         IF (GVFLEN(INTEXT2).GT.0) THEN
            DO 20 I=1,MIN(1000,GVFLEN(INTEXT2))
               TEXT2(I:I)=INTEXT2(I:I)
   20       CONTINUE
         ELSE
            IF (GVFLEN(INTEXT1).LE.0) THEN
               CALL GVSNL6 (1)
            ELSE
               CALL GVSTT6 (INTEXT1)
            END IF
            GOTO 998
         END IF
      END IF



      LEN1=GVFLEN(TEXT1)
      LEN2=GVFLEN(TEXT2)
      LEN3=LEN1+LEN2
      IF (BLANK) LEN3=LEN3+1



      IF (LEN3.EQ.0) THEN
         CALL GVSTTE ('?TLSNT6')
         GOTO 998
      ELSE IF (LEN3.GT.1000) THEN
         CALL GVSTTE ('?TLSCTL')
         CALL GVSTT6 (INTEXT1)
         CALL GVSTT6 (INTEXT2)
         CALL GVSTT6 (TEXT1)
         CALL GVSTT6 (TEXT2)
         GOTO 998
      END IF



      CALL GVSCTB (TEXT,1000)



      IF (LEN1.EQ.0) THEN
         CALL GVSSTX (TEXT(1:LEN2),TEXT2(1:LEN2))
      ELSE IF (LEN2.EQ.0) THEN
         CALL GVSSTX (TEXT(1:LEN1),TEXT1(1:LEN1))



      ELSE
         CALL GVSSTX (TEXT(1:LEN1),TEXT1(1:LEN1))
         IF (BLANK) THEN
            TEXT(LEN1+2:LEN1+LEN2+1)=TEXT2(1:LEN2)
         ELSE
            TEXT(LEN1+1:LEN1+LEN2)=TEXT2(1:LEN2)
         END IF
      END IF



      CALL GVSTT6 (TEXT)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTUC (IUNIT,INTEXT1,INTEXT2,BLANK)








      IMPLICIT       NONE
      INTEGER        GVFLEN, I, LEN1, LEN2, LEN, IUNIT
      CHARACTER*(*)  INTEXT1, INTEXT2
      CHARACTER*1000 TEXT1, TEXT2, TEXT
      LOGICAL        BLANK, GVFFOP







      IF (IUNIT.LE.0) THEN
         CALL GVSTTE ('?M4215')
         GOTO 998
      END IF
      IF (.NOT.GVFFOP(IUNIT)) THEN
         CALL GVSTTE ('?M1797')
         CALL GVST6C (INTEXT1,INTEXT2,BLANK)
         GOTO 998
      END IF



      IF (INTEXT1(1:1).EQ.'?') THEN
         CALL GVSSTX (TEXT1,INTEXT1)
         LEN1=GVFLEN(TEXT1)
      ELSE
         LEN1=GVFLEN(INTEXT1)
         IF (LEN1.GT.0) THEN
            DO 10 I=1,MIN(1000,LEN1)
               TEXT1(I:I)=INTEXT1(I:I)
 10         CONTINUE
         END IF
         IF (LEN1.LT.1000) THEN
            DO 11 I=LEN1+1,1000
               TEXT1(I:I)=' '
 11         CONTINUE
         END IF
      END IF
      IF (INTEXT2(1:1).EQ.'?') THEN
         CALL GVSSTX (TEXT2,INTEXT2)
         LEN2=GVFLEN(TEXT2)
      ELSE
         LEN2=GVFLEN(INTEXT2)
         IF (LEN2.GT.0) THEN
            DO 20 I=1,MIN(1000,LEN2)
               TEXT2(I:I)=INTEXT2(I:I)
 20         CONTINUE
         END IF
         IF (LEN2.LT.1000) THEN
            DO 21 I=LEN2+1,1000
               TEXT2(I:I)=' '
 21         CONTINUE
         END IF
      END IF



      LEN=LEN1+LEN2
      IF (BLANK) LEN=LEN+1



      IF (LEN.EQ.0) THEN
         CALL GVSTTE ('?TLSNT6')
         GOTO 998
      ELSE IF (LEN.GT.1000) THEN
         CALL GVSTTE ('?TLSCTL')
         CALL GVSTT6 (INTEXT1)
         CALL GVSTT6 (INTEXT2)
         CALL GVSTT6 (TEXT1)
         CALL GVSTT6 (TEXT2)
         GOTO 998
      END IF



      IF (LEN1.EQ.0) THEN
         CALL GVSSTX (TEXT(1:LEN2),TEXT2(1:LEN2))
      ELSE IF (LEN2.EQ.0) THEN
         CALL GVSSTX (TEXT(1:LEN1),TEXT1(1:LEN1))



      ELSE
         CALL GVSSTX (TEXT(1:LEN1),TEXT1(1:LEN1))
         IF (BLANK) THEN
            LEN1=LEN1+1
            TEXT(LEN1:LEN1)=' '
         END IF
         DO 30 I=1,LEN2
            TEXT(LEN1+I:LEN1+I)=TEXT2(I:I)
 30      CONTINUE
         DO 40 I=LEN1+LEN2+1,1000
            TEXT(I:I)=' '
 40      CONTINUE
      END IF



      CALL GVSTTU (IUNIT,TEXT)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTCP (TEXT)









      IMPLICIT      NONE
      CHARACTER*(*) TEXT
      INTEGER       ICHR, ILOOP







      ICHR=0



      DO 10 ILOOP=1,LEN(TEXT)
         IF (ICHAR(TEXT(ILOOP:ILOOP)).NE.ICHAR(' ')) THEN
            ICHR=ICHR+1
            IF (ICHR.LT.ILOOP) TEXT(ICHR:ICHR)=TEXT(ILOOP:ILOOP)
         END IF
   10 CONTINUE



      DO 20 ILOOP=ICHR+1,LEN(TEXT)
         TEXT(ILOOP:ILOOP)=' '
   20 CONTINUE





      RETURN
      END
      SUBROUTINE GVSTTB (INTEXT)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       I, GVFLEN
      CHARACTER*(*) INTEXT
      CHARACTER*40  LFT
      CHARACTER*132 TEXT
      LOGICAL       GVFFOP







      IF (WIFPAR(1012).EQ.0.AND.WIFPAR(1105).NE.0) GOTO 997



      CALL GVSSTX (TEXT,INTEXT)



      IF (GVFLEN(TEXT).LE.0) THEN
         CALL GVSFMTL (LFT,'?FMT1444')
         WRITE (6,LFT,ERR=999)
         GOTO 997
      END IF



      CALL GVSFMTL (LFT,'?FMT1443')
      WRITE (6,LFT,ERR=999) (TEXT(I:I),I=1,GVFLEN(TEXT))



      IF (GVFFOP(PDBUNT)) WRITE (PDBUNT,FMT,ERR=998)
     + (TEXT(I:I),I=1,GVFLEN(TEXT))



      IF (GVFFOP(16)) WRITE (16,FMT,ERR=999) 
     + (TEXT(I:I),I=1,GVFLEN(TEXT))



      GOTO 997



 999  CONTINUE
      CALL GVSFMT ('?FMT1445')
      WRITE (6,FMT,ERR=997)
      GOTO 997
 998  CONTINUE
      CALL GVSFMT ('?FMT1446')
      WRITE (6,FMT,ERR=997)
      GOTO 997



  997 CONTINUE


      RETURN
      END
      SUBROUTINE GVSEIW (ROUTINE)







      IMPLICIT      NONE
      CHARACTER*(*) ROUTINE
      CHARACTER*80  FMT, LOCLIN







      CALL GVSSTX (FMT,'?R00231')
      WRITE (LOCLIN,FMT,ERR=999) ROUTINE
      CALL GVSTT6 (LOCLIN)
      GOTO 998



  999 CONTINUE
      CALL GVSTTB ('?M4179')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSEIR (ROUTINE)







      IMPLICIT      NONE
      CHARACTER*(*) ROUTINE
      CHARACTER*80  FMT, LOCLIN







      CALL GVSSTX (FMT,'?R00231R')
      WRITE (LOCLIN,FMT,ERR=999) ROUTINE
      CALL GVSTT6 (LOCLIN)
      GOTO 998



  999 CONTINUE
      CALL GVSTTB ('?M4180')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTTE (INTEXT)









      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INCLUDE       'IRIGRA.INC'
      CHARACTER*(*) INTEXT
      INTEGER       GVFLEN, I
      LOGICAL       GVFFOP
      CHARACTER*20  FMT
      CHARACTER*132 TEXT







      CALL GVSSTX (TEXT,INTEXT)



      IF (GVFLEN(TEXT).LE.0) THEN
         CALL GVSTT6 ('?M5029')
         GOTO 997
      END IF



      CALL GVSFMTL (FMT,'?FMT1420')
      WRITE (6,FMT,ERR=999) (TEXT(I:I),I=1,GVFLEN(TEXT))



      IF (GVFFOP(PDBUNT)) WRITE (PDBUNT,FMT,ERR=998)
     + (TEXT(I:I),I=1,GVFLEN(TEXT))



      IF (GVFFOP(16)) WRITE (16,FMT,ERR=999) 
     + (TEXT(I:I),I=1,GVFLEN(TEXT))



      GOTO 997



 999  CONTINUE
      CALL GVSTT6 ('?M5030')
      GOTO 997
 998  CONTINUE
      CALL GVSTT6 ('?M5031')



  997 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTT6 (TEXT)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       GVFLEN, I

      CHARACTER*(*) TEXT
      CHARACTER*40  LFT
      LOGICAL       GVFFOP








         IF (TEXT(1:4).eq.'HOH ') THEN
            PRINT*,TEXT
            CALL GVSKIL
         END IF






      IF (WIFPAR(405).NE.0) GOTO 997
      IF (LEN(TEXT).LE.0) THEN
         CALL GVSTTB ('?M4287')
         CALL GVSKIL
         GOTO 997
      END IF



      IF (TEXT(1:1).EQ.'?') THEN
         CALL SHOWTEXT (TEXT)
         GOTO 997
      END IF



      IF (WIFPAR(1012).EQ.0.AND.LEN(TEXT).GT.4) THEN
         IF (TEXT(1:4).EQ.'DBG>') GOTO 997
      END IF



      CALL GVSFMTL (LFT,'?FMT1448')
      IF (WIFPAR(597).NE.1) THEN
         WRITE (6,LFT,ERR=998) (TEXT(I:I),I=1,GVFLEN(TEXT))
      END IF



      IF (GVFFOP(16)) WRITE (16,LFT,ERR=998) (TEXT(I:I),I=1,
     + GVFLEN(TEXT))





         IF (GVFFOP(PDBUNT)) WRITE (PDBUNT,LFT,ERR=999)
     +    (TEXT(I:I),I=1,GVFLEN(TEXT))



         CALL TEXTXT (TEXT)




      GOTO 997



 998  CONTINUE
      CALL GVSFMT ('?FMT1449') 
      WRITE (6,FMT,ERR=997)
      GOTO 997

 999     CONTINUE
         CALL GVSFMT ('?FMT1447') 
         WRITE (6,FMT,ERR=997)
         GOTO 997




  997 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTTU (NUMUNT,TEXT)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, NUMUNT, I, LENTXT

      CHARACTER*(*) TEXT
      CHARACTER*40  LFT
      CHARACTER*50000 LINE50000













      IF (NUMUNT.EQ.6.AND.WIFPAR(405).NE.0) GOTO 998



      LENTXT=LEN(TEXT)
      CALL GVSFMTL (LFT,'?FMT1450')
      IF (TEXT(1:1).EQ.'?') THEN
         CALL GVSSTX (LINE50000,TEXT(1:MIN(50000,LENTXT)))
         WRITE (NUMUNT,LFT,ERR=999) (LINE50000(I:I),I=1,
     +    MAX(1,GVFLEN(LINE50000)))
      ELSE
         WRITE (NUMUNT,LFT,ERR=999) (TEXT(I:I),I=1,
     +    MAX(1,GVFLEN(TEXT)))
      END IF
      GOTO 998



  999 CONTINUE
      CALL GVSFMTL (LFT,'?FMT1451')
      WRITE (6,LFT,ERR=998) NUMUNT
      GOTO 998



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTO6 (TEXT)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, I, LENTXT
      CHARACTER*(*) TEXT
      CHARACTER*80  LOCLIN







      IF (WIFPAR(405).NE.0) GOTO 998



      LENTXT=LEN(TEXT)
      CALL GVSSTX (LOCLIN(1:80),TEXT(1:MIN(80,LENTXT)))



      IF (GVFLEN(LOCLIN).LE.0) GOTO 998
      IF (WIFPAR(597).NE.1) THEN
         WRITE (6,'(80A1)',ERR=998) (LOCLIN(I:I),I=1,GVFLEN(LOCLIN))
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTTL (INTEXT,INBOOL)












      IMPLICIT      NONE
      LOGICAL       INBOOL
      CHARACTER*10  FMTL
      CHARACTER*(*) INTEXT
      CHARACTER*132 TEXT







      CALL GVSSTX (TEXT,INTEXT)



      CALL GVSFMTL (FMTL,'?FMT021')
      WRITE (TEXT(132:132),FMTL,ERR=999) INBOOL
      CALL GVSRDB (TEXT)
      CALL GVSTT6 (TEXT)
      GOTO 998



  999 CONTINUE
      CALL GVSTTE ('?M4182')
      CALL GVSTT6 (TEXT)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTOI (INTEXT,ININT)












      IMPLICIT      NONE
      INTEGER       ININT
      CHARACTER*10  FMTL
      CHARACTER*(*) INTEXT
      CHARACTER*132 TEXT







      CALL GVSSTX (TEXT,INTEXT)



      CALL GVSFMTL (FMTL,'?FMT016')
      WRITE (TEXT(123:132),FMTL,ERR=999) ININT
      CALL GVSRDB (TEXT)
      CALL GVSTO6 (TEXT)
      GOTO 998



  999 CONTINUE
      CALL GVSTO6 ('?M4181')
      CALL GVSTO6 (TEXT)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSTTR2P (INTEXT,INREAL1,INREAL2)













      IMPLICIT      NONE
      REAL          INREAL1, INREAL2
      CHARACTER*(*) INTEXT
      CHARACTER*132 TEXT







      CALL GVSSTX (TEXT,INTEXT)



      CALL GVSR2P (TEXT(103:132),INREAL1,INREAL2,2)
      CALL GVSRDB (TEXT)
      CALL GVSTT6 (TEXT)





      RETURN
      END
      SUBROUTINE GVSWIL (TEXT,INT,IERR)







      IMPLICIT      NONE
      INTEGER       INT, IERR, LENTXT
      CHARACTER*(*) TEXT







      IERR=0
      LENTXT=LEN(TEXT)
      CALL GVSCTB (TEXT,LENTXT)



      IF (LEN(TEXT).EQ.1) WRITE (TEXT,'(I1)',ERR=999) INT
      IF (LEN(TEXT).EQ.2) WRITE (TEXT,'(I2)',ERR=999) INT
      IF (LEN(TEXT).EQ.3) WRITE (TEXT,'(I3)',ERR=999) INT
      IF (LEN(TEXT).EQ.4) WRITE (TEXT,'(I4)',ERR=999) INT
      IF (LEN(TEXT).EQ.5) WRITE (TEXT,'(I5)',ERR=999) INT
      IF (LEN(TEXT).EQ.6) WRITE (TEXT,'(I6)',ERR=999) INT
      IF (LEN(TEXT).EQ.7) WRITE (TEXT,'(I7)',ERR=999) INT
      IF (LEN(TEXT).EQ.8) WRITE (TEXT,'(I8)',ERR=999) INT
      IF (LEN(TEXT).EQ.9) WRITE (TEXT,'(I9)',ERR=999) INT
      IF (LEN(TEXT).GE.10) WRITE (TEXT,'(I10)',ERR=999) INT
      CALL GVSSHL (TEXT)
      GOTO 998



  999 CONTINUE
      CALL GVSTTE ('?TLSC98')
      IERR=1



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSWRL (TEXT,VALUE,IERR)







      IMPLICIT      NONE
      INTEGER       IERR, LENTXT
      REAL          VALUE
      CHARACTER*(*) TEXT







      IERR=0
      LENTXT=LEN(TEXT)
      CALL GVSCTB (TEXT,LENTXT)
      IF (LEN(TEXT).GE.10) WRITE (TEXT,'(F10.4)',ERR=999) VALUE
      CALL GVSSHL (TEXT)
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('GVSWRL')
      IERR=1



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSWTL (TEXT1,TEXT2,INT,IERR)







      IMPLICIT      NONE
      INTEGER       INT, IERR, LENDIF, GVFLEN, LENTXT
      CHARACTER*(*) TEXT1, TEXT2
      CHARACTER*5   FMT







      IERR=0
      LENTXT=LEN(TEXT1)
      CALL GVSSTX (TEXT1,TEXT2)
      CALL GVSSHL (TEXT1)
      LENDIF=LEN(TEXT1)-GVFLEN(TEXT1)
      IF (LENDIF.GE.10) THEN
         FMT='(I10)'
         LENDIF=10
      ELSE
         WRITE (FMT,1000,ERR=999) LENDIF
      END IF



      WRITE (TEXT1(LENTXT-LENDIF+1:LENTXT),FMT,ERR=999) INT
      GOTO 998



  999 CONTINUE
      CALL GVSTTE ('?TLSC98')
      IERR=1



  998 CONTINUE


 1000 FORMAT ('(I',I1,')')

      RETURN
      END
      SUBROUTINE GVSR2P (OUT,R,S,MODE)












      IMPLICIT      NONE
      CHARACTER*10  FMT
      CHARACTER*(*) OUT
      REAL          R,S,LOGR,LOGS, CHUNK
      INTEGER       DIGITS, LOCMOD, MODE, SD
      INTEGER       DECIMALS





      LOCMOD=MODE
      IF (S.LT.0.0) THEN
         CALL GVSTTB ('?M4288')
         S=-S
      END IF
      IF (ABS(R).LT.1.E-10) THEN
         LOGR=-10.0
      ELSE
         LOGR=LOG(ABS(R))/LOG(10.0)
      END IF
      IF (ABS(S).LT.1.E-10) THEN
         LOGS=-10.0
      ELSE
         LOGS=LOG(ABS(S/1.949))/LOG(10.0)
      END IF
      DIGITS=INT(LOGR-LOGS+1.01)
      IF (LOGS.GT.0.0) THEN
         DECIMALS=-INT(LOGS)
      ELSE
         DECIMALS=INT(-LOGS)+1
      END IF
      CHUNK=10.0**(-DECIMALS)
      R=ANINT(R/CHUNK)*CHUNK
      S=ANINT(S/CHUNK)*CHUNK
      IF (DIGITS.GT.8.OR.DECIMALS.GT.5.OR.DECIMALS.LT.-2) THEN
         LOCMOD=2
         DECIMALS=MIN(8,DIGITS)-1
         DIGITS=DECIMALS+5
         WRITE (FMT,102,ERR=998) DIGITS,DECIMALS
  102    FORMAT ('(E',I2.2,'.',I1.1,')')
      ELSE IF (LOGR.LT.-1.0) THEN



         DIGITS=DECIMALS+3
         WRITE (FMT,100,ERR=998) DIGITS,DECIMALS
  100    FORMAT ('(F',I2.2,'.',I1.1,')')
      ELSE IF (DECIMALS.LT.0) THEN
         DIGITS=INT(LOGR+3)
         WRITE (FMT,101,ERR=998) DIGITS
  101    FORMAT('(F',I2.2,'.0)')
         DECIMALS=0
      ELSE
         DIGITS=DIGITS+2
         WRITE (FMT,100,ERR=998) DIGITS,DECIMALS
      END IF
      WRITE (OUT(1:DIGITS),FMT,ERR=998) R
      IF (LOCMOD.EQ.1) THEN
         SD=NINT(S*(10**DECIMALS))



         IF (DECIMALS.EQ.0) DIGITS=DIGITS-1
         IF (SD.GT.99) THEN
            WRITE (OUT(DIGITS+1:),103,ERR=998) SD
         ELSE IF (SD.GT.9) THEN
            WRITE (OUT(DIGITS+1:),104,ERR=998) SD
         ELSE
            WRITE (OUT(DIGITS+1:),105,ERR=998) SD
         END IF
  103    FORMAT ('(',I3,')')
  104    FORMAT ('(',I2,')')
  105    FORMAT ('(',I1,')')
      ELSE
         OUT(DIGITS+1:DIGITS+5)=' +/- '
         WRITE (OUT(DIGITS+6:),FMT,ERR=998) S
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE GVSCLA (TEXT1,TEXT2)










      IMPLICIT      NONE
      INTEGER       I, GVFLEN, IPOS, GVFPOS
      CHARACTER*(*) TEXT1, TEXT2







      IF (GVFLEN(TEXT2).GT.LEN(TEXT1)) GOTO 998



      IPOS=GVFPOS(TEXT1,TEXT2)
      IF (IPOS.LE.0) GOTO 998



      DO 10 I=IPOS,LEN(TEXT1)
         TEXT1(I:I)=' '
   10 CONTINUE



  998 CONTINUE


      RETURN
      END 
      SUBROUTINE GVSSTX_NC (TEXT1,TEXT2)











      IMPLICIT      NONE
      INTEGER       LEN1, LEN2, I, LENTXT
      CHARACTER*(*) TEXT1, TEXT2







      IF (TEXT2(1:1).EQ.'?') THEN
         CALL GVSSTX (TEXT1,TEXT2)
         GOTO 998
      END IF



      LEN1=LEN(TEXT1)
      LEN2=LEN(TEXT2)
      LENTXT=MIN(LEN1,LEN2)



      DO 10 I=1,LENTXT
         TEXT1(I:I)=TEXT2(I:I)
   10 CONTINUE



      IF (LENTXT.LT.LEN1) THEN
         DO 20 I=LENTXT+1,LEN1
            TEXT1(I:I)=' '
   20    CONTINUE
      END IF



  998 CONTINUE


      RETURN
      END
