FORTRAN, Statements, FORMAT
*Conan The Librarian
Defines the conversion of data in formatted data transfer operations. Statement format: FORMAT (q1 f1s1 f2s2 ... fnsn qn) qn Is zero or more slash (/) record terminators. fn Is a data edit (field) descriptor, a control edit descriptor, a string edit descriptor, or a group of such descriptors enclosed in parentheses. sn Is a field separator (a comma or slash). A comma can be omitted in the following cases: o Between a P edit descriptor and an immediately following F, E, D, or G edit descriptor. o Before or after a slash (/) record terminator. o Before or after a colon (:) edit descriptor. The "data edit descriptor" has one of the following forms: [r]c [r]cw [r]cw.m [r]cw.d[Ee] r Is the optional repeat count. (If you omit r, the repeat count is assumed to be 1.) c Is a format code (I,O,Z,F,E,EN,ES,D,G,L, or A). w Is the external field width in characters. Each data item in the external medium is called an external field. m Is the minimum number of characters that must appear in the field (including leading zeros). d Is the number of characters to the right of the decimal point. E Is an exponent field. e Is the number of characters in the exponent. The ranges for "r", "w", "m", "d", and "e" are as follows: Term Range ---- __________ r 1 to 2147483647 (2**31-1) w 1 to 2147483647 m 0 to 32767 (2**15-1) d 0 to 32767 e 1 to 32767 The terms must all be unsigned integer constants or variable format expressions. A variable format expression is an integer variable or expression enclosed in angle brackets that takes the place of an integer constant. The value of the variable or variables can change during program execution. You cannot use PARAMETER constants for "r", "w", "m", "d", or "e". The "control edit descriptor" has one of the following forms: c [n]c c[n] c Is a format code (X,T,TL,TR,SP,SS,S,BN,BZ,P, Q, $, or :). n Is the optional number of characters or character positions. The term "n" must be an unsigned integer constant (for format code P, it can be signed or unsigned) or a variable format expression. A variable format expression is an integer variable or expression enclosed in angle brackets that takes the place of an integer constant. The value of the variable or variables can change during program execution. The value of "n" for P must be within the range -128 to 127. For all other format codes, the value of "n" must be within the range 1 through 2147483647 (2**31-1); actual useful ranges may be constrained by record sizes (RECL) and the file system. The "string edit descriptor" has one of the following forms: "string" 'string' nHc1...cn string Is a character literal constant. n Is the number of characters to be transferred. c1...cn Is a string of printable ASCII characters. Although no string edit descriptor can be preceded by a repeat specification, a parenthesized group of string edit descriptors can be preceded by a repeat specification. For more information, see FORMAT_SPECIFIERS in this Help file.