24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>FORTRAN</strong> Statements<br />

Example:<br />

CHARACTER*20 NAME<br />

CHARACTER*20 STREET<br />

CHARACTER*15 CITY<br />

CHARACTER*20 STATE<br />

CHARACTER*20 COUNTRY<br />

CHARACTER*10 ZIP_CODE<br />

INTEGER AGE<br />

INTEGER MARKS(10)<br />

NAMELIST /PERSON/ NAME, STREET, CITY, STATE,<br />

+ COUNTRY, ZIP_CODE, AGE, MARKS<br />

READ PERSON<br />

PRINT PERSON<br />

END<br />

The input data must be in a special format. The first character in each record must be blank. The second<br />

character in the first record of a group of data records must be an ampersand (&) or dollar sign ($)<br />

immediately followed by the NAMELIST name. The NAMELIST name must be followed by a blank and<br />

must not contain any imbedded blanks. This name is followed by data items separated by commas. The<br />

end of a data group is signaled by the character "&" or "$", optionally followed by the string "END". If the<br />

"&" character was used to start the group, then it must be used to end the group. If the "$" character was<br />

used to start the group, then it must be used to end the group.<br />

The form of the data items in an input record is:<br />

Name = Constant<br />

The name may be a variable name or an array element name. The constant may be integer,<br />

real, complex, logical or character. Logical constants may be in the form "T" or ".TRUE"<br />

and "F" or ".FALSE". Character constants must be contained within apostrophes.<br />

Subscripts must be of integer type.<br />

ArrayName = Set of Constants<br />

The set of constants consists of constants of the type integer, real, complex, logical or<br />

character. The constants are separated by commas. The number of constants must be less<br />

than or equal to the number of elements in the array. Successive occurrences of the same<br />

constant may be represented in the form r*constant, where r is a non-zero integer<br />

constant specifying the number of times the constant is to occur.<br />

The variable and array names specified in the input file must appear in the NAMELIST list, but the order is<br />

not important. A name that has been made equivalent to a name in the input data cannot be substituted for<br />

that name in the NAMELIST list. The list can contain names of items in COMMON but must not contain<br />

dummy argument names.<br />

Each data record must begin with a blank followed by a complete variable or array name or constant.<br />

Embedded blanks are not permitted in name or constants. Trailing blanks after integers and exponents are<br />

treated as zeros.<br />

NAMELIST Statement 109

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!