In free-field format the data-items are given one after the other,
separated by blanks.
The mode of each data-item is recognized from the way it
has been written by the user;
thus 12 is an integer,
#012
is an octal integer (of value 10),
12.
is a floating-point number,
and :ABC
is Hollerith.
The rules for writing the data items try to strike a balance
between freedom and catching mistakes; they are the following:
Integer: a string of digits, maybe preceded by + or --
Examples: 123 +123 -123 1 0Floating: a number containing a decimal dot and/or an exponent
Examples: 12. +12.34 -.34 1. .1 -12.34 12E +12.34E -.34E 1E .1E -12.34E -12.34E5 12.E5 12E5 12E+5 12E-5 -12.34+5 12.+5 12+5 12+5 12-5Double precision: a number containing an exponent letter
D
Examples: 12D +12.34D -.34D 1D .1D -12.34D -12.34D5 12.D5 12D5 12D+5 12D-5Binary -- Octal -- Hexadecimal: a number preceded by
#B
, #b
, #O
, #o
, #0
, #X
or #x
,
which will be stored right-justified with zero-fill;
bits beyond the capacity of a computer word are truncated on the left.
Examples : #B10001 #b11101 #b1111111000111000011111111 #017777 #O17777 #o33211234567 (32 bits!) #X177AB #x17cde #xffffFFFF (32 bits!)BCD: must start with
'
or "
or :
thereby
selecting the delimiting character, followed by the Hollerith string,
terminated with the delimiter (which is ``blank
'' for ``:'').
Examples: :ABCD :PI+ :K* :K(1430) :RATHERLONGSTRING 'AB CD' :it's "'ab' 'cd'"Repeat count: indicates the number of times which the data item which follows immediately is to be stored. It is an unsigned integer larger than 1 followed by ``
*
''.
Examples: 100*0 4* -.0379 3*:PI- 2* :K(1430) 2*:LONGSTRINGComment: can be either trailing or interspersed. A comment starts with
#
. and stops with the next #
or the end-of-line.
Example: 12 #. any text, but not a number-sign # 13
Hollerith text is by default stored in A4 format,
thus the data-item ":ABCDEF"
gives on all machines 2 words
containing "ABCD"
and "EF "
with blank-fill.
If this is not what is needed it can be changed either with
the ``control item'' #A
or with the title header line option -A
,
which have the same syntax.
Variable length strings could be awkward to handle, therefore one can ask TZINIT to store the Hollerith string preceded by a word count as an extra integer word, optionally preceded in turn by a character count:
Header-line option: -A[n][C][W] Control item: #A[n][C][W] with n: if given it selects An representation, if absent or if n is larger than the maximum number of characters per word, the data are stored continuous without trailing blanks in each word. C: if given an extra word is stored specifying the number of characters in the string, not counting trailing blanks in any word. W: if given an extra word is stored specifying the number of words occupied by the BCD string, excluding itself and the character count, if present. Example: #A4CW :LONGSTRING would give 5 words: IQ(L) = 10 character count IQ(L+1) = 3 word count IQ(L+2) = 4HLONG IQ(L+3) = 4HSTRI IQ(L+4) = 4HNG
#Double instructs TZINIT to read and store all floating-point numbers that follow as double-precision numbers.
#Normal reverts to normal, cancelling the effect
of a previous #D
for the numbers that follow the #N
.
Control-items must be blank-terminated like data items and may be freely mixed with data items. They must not occur between a multiplier and its data item.
The option selected by a control item applies to all following data until changed again by a new control item.
As an example of usage, suppose we have this title bank:
*DO FZO 21 -i(3I *H 1I *H) #. mode nwrec opt name # #ACW 4 0 :TLO3 :/dev/mt12
giving the parameters for a file to be used by FZ of Zebra. (The I/O characteristic is only useful if one wanted Zebra to print this bank, which is unlikely in this case.)
The program could digest this as follows:
CHARACTER CHOPT*8, CHNAM*80 LUN = 21 CALL TZFIND (0, LT, 'FZO ', LUN, 0) IF (LT.EQ.0) GO TO no output MODE = IQ(LT+1) NWREC = IQ(LT+2) LOPT = LT+3 LNAM = LOPT + IQ(LOPT+1) + 2 NCHOPT = IQ(LOPT) NCHNAM = IQ(LNAM) CALL UHTOC (IQ(LOPT+2),99, CHOPT, NCHOPT) CALL UHTOC (IQ(LNAM+2),99, CHNAM, NCHNAM) CALL MZDROP (0,LT,'.') IF (MODE ... ... ELSEIF (MODE.EQ.4) THEN IF (NWREC.EQ.0) NWREC = 5760 CALL CFOPEN (IQUEST(1),1,NWREC,'w',0,CHNAME(1:NCHNAM),ISTAT) CALL FZFILE (LUN,NWREC,CHOPT(1:NCHOPT)) ELSEIF (MODE ... ... ENDIF