XL Fortran for AIX 8.1

Language Reference


List-Directed Formatting

In list-directed formatting, editing is controlled by the types and lengths of the data being read or written. An asterisk format identifier specifies list-directed formatting. For example:

      REAL TOTAL1, TOTAL2
      PRINT *, TOTAL1, TOTAL2

List-directed formatting can only be used with sequential files.

The characters in a formatted record processed under list-directed formatting constitute a sequence of values separated by value separators:

List-Directed Input

Input list items in a list-directed READ statement are defined by corresponding values in records. The form of each input value must be acceptable for the type of the input list item. An input value has one of the following forms:

c is a literal constant of intrinsic type or a non-delimited character constant. r is an unsigned, nonzero, integer literal constant. A kind type parameter must not be specified for either r or c. The constant c is interpreted as though it had the same kind type parameter as the corresponding list item.

The r * c form is equivalent to r successive appearances of the constant. The r * form is equivalent to r successive appearances of the null value.

A null value is represented by one of the following:

+-------------------------------IBM Extension--------------------------------+

Use the -qintlog compiler option to specify integer or logical values for input items of either integer or logical type.

+----------------------------End of IBM Extension----------------------------+

A character value can be continued in as many records as required. If the next effective item is of type character and the following are true:

  1. The character constant does not contain the value separators blank, comma, or slash, and
  2. The character constant does not cross a record boundary, and
  3. The first nonblank character is not a quotation mark or apostrophe, and
  4. The leading characters are not numeric followed by an asterisk, and
  5. The character constant contains at least one character,

the delimiting apostrophes or quotation marks are not required. If the delimiters are omitted, the character constant is terminated by the first blank, comma, slash, or end-of-record, and apostrophes and double quotation marks within the datum are not to be doubled.

The end of a record:

Two or more consecutive blanks are treated as a single blank unless the blanks are within a character value.

A null value has no effect on the definition status of the corresponding input list item.

A slash indicates the end of the input list, and list-directed formatting is terminated. If additional items remain in the input list when a slash is encountered, it is as if null values had been specified for those items.

If an object of derived type occurs in an input list, it is treated as if all the structure components were listed in the same order as in the definition of the derived type. The ultimate components of the derived type must not be pointers or allocatables.

List-Directed Output

List-directed WRITE and PRINT statements produce values in the order they appear in an output list. Values are written in a form that is valid for the data type of each output list item.

Except for complex constants and character constants, the end of a record must not occur within a constant and blanks must not appear within a constant.

Integer values are written using I editing.

Real values are written using E or F editing. (See "E, D, and Q (Extended Precision) Editing" or "F (Real without Exponent) Editing" for more information.)

Complex constants are enclosed in parentheses with a comma separating the real and imaginary parts, each produced as defined above for real constants. The end of a record can occur between the comma and the imaginary part only if the entire constant is as long as (or longer than) an entire record. The only embedded blanks permitted within a complex constant are one blank between the comma and the end of a record, and one blank at the beginning of the next record.

Logical values are written as T for the value true and F for the value false.

Character constants produced for an internal file, or for a file opened without a DELIM= specifier or with a DELIM= specifier with a value of NONE:

Undelimited character data may not be read back correctly using list-directed input.

Character constants produced for a file opened with a DELIM= specifier with a value of QUOTE are delimited by double quotation marks, followed by a value separator, and have each internal quote represented on the external medium by two contiguous double quotation marks. Character constants produced for a file opened with a DELIM= specifier with a value of APOSTROPHE are delimited by apostrophes, followed by a value separator, and have each internal apostrophe represented on the external medium by two contiguous apostrophes.

Slashes (as value separators) and null values are not written.

Arrays are written in column-major order.

You can specify a structure in an output list. On list-directed output, a structure is treated as if all of its components were listed in the same order as they are defined in the derived-type definition. The ultimate components of the derived type must not be pointers or allocatables.

+-------------------------------IBM Extension--------------------------------+

The following table shows the width of the written field for any data type and length. The size of the record will be the sum of the field widths plus a byte to separate each noncharacter field.

Table 13. Width of Written Field

Data Type Length (bytes) Maximum Field Width (characters) Fraction (decimal digits) Precision/IEEE (decimal digits)
integer 1
2
4
8
4
6
11
20
n/a
n/a
n/a
n/a
n/a
n/a
n/a
n/a
real 4
8
16
17
26
43
10
18
35
7
15
31
complex 8
16
32
37
55
89
10
18
35
7
15
31
logical 1
2
4
8
1
1
1
1
n/a
n/a
n/a
n/a
n/a
n/a
n/a
n/a
character n n n/a n/a

+----------------------------End of IBM Extension----------------------------+

Except for continuation of delimited character constants, each output record begins with a blank character to provide carriage control when the record is printed.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]