File Management - IBM

File Management - IBM File Management - IBM

as400bks.rochester.ibm.com
from as400bks.rochester.ibm.com More from this publisher
30.06.2013 Views

The open feedback area also contains information about each device or communications session that is defined for the file. v 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” on page 179 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” on page 185, “I/O feedback area for printer files” on page 188, and “I/O feedback area for database files” on page 189 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 could 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 could determine that the next operation should be to wait until the next block of data is sent indicating the error. Possibly, the next operation may 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. File error detection and handling by the system 24 File Management V4R5 The system can detect errors when a file is opened, when a program device is acquired or released, during I/O operations to a file, and when the file is closed. When appropriate, the system will automatically try to run a failing operation again, up to a retry limit. When a retry is successful, neither operator nor program action is required. How the system reports errors: The system reports errors that can affect the processing of the program in any or all of the following ways: v A notify, status, diagnostic, or escape message may be sent to the program message queue of the program using the file. These messages may also appear in the job log, depending on the message logging level that is set for the job. See “Messages and message monitors in files by the system” on page 25 for more information. v The high-level language may return a file status code. v A major and minor return code is returned in the I/O feedback area for intersystem communications function (ICF), display, and printer files. See “Major and minor return codes in files by the system” on page 26 for more information.

v A notify, status, diagnostic, or escape message may be sent to the operator message queue (QSYSOPR) or the history message queue (QHST). v Information regarding the error may be saved in the system error log for use by the problem analysis and resolution programs. v An alert message may be sent to an operator at another system in the network. v The normal program flow may be interrupted and control may be transferred to an error-handling subroutine, or other language operations may occur. For additional information about how to handle run-time errors, see the appropriate book for the high-level language. Only some of these are significant to a program that is attempting error recovery. Actions to take when you receive an error: See “Recovering from file system errors” on page 28 for information on the actions you should take when you receive an error. Nonrecoverable errors: Not all file errors allow programmed error recovery. Some errors are permanent; that is, the file, device, or program cannot work until you take some corrective action. This might involve resetting the device by varying it off and on again, or correcting an error in the device configuration or the application program. Some messages and return codes inform the user or the application program of conditions that are information rather than errors, such as change in the status of a communications line, or system action taken for an unexpected condition. In many cases, it is possible for the application program to test for an error condition and take some preplanned recovery action which allows the program to continue without intervention from the operator. For more information: The CL Programming, SC41-5721-03 book discusses how to use the debug functions to resolve unexpected errors that you encounter in the application programs. The chapter on handling problems in the Basic System Operation, Administration, and Problem Handling, SC41-5206-04 book describes the programs that are available for analyzing and reporting system errors and hardware failures. Messages and message monitors in files by the system Displayed messages are the primary source of information for an operator or a programmer who is testing a new application. A message usually contains more specific information than the file status code, the indicators, and the major and minor return code. The control language lets you monitor messages so that the CL program can intercept a message and take corrective action. See the CL Programming, SC41-5721-03 book for more information about message types and message monitors. In most high-level languages, the file status code and return codes (which are described in the following section) are more convenient sources of information. Message numbers are assigned in categories to make it easier for a program to monitor for a group of related messages. Table 6 on page 26 shows the message number ranges that are assigned for file error messages. Chapter 2. File processing 25

v A notify, status, diagnostic, or escape message may be sent to the operator<br />

message queue (QSYSOPR) or the history message queue (QHST).<br />

v Information regarding the error may be saved in the system error log for use by<br />

the problem analysis and resolution programs.<br />

v An alert message may be sent to an operator at another system in the network.<br />

v The normal program flow may be interrupted and control may be transferred to<br />

an error-handling subroutine, or other language operations may occur. For<br />

additional information about how to handle run-time errors, see the appropriate<br />

book for the high-level language.<br />

Only some of these are significant to a program that is attempting error recovery.<br />

Actions to take when you receive an error:<br />

See “Recovering from file system errors” on page 28 for information on the actions<br />

you should take when you receive an error.<br />

Nonrecoverable errors:<br />

Not all file errors allow programmed error recovery. Some errors are permanent;<br />

that is, the file, device, or program cannot work until you take some corrective<br />

action. This might involve resetting the device by varying it off and on again, or<br />

correcting an error in the device configuration or the application program. Some<br />

messages and return codes inform the user or the application program of<br />

conditions that are information rather than errors, such as change in the status of a<br />

communications line, or system action taken for an unexpected condition. In many<br />

cases, it is possible for the application program to test for an error condition and<br />

take some preplanned recovery action which allows the program to continue<br />

without intervention from the operator.<br />

For more information:<br />

The CL Programming, SC41-5721-03 book discusses how to use the debug functions<br />

to resolve unexpected errors that you encounter in the application programs.<br />

The chapter on handling problems in the Basic System Operation, Administration, and<br />

Problem Handling, SC41-5206-04 book describes the programs that are available for<br />

analyzing and reporting system errors and hardware failures.<br />

Messages and message monitors in files by the system<br />

Displayed messages are the primary source of information for an operator or a<br />

programmer who is testing a new application. A message usually contains more<br />

specific information than the file status code, the indicators, and the major and<br />

minor return code. The control language lets you monitor messages so that the CL<br />

program can intercept a message and take corrective action. See the CL<br />

Programming, SC41-5721-03 book for more information about message types and<br />

message monitors. In most high-level languages, the file status code and return<br />

codes (which are described in the following section) are more convenient sources<br />

of information.<br />

Message numbers are assigned in categories to make it easier for a program to<br />

monitor for a group of related messages. Table 6 on page 26 shows the message<br />

number ranges that are assigned for file error messages.<br />

Chapter 2. <strong>File</strong> processing 25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!