To see the implications of this format, let us sketch what
an output routine would have to do which has NWD
words
in a vector MDATA
in a common /DATA/
already in exchange data format,
say they are all integers,
to be written out as a Zebra file in exchange file format.
It has to preceed this vector by four kinds of control information, going backward in this order:
Most of this information can be set up once by initialization,
and only a few holes must be filled in for each data-structure.
In particular, the user header vector which identifies the
structure must be filled,
in the example we chose a header of 4 words.
Remember that all numbers must be in exchange representation;
but most numbers are positive integers, and hence are no problem.
Numbers where one has to be careful are flagged by !!
,
numbers which must be re-filled are marked by *
.
COMMON /DATA/MPR(8),MLR(2),MPILI(15),MBK(10),MDATA(100000) DIMENSION MREC(100035) EQUIVALENCE (MREC(1),MPR(1)) PARAMETER (NWPHR=900)
Physical record control words
MPR(1) = hex 0123CDEF (markers) MPR(2) = 80708070 MPR(3) = 4321ABCD MPR(4) = 80618061 MPR(5) = NWPHR (block size) * MPR(6) = 0 (block number) MPR(7) = 8 (8 words before start of LR) * MPR(8) no init (no. of fast blocks to follow)
Logical record control words
* MLR(1) no init (record size) MLR(2) = 3 (record type, d/s)
Pilot information
!! MPILI(1) = 12345.0 (check word, floating point) IEEE: hex 4640E400 MPILI(2) = 0 (Zebra version, user origin) MPILI(3) = 0 (processing option) MPILI(4) = 0 (reserve) MPILI(5) = 0 (no text vector) MPILI(6) = 0 (no segment table) MPILI(7) = 0 (no relocation table, linkless d/s) * MPILI(8) no init (total bank space) MPILI(9) = 0 (no entry link) MPILI(10)= 5 (length of the user header, =NWIO+NWUH) MPILI(11)= 2 (I/O characteristic: all integer) * MPILI(12->15) (user header vector)
Bank system words
MBK(1) bits 17-32: 2 (I/O char., all integer, say, cf book MZ, para 1.15) 1-16: 12 (= NIO + NL + 12) MBK(2) = 0 (next pointer) MBK(3) = 0 ( up pointer) MBK(4) = 0 (orig pointer) MBK(5) = 0 (Numeric bank ID) !! MBK(6) = 4HDATA (Hollerith bank ID) MBK(7) = 0 (number of links) MBK(8) = 0 (number of structural links) * MBK(9) no init (number of data words) MBK(10)= 0 (status word)
Suppose now NWD
words are received into the vector MDATA
,
just behind MBK(10)
, in exchange data format, and the lot is to be
written out. We first have to fill the variable part in the control
information for this data structure:
MBK(9) = NWD (size of the data part of the bank) MPILI(8) = NWD+10 (amount of bank space required) MLR(1) = NWD+25 (logical record size) MPILI(12)= run number (user header vector) MPILI(13)= event number MPILI(14)= date MPILI(15)= time NWT = NWD + 35 (total number of words to be written) NREC = (NWT-1)/NWPHR + 1 (number of physical records) MPR(8) = NREC -1 (number of fast blocks) NWPAD = NWPHR*NREC - NWT (no. of unused words in last block) MDATA(NWD+1) = NWPAD-1 (logical record length) MDATA(NWD+2) = 5 (padding record)
and now we can dump the lot with
JD = 0 DO 19 JREC=1,NREC write physical record, words (MREC(J+JD),J=1,NWPHR) 19 JD = JD + NWPHR MPR(6) = MPR(6) + 1 (bump the block number)