C-----------------------------------------------------------------------
C  HP WORKSTATION
C  MACHINE DEPENDENT ROUTINES
C-----------------------------------------------------------------------
      SUBROUTINE GISYS(CNSYS,CDATE,CTIME)
C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GISYS          GET SYSTEM INFORMATION FOR GRBINDEX
C   PRGMMR: IREDELL          ORG: NP23        DATE: 95-10-31
C
C ABSTRACT: THIS SUBPROGRAM RETURNS SYSTEM INFORMATION, SPECIFICALLY
C   THE CURRENT SYSTEM NAME AND DATE AND TIME.
C
C PROGRAM HISTORY LOG:
C   95-10-31  IREDELL
C
C USAGE:    CALL GISYS(CNSYS,CDATE,CTIME)
C   OUTPUT ARGUMENTS:
C     CNSYS        CHARACTER*15 CURRENT SYSTEM NAME
C     CDATE        CHARACTER*10 CURRENT DATE IN YYYY-MM-DD FORM
C     CTIME        CHARACTER*10 CURRENT TIME IN HH:MM:SS FORM
C
C SUBPROGRAMS CALLED:
C   IDATE        GET CURRENT DATE
C   ITIME        GET CURRENT TIME
C
C REMARKS: THIS IS A MACHINE-DEPENDENT SUBPROGRAM.
C
C ATTRIBUTES:
C   LANGUAGE: CRAY FORTRAN
C
C$$$
      CHARACTER CNSYS*15,CDATE*10,CTIME*8
      INTEGER*4 NOW(14)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      CNSYS='workstation'
      CALL DATIMX(NOW)
      WRITE(CDATE,'(I4.4,"-",I2.2,"-",I2.2)') NOW(8),NOW(6),NOW(7)
      WRITE(CTIME,'(I2.2,":",I2.2,":",I2.2)') NOW(5),NOW(4),NOW(3)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      RETURN
      END
C-----------------------------------------------------------------------
      SUBROUTINE GIOPEN(LUGB,CGB,LUGI,CGI)
C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GIOPEN         OPEN FILES FOR GRBINDEX
C   PRGMMR: IREDELL          ORG: NP23        DATE: 95-10-31
C
C ABSTRACT: THIS SUBPROGRAM OPENS THE GRIB FILE AND THE INDEX FILE.
C
C PROGRAM HISTORY LOG:
C   95-10-31  IREDELL
C   98-09-01  EBISUZAKI (ALPHA PORT)
C
C USAGE:    CALL GIOPEN(LUGB,CGB,LUGI,CGI)
C   INPUT ARGUMENTS:
C     LUGB         INTEGER UNIT OF THE GRIB FILE
C     CGB          CHARACTER*(*) ACTUAL NAME OF THE GRIB FILE
C     LUGI         INTEGER UNIT OF THE INDEX FILE
C     CGI          CHARACTER*(*) ACTUAL NAME OF THE INDEX FILE
C
C SUBPROGRAMS CALLED:
C   ERRMSG       WRITE A MESSAGE TO STDERR
C   EXIT         EXIT WITH RETURN CODE
C
C REMARKS: THIS IS A MACHINE-DEPENDENT SUBPROGRAM.
C
C ATTRIBUTES:
C   LANGUAGE: CRAY FORTRAN
C
C$$$
      CHARACTER CGB*(*),CGI*(*)
      CHARACTER TMPS*80
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C  OPEN THE GRIB FILE FOR READING
      CALL BAOPENR(LUGB,CGB,IOS)
      IF(IOS.NE.0) THEN
        TMPS=CGB
        CALL ERRMSG('grbindex:  Error accessing file '
     1		//TMPS(1:len(CGB)))
        CALL EXIT(8)
      ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C  OPEN THE INDEX FILE FOR WRITING

C     Make a zero length file
      OPEN(UNIT=LUGI,FILE=CGI,FORM='UNFORMATTED',STATUS='UNKNOWN')
      ENDFILE(LUGI)
      CLOSE(LUGI)

      CALL BAOPEN(LUGI,CGI,IOS)
      IF(IOS.NE.0) THEN
        TMPS=CGI
        CALL ERRMSG('grbindex:  Error accessing file '
     1		//TMPS(1:len(CGI)))
        CALL EXIT(8)
      ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      RETURN
      END
C-----------------------------------------------------------------------
      SUBROUTINE GICLOSE(LUGB,LUGI)
C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GICLOSE        CLOSE FILES FOR GRBINDEX
C   PRGMMR: IREDELL          ORG: NP23        DATE: 95-10-31
C
C ABSTRACT: THIS SUBPROGRAM CLOSES THE GRIB FILE AND THE INDEX FILE.
C
C PROGRAM HISTORY LOG:
C   95-10-31  IREDELL
C
C USAGE:    CALL GICLOSE(LUGB,LUGI)
C   INPUT ARGUMENTS:
C     LUGB         INTEGER UNIT OF THE GRIB FILE
C     LUGI         INTEGER UNIT OF THE INDEX FILE
C
C REMARKS: THIS IS A MACHINE-DEPENDENT SUBPROGRAM.
C
C ATTRIBUTES:
C   LANGUAGE: CRAY FORTRAN
C
C$$$
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      CLOSE(LUGB)
      CLOSE(LUGI)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      RETURN
      END
