UNDEFINEDFILE condition

An input/output condition indicating that an unsuccessful attempt to open a file has been made.

Enabled/Disabled status

Always enabled.

Result

Specified files are undefined to the application program.

Raised

When an attempt to open a file is unsuccessful.

Notes

The following can cause a file open attempt to fail:
  • Conflicting attributes (such as DIRECT with PRINT).
  • Block size smaller than record size (except when records are spanned)
  • LINESIZE exceeding the maximum allowed
  • KEYLENGTH zero or not specified for creation of INDEXED data sets
  • Specifying a KEYLOC option, for an INDEXED data set, with a value resulting in KEYLENGTH + KEYLOC exceeding the record length
  • Specifying a V-format logical record length of less than 18 bytes for STREAM data sets
  • Specifying a block size that is not an integral multiple of the record size for FB-format records
  • Specifying a logical record length that is not at least 4 bytes smaller than the specified block size for VB-format records.

If the attempt is made by means of an OPEN statement that specifies more than one file, UNDEFINEDFILE is raised after attempts to open all specified files.

If UNDEFINEDFILE is raised for more than one file in the same OPEN statement, ON-units are executed according to the order of appearance of the file names in that OPEN statement (generally from left to right).

If raised by an implicit file opening in a data transmission statement, processing continues with the remainder of the data transmission statement upon normal return from the ON-unit. If the file was not opened in the ON-unit, the statement cannot continue and the ERROR condition is raised.

Syntax

UNDEFINEDFILE file-reference

Parameter

file-reference
A scalar file reference.

Other Information

Abbreviation
UNDF
Condition codes
80-89, 91-95
Implicit action
Prints a message and raises the ERROR condition.
Normal return
Upon the normal completion of the final ON-unit, control is transferred to the statement immediately following the OPEN statement that raised the condition.