Specifying error handling

When Open ServerConnect executes a command, it uses the SPAREA SPRC field to send a return code that indicates the success or failure of the command.

The following COBOL II statements show an example of return code checking after issuing an OPENPIPE command:

CALL 'OPENPIPE' USING SPAREA
 IF SPRC NOT EQUAL '000' THEN GOTO PERFORM-TERMINATE.

In addition to '000', the SPRC field can contain other codes. For example: ’EOF’, ‘ACE’, and ‘CAN’. See the following table for an explanation of those codes and the SPAREA fields used to communicate status and messages between Open ServerConnect and the RSP.

Table 2-7: SPAREA error handling fields

SPAREA field

Use

SPRC

RSP API indicates the success or failure of an RSP command in this field. Possible values are:

  • '000' indicates successful completion.

  • 'xxx' indicates a Open ServerConnect error message.

  • 'EOF' indicates an End of File on input data.

  • 'ACE' indicates an APPC communication error (when the MainframeConnect configuration property Temporary Storage Type is set to None).

  • 'CAN' indicates the client issued a DBCANCEL command.

SPSTATUS

RSP API communicates the status of processing in the remote database to the RSP. The RSP also uses the SPSTATUS field to communicate status on its own processing to the client application. Possible values are:

  • 'OK' indicates success.

  • 'E' indicates an error.

  • 'W' indicates a warning.

SPMSG

RSP communicates messages back to the client using this field.

SPCODE

An error code that is sent in a message to the client application appears in this field.

For a complete list of MainframeConnect error messages, see Mainframe Connect Client Option and Server Option Messages and Codes.