*"表題 ヘッダー記述子入力 GTOOL3(GHCSQ1)
*
*"履歴 91/01/25 沼口  敦
*"     99/12/02 竹広真一  メッセージ出力番号を DCL より取得
*
**********************************************************************
*"         << 記述子を書き出しコンソール入力 >>
**********************************************************************
      SUBROUTINE GHCSQ1
     I         ( HH1   , HP    , IC    ,
     M           HHO                    )
*
      CHARACTER  HH1  ( * )*(*)
      CHARACTER  HHO  ( * )*(*)
      CHARACTER  HP        *(*)
      INTEGER    IC                      !" 記憶番号
*
#ifdef SYS_IBMS
      INCLUDE    (GZSIZE)                !" NCC, NDC
#else
#include         "gzsize.F"              !" NCC, NDC
#endif
      PARAMETER  (NCON=10)               !" 記憶の数
      CHARACTER  HH1S ( NDC,NCON )*(NCC)
      CHARACTER  HHOS ( NDC,NCON )*(NCC)
      CHARACTER  HHCS ( NDC,NCON )*(NCC)
      CHARACTER  HX1         *(NCC*2)
      CHARACTER  HXO         *(NCC*2)
      CHARACTER  HX1S        *(NCC*2)
      CHARACTER  HC          *(NCC*2)
*
      INTEGER    IUNIT
      LOGICAL    OFIRST
      DATA       OFIRST /.TRUE./
      SAVE
*
      IF ( OFIRST ) THEN
         OFIRST = .FALSE.
         DO 100 ICC = 1, NCON
            CALL GHPCLR ( HH1S( 1,ICC ) )
            CALL GHPCLR ( HHOS( 1,ICC ) )
            CALL GHPCLR ( HHCS( 1,ICC ) )
            DO 110 IP = 2, NDC
               HHCS( IP,ICC ) = ' '
  110       CONTINUE
  100    CONTINUE
         CALL GLIGET( 'MSGUNIT', IUNIT )
      ENDIF
*
      CALL GHCGTS( HH1 , HP , HX1  )
*
      ICCC = 0
      ICCE = 1
      DO 1100 ICC = 1, NCON
         CALL GHCGTS( HH1S( 1,ICC ), HP, HX1S )
         CALL GHCGTS( HHCS( 1,ICC ), HP, HC   )
         IF ( HC .NE. ' ' ) THEN
            READ ( HC, '(I5)' ) ICS
         ELSE
            ICS = 0
         ENDIF
         IF ( ICS .NE. 0 ) THEN
            ICCE = ICC+1
         ENDIF
         IF (      ( HX1S .EQ. HX1 )
     &        .AND.( ICS  .EQ. IC ) ) THEN
            ICCC = ICC
         ENDIF
 1100 CONTINUE
*
      IF ( ICCC .NE. 0 ) THEN
         CALL GHCGTS( HHOS(1,ICCC), HP , HXO  )
*
      ELSE
*
         WRITE ( IUNIT, * ) HP, ':IN = ', HX1
         WRITE ( IUNIT, * ) ' OUT = ?'
         READ  ( 5, '(A)') HXO
*
         IF      ( HXO .EQ. '#' ) THEN
            WRITE ( IUNIT,* ) 'default assumed.'
            HXO = HX1
         ENDIF
*
         IF ( IC .NE. 0 ) THEN
            CALL GHCSTS( HH1S(1,ICCE), HP , HX1 )
            CALL GHCSTS( HHOS(1,ICCE), HP , HXO )
            WRITE ( HC, '(I5)' ) IC
            CALL GHCSTS( HHCS(1,ICCE), HP , HC  )
         ENDIF
      ENDIF
*
      CALL GHCSTS ( HHO , HP, HXO )
*
      RETURN
      END
