Command interface return codes

Return codes for the command interface can be positive or zero. A value of zero indicates successful execution. A positive value indicates that the execution failed or was abnormal in some way. Return codes are the same regardless of the language of your application.

Return codes are displayed in a variable in the user's exec or CLIST. If you run a REXX exec, the return code is in the REXX variable called RC; if you run a CLIST, the return code is in the CLIST variable &LASTCC.

The following example shows an exec that examines a return code. The example shows how to run a query and test for an error with the REXX variable RC:
ADDRESS ISPEXEC SELECT PGM(DSQCCI) PARM(RUN QUERYA (FORM=FORMA))
Select
  When (RC = 0)  Then nop
  When (RC = 64) Then
      Say "You must run QMF with ISPF to use command interface."
  When (RC = 100) Then
      Say "You need to start QMF before you begin your application"
  Otherwise
      Say "Unexpected error ("RC") from QMF command interface."
End

You can place code for handling errors in program modules and in execs or CLISTs.

Return codes 0 through 16

Return codes 0 through 16 describe the QMF processing of the command passed with the command interface. Along with the code, the command interface returns the values of the QMF command message variables in the ISPF shared pool of the application.

Table 1. Return codes 0 through 16
Value Explanation
0 Successful execution
4 QMF session marked for termination by an EXIT or END command
8 Execution failed, but the error did not cause the session to be marked for termination
16 Severe error: session marked for termination

A return code of 4 occurs only on the command that caused the session to be marked for termination. If the application then attempts to run another command, QMF returns another return code value to the application.

Return codes of 20 or higher

These codes usually reflect some failure in the command interface (DSQCCI). The failure prevents the interface from copying a variable into the application shared pool. As a result, the QMF variables might be invalid or they might not be set. The same result might be true of the STATE variables if your program uses the STATE command. (A variable is set if it is copied into the application shared pool.)

These return codes usually indicate more serious errors than return codes in the 0 through 16 range. Some return codes might require the services of IBM® Software Support.

In this table, shared variables refers to the QMF variables (and the STATE variables, if the current command is the STATE command). Some codes indicate that the command was run but the shared variables were not set. QMF ran the STATE command properly, but the command interface failed to set the updated shared QMF and STATE variables. The reason for the failure is described in the explanation of the error code.

Table 2. Return codes of 20 or more
Value Explanation
20 A user exit routine called the command interface; these calls are always invalid. The command passed to the command interface was not run. The shared variables were not set.
24 An error occurred in an ISPF VCOPY command. The command passed to the command interface was run. The shared variables were not set.
32 An error occurred in an ISPF VREPLACE command. The command passed to the command interface was run. The shared variables were not set.
36 An error occurred in an ISPF VPUT command. The command passed to the command interface was run. The shared variables were not set.
40 An error occurred in an ISPF VREPLACE command. This code applies only to the execution of the STATE command. The command passed to the command interface was run, but the shared variables were not set.
44 An error occurred in an ISPF VPUT command. This code applies only to the execution of the STATE command. The QMF variables were set, but the STATE variables were not.
60 An invalid call was made to the command interface. The command passed to the command interface was not run. The shared variables were not set.
64 This error is issued when DSQCCI is run and ISPF is not active. For example, the user called DSQCCI without using an ISPF SELECT PGM command.
100 This error occurs when an application tries to issue a QMF command when QMF is not active. Start QMF before you begin your application. The command passed to the command interface was not run. The shared variables were not set.
104 The anchor was not located. The command passed to the command interface was not run. The shared variables were set but are not valid.