Intel fortran-80 manual 6.3.2WRITE Statement, Input List, Implied-DOList, WRITE ctl-list out-list

Models: fortran-80

1 130
Download 130 pages 742 b
Page 73
Image 73
6.3.1.2 Input List

FORTRAN-SO

Input/Output

6.3.1.2 Input List

The list 'in-list' in the READ statement identifies the items whose values are to be read. An item in an input list must be a variable name, array name, or array element name. If an array name is listed, the entire array is read in normal array element ordering sequence. The name of an assumed-size dummy array must not appear in the input list.

6.3.1.3 Implied-DO List

An implied-DO list embedded in the READ statement allows a range of subscripts to be used for input list array elements. For example, half the items in an array can be read without specifying each individual array element to be read. The format of the implied-DO list is

(in-list, var = el, e2, e3)

where 'var, el, e2, and e3' have the same interpretation as for the DO statement (section 4.2.2) and 'in-list' is a list of input items as described above. The list 'in-list' may also contain additional implied-DO lists.

For READ statements, the DO variable 'var' must not appear as an item in 'in-list.'

Example:

CREAD ONLY THE ODD ELEMENTS IN ARRAY 'TABLE' DIMENSION TABLE(60)

READ (2, 20) (TABLE(N), N = 1,59,2)

20FORMAT ...

6.3.2WRITE Statement

The WRITE statement outputs data to a specified unit. The format of the WRITE statement is

WRITE (ctl-list) [out-list]

where

ctl-listis a list of control information specifiers

out-listis a list of the data to be written

The control information list is the same as for the READ statement (section 6.3.1.1 and following subsections) except that no END specifer is allowed. The output list 'out-list' is defined in the same manner as the 'in-list' portion of the READ state- ment, including the implied-DO option (sections 6.3.1.2 and 6.3.1.3).

Like input list items, an output list item may be a variable name, array name, or ar- ray element name. An output list item may also be an expression, including an ex- pression involving operators or enclosed in parentheses.

Examples:

WRITE (6,120) PNAME, AVG

120 FORMAT ...

WRITE (6,120,IOSTAT= ERRFLG, ERR=2000) &PNAME + I, AVG + I

120 FORMAT ...

DIMENSION PNAME(25), AVG(25)

C WRITE DOUBLE COLUMN PRINTOUT OF FIRST ITEMS OF C EACH ARRAY

WRITE (6,120)(PNAME(K), AVG(K), K=1, 10)

120 FORMAT (1X, A, 5X, F4.3)

6-13

Page 73
Image 73
Intel fortran-80 manual 6.3.2WRITE Statement, Input List, Implied-DOList, WRITE ctl-list out-list