FOR1407S
The OPEN statement could not connect unit unit-number to file-name. The ACCESS specifier had a value of KEYED, and the ACTION specifier had a value of READ, but the file was empty. Fortran Version 2 Error Number: AFB138I

System action

If the unit is other than the error message unit, the unit is no longer connected to a file. If neither the ERR nor the IOSTAT specifier is present on the I/O statement, the condition is signaled. If the condition is unhandled, the application is terminated.

Qualifying Data: Only the basic set of four qualifying data for I/O conditions as shown in Table 1. Within this basic set, statement has a value of READ, and parm_count has a value of 4.

Permissible Resume Actions:

Name Action Taken after Resumption
RN The OPEN statement is not completed, and execution continues.

Programmer response

Ensure that the VSAM key-sequenced data set (KSDS) that you want to process is referenced by the file definition (DD statement or ALLOCATE command).

If you want to read from a file that has records, then:
  • If the file referenced by the file definition is a base cluster, that is, the file with the primary key, then ensure that is was successfully loaded with records, either in a Fortran program or by a program written in some other language.
  • If the file referenced by the file definition is a path for an alternate index, then ensure that the Access Method Services BLDINDEX command successfully built the alternate index after the base cluster was loaded.

If you want to start with an empty file and add records to it in other than ascending sequence of the primary key, then change the value of the ACCESS specifier to READWRITE. In this case the OPEN statement processing simulates the loading of the file and deletes all loaded records; then VSAM no longer considers the file to be empty.

If you want to load records into an empty file in the fastest way, follow these steps:

  1. On the file definition (DD statement or ALLOCATE command), provide the data set name of the file's base cluster, that is, of the file with the primary key.
  2. Execute an OPEN statement with a value of WRITE for the ACTION specifier and a value of KEYED for the ACCESS specifier; either omit the KEYS specifier or provide a KEYS specifier with a single start-end pair that represents the position in the record of the file's primary key.
  3. Execute at least one WRITE statement to write the records; ensure that you write the records in ascending sequence of the primary key.
  4. Execute a CLOSE statement.

After these steps, the file is available to be connected using an ACTION specifier of either READ or READWRITE.

If you omit the DELIM specifier, then for list-directed formatting the character values are written without delimiters, and for namelist formatting the character values are surrounded by apostrophes.

Symbolic Feedback Code

FOR1431