



      LOGICAL FUNCTION GVFFOP(NUMUNT)

















      IMPLICIT      NONE
      INTEGER       NUMUNT
      LOGICAL       ISOPEN







      IF (NUMUNT.EQ.5.OR.NUMUNT.EQ.6) THEN
         GVFFOP=.TRUE.
         GOTO 998
      END IF
      IF (NUMUNT.EQ.-999) THEN
         GVFFOP=.FALSE.
         GOTO 998
      END IF
      IF (NUMUNT.GT.0) THEN



         IF (NUMUNT.GT.100) THEN
            GVFFOP=.FALSE.
            CALL GVSTTI ('?TLSB23',NUMUNT)
            CALL GVSKIL
            GOTO 998
         END IF



         INQUIRE (UNIT=NUMUNT,OPENED=ISOPEN)
         GVFFOP=ISOPEN
         GOTO 998
      ELSE IF (NUMUNT.LE.0) THEN



         GVFFOP=.FALSE.
         CALL GVSTTI ('?TLSB23',NUMUNT)
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION GVFISF(FILNAM)









      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, LENFIL
      LOGICAL       ISIT
      CHARACTER*(*) FILNAM
      CHARACTER*(MAXPATH) LOCFIL







      CALL GVSSTX (LOCFIL,FILNAM)
      CALL GVSSHL (LOCFIL)
      LENFIL=GVFLEN(LOCFIL)



      IF (LENFIL.EQ.0) THEN
         GVFISF=.FALSE.
         GOTO 998
      END IF



      INQUIRE (FILE=LOCFIL(1:LENFIL),EXIST=ISIT)
      GVFISF=ISIT



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCLF (IUNIT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IUNIT, IOS
      LOGICAL       GVFFOP







      IF (IUNIT.LE.0) THEN
         IF (WIFPAR(1012).NE.0) THEN
            CALL GVSTTI ('?M4119',IUNIT)
            CALL GVSKIL
            GOTO 999
         ELSE
            GOTO 998
         END IF
      END IF
      IF (IUNIT.EQ.5.OR.IUNIT.EQ.6) THEN
         IF (WIFPAR(1012).NE.0) THEN
            CALL GVSTTI ('?M4119',IUNIT)
            GOTO 999
         ELSE
            GOTO 998
         END IF
      END IF



      IF (GVFFOP(IUNIT)) CLOSE (UNIT=IUNIT,IOSTAT=IOS,ERR=999,
     + STATUS='KEEP')
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('GVSCLF')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE GVSCLFX (NUMUNT)











      IMPLICIT      NONE
      LOGICAL       GVFFOP
      INTEGER       NUMUNT







      IF (NUMUNT.GT.0.AND.NUMUNT.LE.128) THEN



         IF (GVFFOP(NUMUNT)) CLOSE (UNIT=NUMUNT)
         GOTO 998



      ELSE IF (NUMUNT.EQ.0) THEN
         GOTO 998
      ELSE IF (NUMUNT.LT.0) THEN



         CALL GVSTTI ('?TLSB24',NUMUNT)
         CALL C1234567 ('In GVSCLF')
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSROF (NUMUNT,IERR)









      IMPLICIT      NONE
      LOGICAL       GVFFOP
      INTEGER       NUMUNT, IUNIT, IERR







      NUMUNT=0
      IERR=0



      DO 10 IUNIT=78,68,-1
         IF (.NOT.GVFFOP(IUNIT)) THEN
            NUMUNT=IUNIT
            GOTO 998
         END IF
   10 CONTINUE
      DO 20 IUNIT=95,93,-1
         IF (.NOT.GVFFOP(IUNIT)) THEN
            NUMUNT=IUNIT
            GOTO 998
         END IF
   20 CONTINUE



      CALL SHOWTEXT ('?M0772')
      IERR=1
      CALL C1234567 ('In GVSROF')
      CALL GVSLOP
      CALL GVSKIL



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSLOP

















      IMPLICIT      NONE
      INTEGER       IUNIT, IC2, IC4, I
      LOGICAL       GVFFOP, GVFIBN, LC2(10), LC4(11)
      CHARACTER*250 LINE







      IC2=0
      IC4=0



      DO 10 IUNIT=1,100
         IF (.NOT.GVFIBN(IUNIT,5,6)) THEN
            IF (GVFIBN(IUNIT,21,30)) THEN
               IF (GVFFOP(IUNIT)) THEN
                  IC2=IC2+1
                  LC2(IUNIT-20)=GVFFOP(IUNIT)
               END IF
            ELSE IF (GVFIBN(IUNIT,40,50)) THEN
               IF (GVFFOP(IUNIT)) THEN
                  IC4=IC4+1
                  LC2(IUNIT-39)=GVFFOP(IUNIT)
               END IF
            ELSE
               IF (GVFFOP(IUNIT)) THEN
                  INQUIRE (UNIT=IUNIT,NAME=LINE)
                  CALL GVSTTI ('?IRIUOP',IUNIT)
                  CALL GVST6C ('?M0804',LINE,.FALSE.)
               END IF
            END IF
         END IF
 10   CONTINUE



      IF (IC2.GE.1.AND.IC2.LE.9) THEN
         CALL GVSTT6 ('?M5197')
         WRITE (6,*,ERR=998) (LC2(I),I=1,10)
      ELSE
         CALL GVSTT6 ('?M5198')
      END IF
      IF (IC4.GE.1.AND.IC4.LE.10) THEN
         CALL GVSTT6 ('?M5199')
         WRITE (6,*,ERR=998) (LC4(I),I=1,11)
      ELSE
         CALL GVSTT6 ('?M5200')
      END IF



 998  CONTINUE


      RETURN
      END   
      SUBROUTINE GVSOPS (NUMUNT)











      IMPLICIT      NONE
      LOGICAL       GVFFOP
      INTEGER       NUMUNT







      IF (NUMUNT.GT.0.AND.NUMUNT.LE.100) THEN



         IF (GVFFOP(NUMUNT)) THEN
            CALL GVSTTI ('?TLSD44',NUMUNT)
            CLOSE (UNIT=NUMUNT)
         END IF




         OPEN (UNIT=NUMUNT,ACCESS='SEQUENTIAL',FORM='UNFORMATTED',
     +    STATUS='UNKNOWN',ERR=999)
         GOTO 998



      ELSE



         CALL GVSTTI ('?TLSB25',NUMUNT)
      END IF



  999 CONTINUE
      CALL GVSTTB ('?TLSD45')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSREW (IUNIT)











      IMPLICIT      NONE
      LOGICAL       GVFFOP
      INTEGER       IUNIT







      IF (IUNIT.LE.0.OR.IUNIT.GT.100) THEN
         CALL GVSTTI ('?TLSB26',IUNIT)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (.NOT.GVFFOP(IUNIT)) THEN
         CALL GVSTTI ('?TLSB27',IUNIT)
         GOTO 998
      END IF



      REWIND (UNIT=IUNIT,ERR=999)
      GOTO 998



 999  CONTINUE
      CALL GVSTTI ('?TLSB28',IUNIT)
      CALL GVSKIL



  998 CONTINUE


      RETURN
      END
