*"$BI=Bj(B $B%l%$%"%&%H(B GTOOL3(GGLAY3)
*
*"$BMzNr(B 90/08/21 $B>B8}(B  $BFX(B
*"$BMzNr(B 95/05/29 $BC]9-??0l(B for dcl-5.0
*"     97/12/01 $BC]9-??0l(B SET -> STX
*
*********************************************************************
*"         << $B%l%$%"%&%H(B, $BBjL>I=<((B >>
*********************************************************************
      SUBROUTINE GGLAY3
     I         ( HHEAD )
*
      CHARACTER  HHEAD ( * )*(*)         !" $B%X%C%@!<(B
*
#ifdef SYS_IBMS
      INCLUDE    (GZSIZE)                !" NCC, NDC, NED
#else
#include         "gzsize.F"              !" NCC, NDC, NED
#endif
      CHARACTER  HTITL   *(NCC*2)
      CHARACTER  HDSET   *(NCC)
      CHARACTER  HUNIT   *(NCC)
      CHARACTER  HITEM   *(NCC)
      CHARACTER  HUTIM   *4
      CHARACTER  HTIME   *(NCC)
      CHARACTER  HDATE   *(NCC)
      CHARACTER  HDATEX  *(NCC)
      CHARACTER  HDATIM  *(NCC*3)
      INTEGER    NHE  ( NED )
      CHARACTER  HFNUM   *(NCC)
      CHARACTER  HDNUM   *(NCC)
      CHARACTER  HAITM   *(NCC)
      CHARACTER  HS      *(NCC)
      CHARACTER  HE      *(NCC)
      CHARACTER  HRAN    *(NCC)
      CHARACTER  HEDS    *(100)
      CHARACTER  HP      *8
      DATA       NDESC  / 24 /
      DATA       VRATIO / 0.70 /
      DATA       VXMINI  / 0.10 /
      DATA       VXMAXI  / 0.949 /
      DATA       VYMINI  / 0.10 /
      DATA       VYMAXI  / 0.524 /
      DATA       STITL  / 0.015 / 
      DATA       SAXSL  / 0.01 / 
      DATA       SAXST  / 0.01 / 
      DATA       SREMK  / 0.01 / 
      DATA       SCONL  / 0.01 / 
      LOGICAL    LUNIT  / .TRUE. /             !" $B%f%K%C%H%Y%/%H%k(B
      DATA       VXULOC  /0.06/                !"  $B!7(B $B0LCV!'#x(B
      DATA       VYULOC  /0.02/                !"  $B!7(B $B0LCV!'#y(B
      LOGICAL    LTONS  /.TRUE. /              !" $B%H!<%s%9%1!<%k(B
      DATA       TXSLOC  /0.05/                !"  $B!7(B $B0LCV!'#x(B
      DATA       TYSLOC  /0.02/                !"  $B!7(B $B0LCV!'#y(B
      DATA       TXSWDH  /0.25/                !"  $B!7(B $BI}(B  $B!'#x(B
      DATA       TYSWDH  /0.02/                !"  $B!7(B $BI}(B  $B!'#y(B
      INTEGER    TLNUM   /4/                   !"  $B!7(B $B%i%Y%k$N?t(B
      LOGICAL    LLINT   /.TRUE./              !" $B@~<o%3%a%s%H(B
      REAL       LTVX1   /0.22/                !"  $B!7(B $B0LCV!'#x(B(1)
      REAL       LTVX2   /0.55/                !"  $B!7(B $B0LCV!'#x(B(2)
      REAL       LTWDH   /0.08/                !"  $B!7(B $BI}(B
      LOGICAL    OLCNTL
*
*"         < 1. $B=i4|2=(B >
*
      CALL GRFRM
      CALL GGAXRS
      CALL GGLTRS
*
      CALL GGPSET ( 'VRATIO' , VRATIO )
      CALL GGPSET ( 'VXMIN'  , VXMINI )
      CALL GGPSET ( 'VXMAX'  , VXMAXI )
      CALL GGPSET ( 'VYMIN'  , VYMINI )
      CALL GGPSET ( 'VYMAX'  , VYMAXI )
      CALL GGPSET ( 'STITL'  , STITL  )
      CALL GGPSET ( 'SAXSL'  , SAXSL  )
      CALL GGPSET ( 'SAXST'  , SAXST  )
      CALL GGPSET ( 'SREMK'  , SREMK  )
      CALL GGPSET ( 'SCONL'  , SCONL  )
      CALL GGPSET ( 'LUNIT'  , LUNIT  )
      CALL GGPSET ( 'VXULOC' , VXULOC )
      CALL GGPSET ( 'VYULOC' , VYULOC )
      CALL GGPSET ( 'LTONS'  , LTONS  )
      CALL GGPSET ( 'TXSLOC' , TXSLOC )
      CALL GGPSET ( 'TYSLOC' , TYSLOC )
      CALL GGPSET ( 'TXSWDH' , TXSWDH )
      CALL GGPSET ( 'TYSWDH' , TYSWDH )
      CALL GGPSET ( 'TLNUM'  , TLNUM  )
      CALL GGPSET ( 'LLINT'  , LLINT  )    
      CALL GGPSET ( 'LTVX1'  , LTVX1  )
      CALL GGPSET ( 'LTVX2'  , LTVX2  )
      CALL GGPSET ( 'LTWDH'  , LTWDH  )
*
      CALL UZPGET( 'RSIZET2', RSIZT2 )
      CALL UZPGET( 'ROFFXT' , ROFFXT )
      IF ( ROFFXT .LT. RSIZT2 ) CALL UZPSTX( 'ROFFXT', RSIZT2 )
*
*"         < 2. $B%S%e!<%]!<%H(B($B2>:BI8(B)$B@_Dj(B >
*
      CALL SGSVPT ( VXMINI, VXMAXI , VYMINI , VYMAXI )
      CALL SGSWND ( 0.   , 1.    , 0.    , 1.  )
      CALL SGSTRN (1)
      CALL SGSTRF
*
      CALL SGPSTX ( 'IFONT', 2 )
*
      CALL GHCGTS ( HHEAD, 'TITL',  HTITL  )
      CALL GHCGET ( HHEAD, 'DSET',  HDSET  )
      CALL GHCGET ( HHEAD, 'UNIT',  HUNIT  )
*
      CALL GUQTIM ( HHEAD , RT    , HUTIM  )
      IF ( RT .GT. 9999900.0 ) THEN
         CALL CHVAL  ( 'D'      , RT    , HTIME  )
      ELSE
         CALL CHVAL  ( '(F10.1)', RT    , HTIME  )
      ENDIF
      NHT = LENC( HTIME )
*
      CALL GGPGET ( 'STITL'  , STITL )
      CALL UZPSTX ( 'RSIZEC2', STITL )
*
      CALL UZPGET ( 'ROFFXT', ROFF   )
      CALL UXMTTL ( 'T', HUNIT , -1. )
*
      HDATIM = HTIME(1:NHT)//HUTIM
      CALL GHCGET ( HHEAD, 'DATE',  HDATE  )
      IF ( HDATE .NE. ' ' ) THEN
         HDATEX        = ' ' 
         HDATEX(1:2)   = HDATE(3:4)
         HDATEX(3:3)   = '/'
         HDATEX(4:5)   = HDATE(5:6)
         HDATEX(6:6)   = '/'
         HDATEX(7:8)   = HDATE(7:8)
         HDATEX(9:9)   = '-'
         HDATEX(10:11) = HDATE(10:11)
         HDATEX(12:12)   = ':'
         HDATEX(13:14) = HDATE(12:13)
         NHT    = LENC( HDATIM )         
         HDATIM = HDATIM(1:NHT)//'   '//HDATEX
      ENDIF
      CALL UZPSTX ( 'ROFFXT', ROFF   )
      CALL UXMTTL ( 'T', HDATIM,  1. )
*
      CALL UZPGET ( 'ROFFXT', ROFF   )
      CALL UXMTTL ( 'T', HTITL , -1. )
      CALL UZPSTX ( 'ROFFXT', ROFF   )
      CALL SGPGET ( 'LCNTL', OLCNTL  )
      CALL SGPSTX ( 'LCNTL', .FALSE. )
      CALL UXMTTL ( 'T', HDSET ,  1. )
      CALL SGPSTX ( 'LCNTL', OLCNTL  )
*
      CALL UZPSTX ( 'ROFFXT' , 0. )
*
      RETURN
      END
