* PACKAGE GTHBIN  !" HITAC VBS تر´¹
************************************************************************
      PROGRAM GTHBIN
*
#ifdef SYS_IBMS
      INCLUDE    (GTSINC)
      INCLUDE    (GZSIZE)
#else
#include         "gtsinc.F"
#include         "gzsize.F"
#endif
*
      CHARACTER  HHEAD ( NDC )*(NCC)
      REAL       GDATA ( IJKDIM )
*
*   [INTERNAL WORK] 
      INTEGER    II, IRTN, ISIZE
*
*   [EXTERNAL FUNC] 
      INTEGER    HOPEN, HCLOSE, HGNC, HGNF
*
*   [INTERNAL PARM] 
      CHARACTER  HFILE( 1 )        *(NFILN)
      DATA       HFILE / 'gtool.pln' /
      INTEGER    IFILE
      INTEGER    JFILE
      DATA       JFILE / 50 /
      CHARACTER  OUT    *(NFILN)
      DATA       OUT    / '$GTTMPDIR/gtool.out' /
      LOGICAL    APND
      DATA       APND   / .FALSE. /
      LOGICAL    HELP
      DATA       HELP / .FALSE. /
*
      NAMELIST  /OPTION/ OUT, APND, HFILE, HELP
*
      CALL OPTARG ( 91, 'OPTION', 'HFILE', NOPT, NFILE )
      READ (91,OPTION,IOSTAT=IOS)
      CLOSE(91)
      IF ( IOS.NE.0 .OR. HELP ) THEN
         WRITE(6,OPTION)
         STOP
      ENDIF
*
      CALL GTOPEN
      CALL GTSIZE ( HHEAD , IJKDIM )
*
      CALL GURNTF ( HFILE( 1 ), OUT  , '$GTTMPDIR/gtool.plnin' )
*
      IFILE = HOPEN ( HFILE( 1 ) )
      CALL GFOOPN ( JFILE, OUT , APND )
*
      II = 0
 1100 CONTINUE
         II = II + 1
*
         IRTN = HGNC( IFILE,HHEAD,NDC*NCC )
*
         IF ( IRTN .GT. 0 ) THEN
            CALL GUQTSZ ( HHEAD, ISIZE )
            IRTN = HGNF( IFILE, GDATA, ISIZE )
*
            CALL GFWRIT
     I         ( HHEAD , GDATA ,
     I           JFILE , 1     , 0       )
      GOTO 1100            
         ENDIF
*
      IRTN = HCLOSE ( IFILE )
*
      STOP
      END
