Exception handling and status (system words)

As shown in the next table, exception handling and status words are used to control how programs respond to exceptions and error conditions (such as arithmetic overflow), and to determine what codes are returned when exceptions occur.

System word/Usage Description
sysLib.displayMsgNum
sysLib.displayMsgNum
(msgNumber)
Retrieves a value from the program's message table
sysLib.setError
sysLib.setError
(elementInError, msgKey, msgInsertList)
sysLib.setError
(msgText)
Associates a message with an item in a page handler or with the page handler itself
sysLib.validationFailed
sysLib.validationFailed
(msgNumber)
Involved in message presentation on a text or print form
sysVar.errorCode
sysVar.errorCode

Receives a status code after any of the following events:

  • The invocation of a call statement, if that statement is in a try block

  • An I/O operation on an indexed, MQ, relative, or serial file

  • The invocation of almost any system function in these cases--

    • The invocation is within a try block; or

    • The program is running in VisualAge Generator Compatibility mode and sysVar.handleSysLibErrors is set to 1

(For an overview that includes details on sysVar.errorCode, see Exception handling.)

sysVar.handleHardIOErrors
sysVar.handleHardIOErrors
Controls whether a program continues to run after a hard I/O error occurs on an I/O operation
sysVar.handleOverflow
sysVar.handleOverflow
Controls error processing after an arithmetic overflow
sysVar.handleSysLibErrors
sysVar.handleSysLibErrors
Specifies whether the value of the system variable sysVar.errorCode is affected by the invocation of a system function
sysVar.mqConditionCode
sysVar.mqConditionCode
Contains the completion code from an MQSeries API call following an add or scan I/O operation for an MQ record
sysVar.overflowIndicator
sysVar.overflowIndicator
Is set to 1 when arithmetic overflow occurs
sysVar.returnCode
sysVar.returnCode
Contains the external return code to be checked when the program ends; the check is by the command processor or by the calling high-level language program
sysVar.sqlca
sysVar.sqlca
Contains the SQL communication area (SQLCA) returned for the last SQL I/O operation
sysVar.sqlcode
sysVar.sqlcode
Contains the return code for the most recently completed SQL I/O operation
sysVar.sqlerrd
sysVar.sqlerrd[index]
Is a static 6-element array, where each element contains the corresponding SQL communication area (SQLCA) value that was returned from the last SQL I/O option
sysVar.sqlerrmc
sysVar.sqlerrmc
Contains the substitution variables for the error message associated with the return code in sysVar.sqlcode
sysVar.sqlState
sysVar.sqlState
Contains the SQL state value for the most recently completed SQL I/O operation
sysVar.sqlwarn
sysVar.sqlwarn[index]
Is a static 11-element array, where each element contains a warning byte returned in the SQL communications area (SQLCA) for the last SQL I/O operation and where the index is one greater that the warning number in the SQL SQLCA description; sqlwarn[1], for example, refers to SQLWARN0
sysVar.validationMsgNum
sysVar.validationMsgNum
Contains the value assigned by sysLib.validationFailed

Related reference
EGL statements
Exception handling
Function invocations
System words
System words in alphabetical order