In this mode all the records assembled by FZOUT to represent one particular data-structure are placed one after the other contiguously into an area of memory belonging to the user (rather than being written to a file). One is then free to move the data around, normally from a machine which has no I/O facilities to a machine which has, as in emulator farms. They may there be written to tape. Eventually the data will be brought back to be read with FZIN, either directly from a file, or again from user memory. To 'read' a d/s from user memory, FZIN expects all the records representing the d/s to be present in the memory area.
FZ handles the medium 'memory' only with the file format 'exchange', ie. with logical 'records' blocked onto fixed-length physical 'records'. The data format can be 'exchange' or 'native'.
The details of this format are found in chapter .
To use this mode the following is necessary:
option in FZFILE,
set this stream for input or output (it cannot be used for both concurrently),
The connection call is
indicating to FZ the where-abouts and the size of one's memory region for stream LUN. NWBUF gives the size in terms of machine words, it must be large enough to hold the largest d/s to be handled; see the memory-size considerations further down.
In the case of output one calls FZOUT (also FZRUN), on return one will find the physical records representing the d/s in one's memory. FZOUT starts this string of records with a 'steering block', ie. a physical record with 8 control words (see chapter for details), placed at the start of the user's memory; the remaining data are placed as 'fast blocks', if any. The last block is normally used only partially, the unused part is marked out with a padding record, ie. a logical record of type 5, of which only the record length and the type code are significant, the data contents are irrelevant.
FZOUT returns in IQUEST(9)
the number of useful machine words
stored into the memory.
It includes the (normally) 2 control words of the padding record,
but not its data words.
If one needs it,
one can compute the number of physical records
as 1 + (IQUEST(9)-1)/LENREC
where LENREC
is the physical record size in machine words.
On machines with a word-size greater than 32 bits this needs
a little care,
as explained in the note about LREC
in section
for FZFILE,
and also below.
To obtain a start-of-run record one can call FZRUN
to get it into the memory, the useful size is again found
in IQUEST(9)
.
To get an end-of-run record one has to call FZRUN explicitly;
one may call FZENDO to have the file statistic printed,
but this will not put anything into the user's memory.
To read back a d/s originally produced by FZOUT
and then shipped around,
one has to store it in the user memory,
connected with FZMEMO,
and call FZIN.
This will transfer the data to the dynamic store,
converted if the Exchange Data Format is in use,
and relocate the links.
The user's memory is left intact.
IQUEST(1)
returns the read status and must be checked after
every call to FZIN.
Using the information of chapter , one obtains the lay-out of the d/s in the memory produced by FZOUT as shown on the next page. NWPHR is the physical record length as defined by the call to FZFILE, it is 900 by default.
If one is using the native data format
(or if one is running on a machine where the native format
is identical to the exchange format, ie. on IEEE machines
such as Apollo, Alliant, Motorola)
this lay-out applies literally,
the numbers are usable directly,
and FZOUT will return IQUEST(9)=NWUSE
.
However, if one is using the exchange data format
the data are converted to their exchange representation,
and they are also 'packed'.
For example, on the Cray two words are packed into one
machine word,
and FZOUT will return IQUEST(9)=(NWUSE+1)/2
.
On a VAX 'packing' means byte inversion,
so also in this case the data are not usable directly.
Use of the U
option:
the situation can arise that one needs the exchange format,
because communication is between different machines,
but that one also needs access to the control information
at the beginning of the data.
One could gain this access by local unpacking, but this is messy.
It is more elegant to take charge of the packing oneself,
and instruct FZOUT to deliver the data non-packed
(by selecting the U option in FZFILE).
In this case the lay-out shown on the next page
applies again literally, or almost:
the data are delivered as one word per each machine word
(and on the VAX the bytes are not yet inverted),
but they are converted to the exchange representation,
32 bits right justified with zero-fill.
This conversion affects negative integers, floating point numbers,
Hollerith, but not positive integers and bit patterns.
Since the control information has been deliberately chosen
to be of this invariant kind, it remains usable.
FZOUT returns again IQUEST(9)=NWUSE
.
When shipping the data one has to execute the 'packing' operation
applicable on the given machine such that they arrive in
the correct form at the destination.
From these considerations one easily derives the size requirement on the memory to be connected with FZMEMO. On the Cray for example, to handle data-strutures of not more than 80000 words (including the control and context information) one needs a memory region of 40000 words if one operates in normal exchange mode, but 80000 words for native mode or if the U option is selected.
word 1-4 steering block stamp = hex 0123CDEF 80708070 4321ABCD 80618061 5 bits 1->24: NWPHR, the physical record length 30: set if start-of-run in this block 31: set if end-of-run 32: set if emergency stop block 6 zero (physical record counter) 7 NWTOLR = 8 8 NFAST, the number of fast blocks to follow 9 NWLR, logical record length 10 LRTYP = 2 or 3, the record type 11 floating point 12345.0 as check word 12 Zebra version number, integer = 10000. * QVERSIO 13 zero 14 zero 15 NWTX=0, number of words in the text-vector 16 NWSEG, number of words in the segment table 17 NWTAB, number of words in the relocation table 18 NWBK, number of words of bank material 19 LENTRY, entry address into the d/s 20 NWUHIO = NWUH + NWIO, number of words in the user header vector plus its I/O characteristic, zero if no header NWIO words of the I/O characteristic for the u. h. vector NWUH words of the user header vector NWSEG words of the segment table NWTX words of the text-vector NWTAB words of the relocation table NWBK words of bank material word NT is the last word of the d/s NT+1 NWPAD, record length of the padding record NT+2 5, record type NWPAD-1 untouched padding wordsThe following numbers are calculated:
log. record length NWLR = 10+NWIO+NWUH+NWSEG+NWTX+NWTAB+NWBK incl. log. c/words NWDS = 2 + NWLR incl. phys. c/words NT = 8 + NWDS # of fast blocks NFAST = (NT-1) / NWPHR total # of words NALL = NWPHR * (NFAST+1) padding length NWPAD = NALL - NT - 1 (can be 0 or -1) # of useful words NWUSE = NT + 1 + MIN(NWPAD,1)