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>Language</strong> <strong>Reference</strong><br />

and is read into a character variable whose length is four, the character would contain the hexadecimal data<br />

000081C1.<br />

11.8 Format-Directed Input/Output<br />

Format-directed input/output (I/O) is formatted input or output controlled by a format specification. The<br />

action taken during formatted input or output depends on the next edit descriptor in the format specification<br />

and the next item in the input/output list if one exists.<br />

A format specification is processed from left to right. An edit descriptor or a format specification with a<br />

repeat specification of r is processed as a list of r edit descriptors or format specifications. A repeat<br />

specification of one is equivalent to no repeat specification.<br />

For each repeatable edit descriptor in the format specification, there corresponds one item in the I/O list<br />

except an I/O list item of type complex where two repeatable floating-point edit descriptors are required.<br />

Non-repeatable edit descriptors do not correspond to any I/O list item; they communicate information<br />

directly with the record. Whenever a repeatable edit descriptor is encountered in a format specification,<br />

there must be a corresponding item in the I/O list. The edited information is transmitted appropriately<br />

between the item and the record.<br />

Format processing is terminated when any of the following conditions occur.<br />

1. When an edit descriptor has no corresponding item in the I/O list.<br />

2. When a colon edit descriptor is encountered and there are no more items in the I/O list.<br />

3. When the right parenthesis is encountered and there are no more items in the I/O list.<br />

If the right parenthesis of the complete format specification is encountered and the I/O list has not been<br />

exhausted, the file is positioned at the next record and format processing resumes at the start of the format<br />

specification terminated by the last preceding right parenthesis. If there is no such right parenthesis, format<br />

processing resumes at the start of the complete format specification. The part of the format specification<br />

that is reused must contain at least one repeatable edit descriptor. If format processing resumes at a left<br />

parenthesis preceded by a repeat specification, the repeat specification is also reused. The scale factor, sign<br />

control edit descriptors and blank control edit descriptors are not affected when part of a format<br />

specification is reused.<br />

11.9 List-Directed Formatting<br />

List-directed formatting is input/output without a format specification.<br />

Example:<br />

READ( un, * ) X, Y, Z<br />

READ( UNIT=un, FMT=* ) X, Y, Z<br />

READ *, X, Y, Z<br />

WRITE( un, * ) X, Y, Z<br />

WRITE( UNIT=un, FMT=* ) X, Y, Z<br />

PRINT *, X, Y, Z<br />

In the previous example, an asterisk instead of a format specification indicates list-directed formatting.<br />

238 List-Directed Formatting

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

Saved successfully!

Ooh no, something went wrong!