The following syntax rules apply for input data to be read by NAMELIST:
The variables of the named group can be in any order, and any can be omitted.
The data must start in or after column two. Column one is totally ignored.
There must be at least one comma, space, or tab between variables, and one or more spaces or tabs are the same as a single space. Consecutive commas are not permitted before a variable name. Spaces before or after a comma have no effect.
No spaces or tabs are allowed inside a group name or a variable name, except around the commas of a subscript, around the colon of a substring, and after the ( and before the ) marks. No name can be split over two records.
The end of a record acts like a space character.
Note an exception--in a character constant, it is ignored, and the character constant is continued with the next record. The last character of the current record is immediately followed by the second character of the next record. The first character of each record is ignored.
The equal sign of the assignment statement can have zero or more blanks or tabs on each side of it.
Only constant values can be used for subscripts, range indicators of substrings, and the values assigned to variables or arrays. You cannot use a symbolic constant (parameter) in the actual input data.
Hollerith, octal, and hexadecimal constants are not permitted.
Each constant assigned has the same form as the corresponding FORTRAN constant.
There must be at least one comma, space, or tab between constants. Zero or more spaces or tabs are the same as a single space. You can enter: 1,2,3, or 1 2 3, or 1, 2, 3, and so forth.
Inside a character constant, consecutive spaces or tabs are preserved, not compressed.
A character constant is delimited by apostrophes (') or quotes ("), but if you start with one of those, you must finish that character constant with the same one. If you use the apostrophe as the delimiter, then to get an apostrophe in a string, use two consecutive apostrophes.
¤sample='use "$" in 2' (Read as: use $ in 2) ¤sample='don''t' (Read as: don't) ¤sample="don''t" (Read as: don''t) ¤sample="don't" (Read as: don't)
A complex constant is a pair of real or integer constants separated by a comma and enclosed in parentheses. Spaces can occur only around the punctuation.
A logical constant is any form of true or false value, such as .TRUE. or .FALSE., or any value beginning with .T, .F, and so on.
A null data item is denoted by two consecutive commas, and it means the corresponding array element or complex variable value is not to be changed. Null data item can be used with array elements or complex variables only. One null data item represents an entire complex constant; you cannot use it for either part of a complex constant.
Example: NAMELIST input with some null data:
* nam2.f Namelist input with consecutive commas REAL ARRAY(4,4) NAMELIST /GRID/ ARRAY WRITE ( *, * ) 'Input?' READ ( *, GRID ) WRITE ( *, GRID ) END
¤$GRID ARRAY = 9,9,9,9,,,,,8,8,8,8 $
This code loads 9s into row 1, skips 4 elements, and loads 8s into row 3 of ARRAY.