Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

ENDFILE condition

Status
The ENDFILE condition is always enabled.
Result
If the specified file is not closed after the condition is raised, subsequent GET or READ statements to the file are unsuccessful and cause additional ENDFILE conditions to be raised.

But the file must not be closed in its ENDFILE ON-unit: it should be closed only after that ON-unit has been exited.

Cause and syntax
The ENDFILE input/output condition can be raised during an operation by an attempt to read past the end of the file specified in the GET or READ statement. It applies only to SEQUENTIAL INPUT, SEQUENTIAL UPDATE, and STREAM INPUT files.

In record-oriented data transmission, ENDFILE is raised whenever an end of file is encountered during the execution of a READ statement.

In stream-oriented data transmission, ENDFILE is raised during the execution of a GET statement if an end of file is encountered either before any items in the GET statement data list have been transmitted or between transmission of two of the data items. If an end of file is encountered while a data item is being processed, or if it is encountered while an X-format item is being processed, the ERROR condition is raised.

Read syntax diagramSkip visual syntax diagram>>-ENDFILE--(file-reference)-----------------------------------><
 

The file-reference must be a scalar reference.

Implicit action
A message is printed and the ERROR condition is raised.
Normal return
Execution continues with the statement immediately following the GET or READ statement that raised the ENDFILE.

If a file is closed in an ON-unit for this condition, the results of normal return are undefined. Exit from the ON-unit with the closed file must be achieved with a GO TO statement.

Condition code
70

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)