*%表題   GTOOL 書式付ファイルの作成
*%
*%履歴   91/05/01 佐藤正樹       D:\FORT\GTOOL\SAMPLE\SDWRIT3.FOR
*%       91/05/21 佐藤正樹       C:\FORT\OORT\GTDATA.FOR
*%
*%
      SUBROUTINE GTDATA
     I           ( JFILE,  HFILEO,   HXFORM, 
     I             GDATA,
     I             HDSET , HITEM , IFNUM ,
     I             HTITL , HUNIT , HUTIM , ITDUR ,
     I             HEDIT,  HETTL, 
     I             HAITM1, HAITM2, HAITM3,
     I             DMIN  , DMAX  , DIVS  , DIVL  , ISTYP,
     I             IYEAR , IMONTH, IDAY  , IHOUR , IMIN  , ISEC ,
     D             IDIM,   JDIM,   KDIM )
*
      CHARACTER  HFILEO       *(*)
      INTEGER    JFILE
      CHARACTER  HXFORM*(*)

      INTEGER    IDIM
      INTEGER    JDIM
      INTEGER    KDIM
      INTEGER    IJKDIM
      REAL       GDATA ( IDIM*JDIM*KDIM )


      PARAMETER  ( NCC=16, NDC=64 )

      CHARACTER  HHEAD ( NDC )*(NCC)

      CHARACTER  HDSET *(NCC)
      CHARACTER  HITEM *(NCC)
      CHARACTER  HTITL *(NCC*2)
      CHARACTER  HUNIT *(NCC)
      CHARACTER  HDATE *(NCC)
      CHARACTER  HUTIM *(NCC)
      CHARACTER  HUTIMD*(NCC)
      CHARACTER  HAITM1*(NCC)
      CHARACTER  HAITM2*(NCC)
      CHARACTER  HAITM3*(NCC)
      CHARACTER  HEDIT*(NCC)
      CHARACTER  HETTL*(NCC)

      INTEGER    IFNUM
      INTEGER    ITDUR
      REAL       DMIN
      REAL       DMAX
      REAL       DIVS
      REAL       DIVL
      INTEGER    ISTYP

      INTEGER    IYEAR
      INTEGER    IMONTH
      INTEGER    IDAY
      INTEGER    IHOUR
      INTEGER    IMIN
      INTEGER    ISEC

*-----------------------------------------------------------------------

      IJKDIM= IDIM*JDIM*KDIM

*-----------------------------------------------------------------------
*
      CALL GTSIZE ( HHEAD , IJKDIM )
      CALL GTSIGN ( 'SATOH' )
*
      CALL GTPGET ( 'MISS', VMISS )

      CALL GHPACK
     O         ( HHEAD ,
     I           HDSET , HITEM , IFNUM , 0     ,
     I           HTITL , HUNIT ,
     I           0     , ' '   , HUTIM , ITDUR ,
     I           HAITM1, 1     , IDIM  ,
     I           HAITM2, 1     , JDIM  ,
     I           HAITM3, 1     , KDIM  ,
     I           HXFORM, VMISS,
     I           DMIN  , DMAX  , DIVS  , DIVL  , ISTYP ,
     I           ' '   , ' '                            )

      CALL  GHEADD
     M         ( HHEAD ,
     I           HEDIT,  HETTL )
*
      CALL DATE32( IYEAR, IMONTH, IDAY , ITD )          ! SUBFUNC
      KTIME = ITD*24 + IHOUR
      HUTIMD = 'HOUR'


         CALL GUCT2R
     I         ( KTIME , HUTIMD , HUTIM , 1.     ,
     O           RTIME                             )
         RTIME = REAL(KTIME)
         CALL GUTPAC
     I         ( IYEAR , IMONTH, IDAY  ,
     I           IHOUR , IMIN  , ISEC  ,
     O           HDATE                  )

         II = 1
         CALL GHPSET ( HHEAD, 'DNUM', II         )
         CALL GHPSET ( HHEAD, 'TIME', INT(RTIME) )
         CALL GHCSET ( HHEAD, 'DATE', HDATE      )
*
*     < 出力 >

      CALL  WTGTDT
     I           ( JFILE,    HFILEO,
     O             HHEAD,    GDATA )
*
      RETURN
      END
