JSON PARSE conditions and associated codes and runtime messages

Two kinds of conditions might occur during the execution of a JSON PARSE statement, and might result in the receiver being partially modified:
  • Nonexception conditions result in a reason code set in the special register JSON-STATUS, but do not terminate execution of the statement.
  • Exception conditions result in the exception code set in the special register JSON-CODE, and cause execution of the statement to be terminated.
The JSON-STATUS reason code values in the following table are additive. For example, execution of the JSON PARSE statement might encounter conditions with codes 1 and 4, resulting in a combined JSON-STATUS value of 5. You can determine if a given condition occurred, and the corresponding code is present in JSON-STATUS, by using a statement such as the following:
  IF FUNCTION MOD(JSON-STATUS 2 * code) / code = 1
    DISPLAY 'JSON-STATUS condition ' code ' occurred.'
  END-IF
where code is one of the individual JSON-STATUS codes.

The runtime messages are issued only if the WITH DETAIL phrase was specified on the JSON PARSE statement. Special registers JSON-STATUS and JSON-CODE are always set.