next up previous contents index
Next: Formats for the Up: Using the TZ Previous: TZSHUN - insert

TZINQ - inquire about the title d/s

The title data structure is supported by a system link not directly accessible to the user. To get access to this structure as such, not to a particular bank, one can use this routine.

CALL TZINQ (IXSTOR, IXTITL*, !L*, IFLAG)

IXSTOR
index of the store holding the title structure (or index of any division in this store);
IXTITL*
returns the index of the division holding the title structure
!L*
returns the address of the first or the last bank
= zero if there are no titles
IFLAG
1: get the adr of the first bank
0: get the adr of the last bank
other values are reserved for future extensions

Example

Suppose for a particular program one has a considerable volume of titles, such that one spends too much time in TZINIT for every individual execution of this program. One could have a separate job to translate most of the text titles into a binary FZ file whenever they have been updated. The job which needs these titles reads them from the FZ file and appends them to any titles which it has already read with TZINIT.

Job to translate text titles to binary

      PROGRAM TTXTFZ

      CHARACTER    NAME*(*)
      PARAMETER   (NAME = 'cba1990')

      CHARACTER    FIN*(*), FOUT*(*)
      PARAMETER   (FIN = NAME // '.ttx',  FOUT = NAME // '.tfz')

      PARAMETER   (LIM2Q=60000, NNQ=80000)
      DIMENSION    LQ(NNQ), IQ(NNQ), Q(NNQ)
      EQUIVALENCE (Q(1),IQ(1),LQ(9))
      COMMON //    FENCE(4), LQ, LASTQ

      PRINT 9001, FIN, FOUT
 9001 FORMAT (/' TTX to TFZ executing'
     F/' with  input file = ',A /'      output file = ',A)

      CALL MZEBRA (-1)
      CALL MZVERS
      CALL MZSTOR (IXST,'/DYN/','.',FENCE,LQ,LQ,LQ,LQ(LIM2Q),LASTQ)

      OPEN (11, FILE=FIN, FORM='FORMATTED', STATUS='OLD')
      CALL TZINIT (11, 1)          { read into forward division 1
      CLOSE (11)

      OPEN (11, FILE=FOUT, FORM='UNFORMATTED', STATUS='UNKNOWN')
      CALL FZFILE (11, 0, 'O')

      CALL TZINQ  (0, IXTITL, LGO, 1)
      CALL FZOUT  (11, 1, LGO, 0, 'LDI', 0,0,0)
      CALL FZENDO (0, 'T')
      CALL MZEND
      END

Piece of code loading the binary titles

      CHARACTER    FIN*(*)
      PARAMETER   (FIN  = 'cba1990.tfz')

C--       first read the variable titles from the 'card reader'

      IXTITL = set the title division
      CALL TZINIT (0,IXTITL)

C--       then append the binary titles

      OPEN (49, FILE=FIN, FORM='UNFORMATTED',STATUS='OLD')
      CALL FZFILE (49, 0, '.')

      CALL TZINQ  (IXSTOR, IXTT, LTT, 0)
      IF (LTT.EQ.0)  THEN
          L     = 0
          JBIAS = 1
        ELSE
          L     = LTT
          JBIAS = 0
        ENDIF

      CALL FZIN   (49, IXTITL,L,JBIAS, '.', 0,0)
      IF (IQUEST(1).NE.0)          GO TO trouble
      IF (LTT.EQ.0)  CALL TZSHUN (IXTITL,L,0)
      CALL FZENDI (49, 'TXQ')


Janne Saarela
Mon May 15 08:34:47 METDST 1995