*"表題 ヘッダー記述子入力 GTOOL3(GHCSQ2)
*
*"履歴 91/01/25 沼口  敦
*"     99/12/02 竹広真一  メッセージ出力番号を DCL より取得
*
**********************************************************************
*"         << 記述子を書き出しコンソール入力 >>
**********************************************************************
      SUBROUTINE GHCSQ2
     I         ( HH1   , HH2   , HP    , IC    ,
     M           HHO                            )
*
      CHARACTER  HH1  ( * )*(*)
      CHARACTER  HH2  ( * )*(*)
      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  HH2S ( NDC,NCON )*(NCC)
      CHARACTER  HHOS ( NDC,NCON )*(NCC)
      CHARACTER  HHCS ( NDC,NCON )*(NCC)
      CHARACTER  HX1         *(NCC*2)
      CHARACTER  HX2         *(NCC*2)
      CHARACTER  HXO         *(NCC*2)
      CHARACTER  HX1S        *(NCC*2)
      CHARACTER  HX2S        *(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 ( HH2S( 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  )
      CALL GHCGTS( HH2 , HP , HX2  )
*
      ICCC = 0
      ICCE = 1
      DO 1100 ICC = 1, NCON
         CALL GHCGTS( HH1S( 1,ICC ), HP, HX1S )
         CALL GHCGTS( HH2S( 1,ICC ), HP, HX2S )
         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.( HX2S .EQ. HX2 )
     &                         .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, ':IN1 = ', HX1
         WRITE ( IUNIT, * ) HP, ':IN2 = ', HX2
         WRITE ( IUNIT, * ) ' OUT = ?'
         READ  ( 5, '(A)') HXO
*
         IF      ( HXO .EQ. '#1' ) THEN
            WRITE ( IUNIT,* ) ' default 1 assumed.'
            HXO = HX1
         ELSE IF ( HXO .EQ. '#2' ) THEN
            WRITE ( IUNIT,* ) ' default 2 assumed.'
            HXO = HX2
         ENDIF
*
         IF ( IC .NE. 0 ) THEN
            CALL GHCSTS( HH1S(1,ICCE), HP , HX1 )
            CALL GHCSTS( HH2S(1,ICCE), HP , HX2 )
            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
