Note that the parentheses are part of the format, and both parentheses and string quotes are required.

As will be indicated below, a format string may appear explicitly in an INPUT or OUTPUT statement. If the same format string is used more than once, however, it may be convenient to give it a name through a format declaration. A format declaration has the form

The Oak Ridge ALGOL Compiler for the Control Data Corporation 1604 — Part 7

format Identifier := '(Fortran format)' .

The Oak Ridge ALGOL Compiler for the Control Data Corporation 1604 — Part 7

A format declaration obeys the same rules of syntax and scope as do other declarations.

The Oak Ridge ALGOL Compiler for the Control Data Corporation 1604 — Part 7

Format identifiers may be used as parameters, and format is a specifier.

The INPUT procedure is used to input numbers and Hollerith information in accordance with Fortran-type formats. An INPUT statement has one of the forms

(1) M is the logical unit designation. M may be any arithmetic expression. If it is not integral-valued, the action

will take place. The standard input unit is 50.

(2) F is a format expression. It may be an actual format string, a format identifier, a conditional format expression, or any variable which contains the starting address of a format string. Caution. In the case of a conditional format expression, format strings and format identifiers should not be mixed. For example, (a) and (b) below are permitted, but (c) will cause an incorrect program to be compiled:

(a) if B then '(E20.7)' else '(E20.6)' (b) if B then F1 else F2 (c) if B then F1 else '(E20.6)' .

(3) list is as defined previously. Of course, for INPUT all expressions must be variables.

The following are examples of an INPUT statement:

INPUT (50, '(4E20.8)', N, for I := 1 step 1 until N do A[I]).

INPUT (if A < B then M else N, F, X, Y, Z) .

Each INPUT statement causes at least one card image to be read.

Note that the INPUT procedure does not make type checks between the data and the program variables. A floating point number, for example, is stored as such regardless of the type of the variable to which it is assigned.

Caution. It is strongly recommended that not both READ and INPUT be used in the same program. Each buffers ahead one card image. Furthermore, each INPUT statement causes at least one card image to be read while a READ statement may not cause a new card image to be read. Mixing the two statements will require quite careful use of blank cards in the data to allow for the buffering.