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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Language</strong> <strong>Reference</strong><br />

Example:<br />

INTEGER AGE<br />

WRITE(6,FMT=10)<br />

10 FORMAT( ’Enter age: ’,\/ )<br />

READ(5,20) AGE<br />

20 FORMAT( I2 )<br />

PRINT *,’Your age is ’,AGE<br />

END<br />

11.7.10 Numeric Editing: I, F, E, D and G Edit Descriptors<br />

Numeric edit descriptors are used to specify I/O of integer, real, double precision, complex and double<br />

precision complex data. The following rules apply to all numeric edit descriptors.<br />

1. On input, leading blanks are not significant. The interpretation of blanks other than leading<br />

blanks is determined by any BN or BZ edit descriptors in effect and the BLANK= specifier (see<br />

the OPEN statement). A field of all blanks is always zero. Plus signs are optional.<br />

2. On input, with F, E, D and G editing, the decimal location specified in the edit descriptor is<br />

overridden by a decimal point appearing in the input field.<br />

3. On output, the plus sign is optional and is determined by the S, SP and SS edit descriptors. A<br />

negative quantity is represented by a negative sign. A minus sign is never produced when<br />

outputting a value of zero.<br />

4. On output, the representation is always right justified in the field with leading blanks inserted at<br />

the beginning of the field if the number of characters in the representation is less than the field<br />

width.<br />

5. On output, if the number of characters in the external representation is greater than the field<br />

width or an exponent exceeds its specified length using Ew.dEe, Gw.dEe, Ew.dDe or<br />

Gw.dDe edit descriptors, the entire field is filled with asterisks.<br />

11.7.10.1 Integer Editing: Iw and Iw.m Edit Descriptors<br />

The Iw and Iw.m edit descriptors indicate that the field width of the field to be edited is w. The item in<br />

the I/O list must be of type integer; on input the I/O list item will be defined by integer data, on output the<br />

I/O list item must be defined with an integer datum.<br />

On input, the Iw.m edit descriptor is treated identically to the Iw edit descriptor. The output field for the<br />

Iw edit descriptor consists of zero or more leading blanks followed by a minus sign if the value of the I/O<br />

list item is negative or an optional plus sign otherwise, followed by the magnitude of the integer datum with<br />

no leading zeroes. Note that the integer constant contains at least one digit. On output, the Iw.m edit<br />

descriptor specifies that at least m digits are to be displayed with leading zeroes if necessary. The value of<br />

m must be less than or equal to the value of w. If m is zero and the value of the datum is zero, then the<br />

output field is filled with blanks.<br />

Example:<br />

PRINT ’(1H)’,23,2345<br />

The output produced by the PRINT statement in the previous example is the string:<br />

<br />

232 Editing

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

Saved successfully!

Ooh no, something went wrong!