[r] IW[ .m]
[r]Fw.d
[r] EW. d[E e]
[r]Dw.d
[r]Dw.dEe
(eFT EXTENSION) [r] Gw. d[E e][r]Ow (eFT EXTENSION) [r] zw (eFT EXTENSION) [r]Lw
[r]A [w]
[r]Rw (CFT EXTENSION)
where I, F, E, 0, G, 0, Z, L, A, and R
indicate the manner of editing,
w,
r, and eare nonzero, unsigned integer constants, and d and m
are unsigned integer constants.
The
repeat speeifieation,
r, optionally precedes any repeatable edit descriptor.Examples:
E20.5E3 023 Z6
29G5.0
SR-0009
3E20.5E3 L7 AS 6023 2Z10
13 R6
7L7
FS.5 E19.12 DS.l G13.3 A 519 2F6.0 12E7.2 3010.0
3A5 4R4 3A
Part 2
6-3 J
I
I
The formats of nonrepeatable edit descriptors are
'hI h2 • • • hn '
'AN APOSTROPHE EDIT DESCRIPTOR'
"A QUOTATION-MARK EDIT DESCRIPTOR"
Tl12
Table 6-1 describes the correct usage of the CFT edit descriptors with data types. An
*
indicates legal usage for input and output. A + indicates legal usage for output. A - indicates illegal usage.Table 6-1. Edit descriptors with data types
Data types Edit descriptors
I F E D G L A 0 Z R for read and write operations, specify EQUIV=$RNOCHK($RCHK) or
EQUIV=$WNOCHK($WCHK), respectively. Both of these EQUIV statements must be specified if changes are desired. Table 6-2 describes the edit
•
INTERACTION BETWEEN I/O LISTS AND FORMAT SPECIFICATIONS
The beginning of execution of a formatted input/output statement initiates format control. Each action of format control depends on information from
• The next edit descriptor provided by the format specification, and
• The next item in the input/output list, if one exists.
If a statement has an input/output list, at least one repeatable edit descriptor must exist in the format specification.
An empty format specification of the form ( ) can be used unless contained within another format specification. An empty format
specification causes one input or internal record to be skipped or one output or internal record containing no characters to be written. No
input/output list items can correspond to an empty format specification.
Except for repeated edit descriptors and embedded format specifications, a format specification is interpreted from left to right.
An embedded format specification or edit descriptor preceded by an r is processed as a list of r format specifications or edit descriptors. An omitted repeat specification is treated the same as a repeat
specification with a value of 1.
Each repeatable edit descriptor interpreted in a format specification corresponds to one item specified by the input/output list, except that an item of type complex requires the interpretation of two F, E, D, G, A, or R edit descriptors. An input/output list contains no items
corresponding to nonrepeatable edit descriptors.
When format control encounters a repeatable edit descriptor, it
determines whether the input/output list has specified a corresponding item. If it has, format control transmits appropriately edited
information between the item and the record, then proceeds. If no corresponding item exists, format control terminates.
When a colon edit descriptor is encountered and no more input/output list items remain to be processed, format control is terminated. Otherwise, the colon edit descriptor is ignored.
Format control also terminates if it encounters the rightmost parenthesis of a complete format specification and if no additional input/output list items are specified. If another list item is specified, the file is positioned to the next record and format control reverts to the beginning of that format specification terminated by the next-to-last right
parenthesis. If there is none, format control reverts to the first left parenthesis of the complete format specification. If reversion occurs,
the reused portion of the format specification must contain at least one repeatable edit descriptor. If format control reverts to a parenthesis
SR-0009
Part 2
6-6 J-03
•
that is immediately preceded by a repeat specification, the repeat
specification is reused. Reversion of format control, of itself, has no effect on the scale factor (see P editing) or on S, SP, SS, BN, or BZ.
Examples:
In the following examples, the
+
indicates the reversion point if list items remain when format control encounters the closing parenthesis.1 FORMATJl OFlO.3,lPE20.6)
2 FORMAT (lOFlO.3, (1PE20.6»
t
3 FORMAT(I10,3(I5,2(I5,I7),3(L1,L2),I7»
+
4 FORMAT(I5,2(I4,I6),3(Il,I2»
t
SR-0009
Part 2
6-6.1 J-03
POSITIONING BY FORMAT CONTROL
If a T or X edit descriptor is the first edit descriptor encountered after format control is initiated, the action of the descriptor causes the next record to become the current record.
After the processing of each repeatable edit descriptor or an H, apostrophe, or quotation mark edit descriptor, the file is positioned after the last character read or written in the current record.
After a T, TL, TR, X, slash, or colon edit descriptor is processed, the file is positioned as separately described for each.
If format control reverts, the file is positioned in the same manner as when a slash edit descriptor is processed.
After a read operation, any unprocessed characters of the record read are skipped.
When format control terminates, the file is positioned after the current record.
INTERNAL REPRESENTATION
A field is a part of a record that is read or ~]ritten when format control processes a single repeatable edit descriptor or an H, apostrophe, or quotation mark edit descriptor.
Field width
is the size of the fieldin characters.
Internal representation of data corresponds to the internal representation of a constant of similar type.
APOSTROPHE AND QUOTATION MARK EDITING
An apostrophe or quotation mark edit descriptor has the form of a
character constant and causes characters to be written from the delimited characters (including blanks) of the edit descriptor itself. These edit descriptors apply only to output. The width of the field is the number of characters contained between (but not including) the delimiting quotation marks or apostrophes. Within the field, two adjacent
apostrophes or quotation marks are counted as one and not as members of a delimiting apostrophe or quotation mark character pair, respectively.
I
The ANSI FORTRAN Standard does not provide for quotation mark editing.SR-0009
Part 2
6-7 J
•
Example:
Execution of -WRITE (6,13)
13 FORMAT(' ISN'IT "*" BETTER'," THAN ""H""", lIS') results in the printing of
-ISN'T "*" BETTER THAN "H" IS
H EDITING
The nH edit descriptor causes character information to be written from the n characters (including blanks) following the H of the edit
descriptor. An H edit descriptor can be used only for output.
Examples:
PRINT 22
22 FORMAT (27H ABCDEFGHIJKLMNOPQRSTUVWXYZ,lOH1234567890) WRITE (41, 16)
16 FORMAT (I LABEL', 5H UNIT, I 41')
POSITIONAL EDITING (T, TL, TR, AND X)
The T, TL, TR, and X descriptors specify the position where the next character will be transmitted to or from the record.
An X edit descriptor specifies a position relative to the current position.
T edit descriptors can specify a character position in either direction from the current position. This allows portions of a record to be read more than once, possibly with different editing.
T or X edit descriptors can replace a character that is already in the record. During transmission to the record, undefined positions are
filled with blanks. The result is as if the entire record were initially filled with blank characters. On output, an X descriptor that specifies a move to position a causes the length of the record to be at least a-I characters. T edit descriptors by themselves do not affect the
SR-0009
Part 2
6-8 J