Errors detected by the handler

When the handler detects an error, it must convey the error condition to the RPG program.

The handler may either send an exception message to its caller or it may set the rpgStatus subfield in the handler parameter to a valid RPG I/O status code.

The status code 1299 indicates a general I/O error, and can be used for any operation.

If the handler sends an exception message or if the handler fails with an unhandled exception, RPG will usually set the status code to 1299. For OPEN and CLOSE operations, RPG will set the status code to 1216 (error in explicit OPEN or CLOSE operation) or 1217 (error in implicit OPEN or CLOSE operation).

Tip: Sending an exception message is the recommended way to signal the error condition to the RPG program. The message will appear in the job log so the information in the message will be available after the program has completed. The handler can provide as much detail in the message as is needed to determine the reason for any unexpected errors.