STATUS

STATUS is a predefined variable that contains the execution status of the last instruction.

Syntax

STATUS

Usage

STATUS is a predefined variable that contains the execution status of the last program instruction.

STATUS allows to get diagnostic of procedural, interactive an SQL instructions.

The data type of STATUS is INTEGER.

STATUS is typically used with WHENEVER ERROR CONTINUE or WHENEVER ERROR CALL.

STATUS will be set for expression evaluation errors only when WHENEVER ANY ERROR is used.

After an SQL statement execution, STATUS contains the value of SQLCA.SQLCODE. Use SQLCA.SQLCODE for SQL error management, and use STATUS for other language instructions.

STATUS is updated after any instruction execution. A typical mistake is to test STATUS after a DISPLAY STATUS instruction, written after an SQL statement.

While STATUS can be modified by hand, it is not recommended, as STATUS may become read-only in a later release.

MAIN
  DEFINE n INTEGER
  WHENEVER ANY ERROR CONTINUE
  LET n = 10/0
  DISPLAY STATUS
END MAIN