* PACKAGE GTINTFC  !" GTOOL3 $B<B?t@:EYJQ49%$%s%?!<%U%'!<%9(B(ZFWRIT)
*
*"  [HIS] 96/03/08(takepiro) $B<+F0G\@:EY%3%s%Q%$%k6X;_(B
*
**********************************************************************
*"      <<  GTOOL3$BI8=`%U%)!<%^%C%H%G!<%?=q$-9~$_(B >>
**********************************************************************
      SUBROUTINE ZFWRIT
     I            ( HHEAD , GDATA , 
     I              JFILE , MODE  , NOEND )
*
      CHARACTER  HHEAD ( * )*(*)         !" $B%X%C%@!<(B
#ifdef AUTO_DBL
      REAL*8     GDATA ( * )             !" $B%G!<%?(B
#else
      REAL*4     GDATA ( * )             !" $B%G!<%?(B
#endif
      INTEGER    JFILE                   !" $B%U%!%$%kHV9f(B
      INTEGER    MODE                    !" $B%b!<%I(B(1$B$J$iI=<((BON)
      INTEGER    NOEND                   !" ENDFILE $B$N4V3V(B
*
* [PARAM]
#include        "zcdim.F"            !" $B3J;RE@?t(B, $BGH?t(B
#include        "zhdim.F"            !" $BJ8;zNsJ8;z?t(B
*
      INTEGER    IJKDIM
        PARAMETER  ( IJKDIM = (NX+2)*(NZ+2) )
      INTEGER    IJK                         !" $B%k!<%W%+%&%s%?!<(B
      INTEGER    IJKSIZ                      !" $BG[Ns$NBg$-$5(B
*
      CHARACTER  HDFMTI  *(NCC)              !" $B%G!<%?%U%)!<%^%C%H(B
*
      REAL*8     DDATA ( IJKDIM )
      REAL*4     SDATA ( IJKDIM )
      EQUIVALENCE (DDATA,SDATA)
*
*" << CNVDBL : $B@:EYJQ49(B >>
*
      CALL GHCGET ( HHEAD, 'DFMT',  HDFMTI )
      CALL GUQTSZ ( HHEAD, IJKSIZ )
*
      IF ( HDFMTI .EQ. 'UR8' ) THEN
         DO 1110 IJK = 1, IJKSIZ
            DDATA( IJK ) = GDATA( IJK ) 
 1110    CONTINUE
      ELSE
         DO 1120 IJK = 1, IJKSIZ
            SDATA( IJK ) = GDATA( IJK ) 
*                          equiv DDATA
 1120    CONTINUE
      ENDIF
*
      CALL GFWRIT
     I            ( HHEAD , DDATA , 
     I              JFILE , MODE  , NOEND )
*
      RETURN
      END
