Monitoring file status with the open and I/O feedback area
The system monitors the status of a file in feedback areas once it has successfully opened the file.
As the system performs operations on a file, it updates the feedback areas to reflect the latest status. These feedback areas give you greater control over applications and provide important information when errors occur. The feedback areas are established at open time, and there is one feedback area for each open file. One exception is for shared files, which share feedback areas as well as the data path between the program and the file. For more information about shared opens, see Shared files.
Some high-level languages on the system enable you to access the status and other information about the file against which operations are being performed. There are two feedback areas of interest to you:
- Open feedback area
This area contains information of a general nature about the file after the system has successfully opened the file. Examples include the name and library of the file and the file type. See Open feedback area for a complete list of the information that you can retrieve from the open feedback area. In addition to general information about the file, the open feedback area also contains file-specific information after the system has successfully opened the file. The applicable fields depend on the file type.
The open feedback area also contains information about each device or communications session that is defined for the file.
- Input/output feedback area There are two sections of the I/O feedback area that are updated on the successful completion of input and output operations:
- Common area
This area contains information about I/O operations that were performed on the file. This includes the number of operations and the last operation performed. See I/O feedback area for a complete list of the information that you can retrieve from the common I/O feedback area.
- File-dependent feedback area
This area contains file-specific information for display, database, printer, and ICF files; for example, the major and minor return code and amount of data received from the device. See I/O feedback area for ICF and display files, I/O feedback area for printer files, and I/O feedback area for database files for a complete list of the information that you can retrieve from the file-dependent I/O feedback area.
The above information areas can be useful to you. For example, when an error occurs with a device file, the program can determine predefined error handling operations based on the major/minor return code in the file-dependent feedback area. If data is being received from a communications device and the application on the other end sends an error, the program can determine that the next operation should be to wait until the next block of data is sent indicating the error. Possibly, the next operation might be to close the file and end the conversation with the application on the other side or wait for the next request from the application.
Another way might include detecting the type of file that actually opened to determine the type of operations that are allowed. If the file type is printer, only output operations are allowed.
Parent topic:
Opened files
Related concepts
Shared files
Related reference
Open feedback area
I/O feedback area
I/O feedback area for ICF and display files
I/O feedback area for printer files