Access to data using the FORTRAN callable interface

The following example shows how a dataset may be accessed through the FORTRAN interface.

                          Access to data
                                  

      CHARACTER*80 GENAME
      COMMON /QUEST/IQUEST(100)
*
*     FATMEN keys. These will be returned by the call to FMOPEN
*
      PARAMETER (LKEYFA=10)
      DIMENSION KEY(LKEYFA)
*
*     Units for reading the FATMEN catalogue and for
*     sending updates to the server
*
      LUNRZ = 1
      LUNFZ = 2
*
*     Initialise FATMEN novice interface
*
      CALL FMSTRT(LUNRZ,LUNFZ,'//CERN/OPAL',IRC)
*
      GENAME = '//CERN/OPAL/DDST/PASS3/FYZ1/P18R1929/C01'
      LG = LENOCC(GENAME)
*
*     Access and open the file. R indicates Read mode
*     and F instructs FMFILE to issue the appropriate
*     call to FZFILE for this dataset.
*
      LBANK = 0
      CALL FMFILE(11,GENAME(1:LG),'RF',IRC)
      IF(IRC.NE.0) THEN
         PRINT *,'Return code ',IRC,' from FMFILE'
         GOTO 10
      ELSE
*
*     Now process the file, reading just the FZ headers
*
         CALL READRZ(11)
      ENDIF
*
*     Now close this file, issuing FZENDI (option E),
*     drop staging disk (option D)
*
      CALL FMFEND(11,GENAME(1:LG),'ED',IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMFEND'
1     CONTINUE
10    CONTINUE
*
      END
      SUBROUTINE READFZ(LUN)
      COMMON/QUEST/IQUEST(100)
      CHARACTER*8  DELTIM
      DIMENSION    IUHEAD(400)
      DIMENSION    IOCR(100)
      PARAMETER (JBIAS=2)
      NREC = 0
      CALL FMRTIM(DELTIM)
      CALL TIMED(T)
   1  CONTINUE
      NHEAD = 400
      IXDIV = 0
      CALL FZIN(LUN,IXDIV,LSUP,JBIAS,'S',NHEAD,IUHEAD)
      IF(IQUEST(1).LT.4) THEN
         NREC = NREC + 1
         GOTO 1
      ENDIF
      PRINT *,'READFZ. end after ',NREC,' records, IQUEST(1) = ',
     +        IQUEST(1)
      CALL FMRTIM(DELTIM)
      CALL TIMED(T)
      PRINT *,'FMFZLP. Elapsed time = ',DELTIM,
     +        ' CP time = ',T,' sec.'
      END