* PACKAGE IRCON  
*
*"  [SRC] $CCSR/model/agcm/src/io/ircon.F
*"  [DOC] $CCSR/model/agcm/doc/io.tex
*"  [VER] 92/06/20(numaguti)
*"  [HIS] 91/05/27(numaguti) Original
*
*"  [REM] * This routine is yet under development.
*"        Now you cannot use ITNEXT feature,
*"        i.e. to get the time of next avilable data.
************************************************************************
      SUBROUTINE RDCON         
     O         ( GDATA , ITNEXT,
     I           HFILE , HITEM , DEFVAL , HCORD , ITSEL  )
*
*   [PARAM] 




* PACKAGE  ZXT10L32 !" 格子点数，波数 X-Z
*
      INTEGER     IMAX           !" 経度格子数
      INTEGER     JMAX           !" 緯度格子数
      INTEGER     IDIM           !" 経度配列サイズ
      INTEGER     JDIM           !" 緯度配列サイズ
      INTEGER     MMAX           !" 最大東西波数
      INTEGER     LMAX           !" 最大南北波数
      INTEGER     NMAX           !" 最大全波数
      INTEGER     MINT           !" 東西波数間隔
      INTEGER     KMAX           !" 鉛直層数
      INTEGER     KDIM           !" 鉛直配列サイズ
      INTEGER     NMDIM          !" 水平波数成分数
      INTEGER     JMXHF          !" JMAX/2+1
      INTEGER     NWORK          !" ワーク領域大きさ
*
      PARAMETER ( IMAX  = 32,     JMAX =  1,
     &            IDIM  = IMAX+1, JDIM = JMAX,
     &            MMAX  = 10,     LMAX =  0,    NMAX = MMAX, MINT = 1,
     &            KMAX  = 32,     KDIM = KMAX,
     &            NMDIM = (MMAX/MINT+1)*(2*(NMAX+1)-MMAX)
     &                  - (NMAX-LMAX)/MINT*(NMAX-LMAX+1),
     &            JMXHF = JMAX/2+1,
     &            NWORK = IDIM*JDIM*KMAX*12                       )

*
*   [OUTPUT] 
      ReaL*8       GDATA ( * )                 
      INTEGER    ITNEXT                      
*
*   [INPUT] 
      CHARACTER  HFILE *(*)                  
      CHARACTER  HITEM *(*)                  
      ReaL*8       DEFVAL                      
      CHARACTER  HCORD  *(*)                 
      INTEGER    ITSEL                       
*
*   [INTERNAL PARM] 
      INTEGER    IWRFL, IOMODE, ILARGE
      DATA       IOMODE / 1  /
      DATA       IWRFL  / 30 /
      DATA       ILARGE / 2147483647 /       
*
*   [INTERNAL WORK] 
      INTEGER    IDATE ( 6 )
      INTEGER    IFILE, IERR, IEOD
      INTEGER    IT, ISTEP, ITDUR, KLEVS
*
*
*"         < 1.  ファイルオープン >
*
      CALL IFLOPN
     O         ( IFILE , IERR  ,
     I           HFILE , IWRFL , 'READ',  'UNFORMATTED' )
*
      IF ( IERR  .EQ. 0 ) THEN
*
         CALL GDREAD
     O         ( GDATA , IEOD  ,
     O           IT    , IDATE , ISTEP , ITDUR ,
     I           IFILE , HITEM , IOMODE, HCORD  )
*
      ELSE
         IEOD = 1
      ENDIF
*
      IF ( IEOD .GE. 1 ) THEN
*
*"         < 2. データがないとき : デフォルト値 >
*
         WRITE (6,*)   ' *** FILE of ', HITEM, ' NOT FOUND :',  HFILE
         WRITE ( 6,* ) ' *** DEFAULT ASSUMED '
*
         CALL HQCORL
     I              ( HCORD ,
     O                KLEVS   )
         CALL  SETV ( GDATA, DEFVAL, IDIM*JDIM*KLEVS )
*
      ELSE
         WRITE (6,*)   ' *** FILE of ', HITEM, ' READ IN   :',  HFILE
         CLOSE ( IFILE )
      ENDIF
*
      ITNEXT = ILARGE
*
      RETURN
      END
