Dealing with BTS errors and response codes

Each time one of your applications issues a CICS® command, CICS automatically raises a condition to tell it how the command worked. This condition (which is usually NORMAL) is returned by the CICS EXEC interface in the RESP and RESP2 options of the command. If something out of the ordinary happens, the application receives an exceptional condition, which means a condition other than NORMAL. By testing this condition, it can tell what happened, and possibly why.

Procedure

  1. Check the response from a synchronous activity.
    To check the response from the actual processing of any activity other than a root activity, you must issue one of the following commands:
    • CHECK ACTIVITY(child_name) to check a child of the current activity.
    • CHECK ACQACTIVITY to check the activity that the current unit of work has acquired with an ACQUIRE ACTIVITYID command. For information about acquiring activities, see Acquiring processes and activities.

    Root activities are a special case. They are activated automatically by BTS after a RUN ACQPROCESS or LINK ACQPROCESS command is issued; also, they do not have completion events. To check the processing of a process, and therefore of a root activity, use the CHECK ACQPROCESS command.

    See Checking the response from a synchronous activity for a detailed explanation based on the Sale application.

  2. Check the response from an asynchronous activity.

    Asynchronous activities are treated almost identically to synchronous activities, the only difference being in the point at which the CHECK ACTIVITY command is issued.

    Typically, for a synchronous activity, the CHECK ACTIVITY command is issued immediately after the RUN or LINK command. For an asynchronous activity, it might, for example, be issued:
    • When the parent is reattached due to the firing of the activity's completion event.
    • When the requestor is reattached due to the expiry of a timer. This could occur if the requestor expects the activity to return without completing; the requestor may then reactivate the activity by sending it an input event.
  3. Get details of activity ABENDs.

    If a CHECK ACTIVITY command returns a completion status (COMPSTATUS) of ABEND, you can use the INQUIRE ACTIVITYID command to obtain further information about how the activity abended.

    This example returns the name of the program in which the abend occurred, together with the corresponding CICS abend code.

     If status = DFHVALUE(ABEND).
    To get the activity-identifier of the failed child,
    start a browse of child activities
    EXEC CICS STARTBROWSE ACTIVITY
    BROWSETOKEN(root-token)
    RESP(data-area) RESP2(data-area) END-EXEC.
    EXEC CICS GETNEXT ACTIVITY(child-name)
    BROWSETOKEN(root-token)
    ACTIVITYID(child-id)
    RESP(data-area) RESP2(data-area) END-EXEC.
    loop until the failed child is found by name
    EXEC CICS GETNEXT ACTIVITY(child-name)
    BROWSETOKEN(root-token)
    ACTIVITYID(child-id)
    RESP(data-area) RESP2(data-area) END-EXEC.
    end child activity browse loop
    Inquire on the failed child, using its activity-identifier
    EXEC CICS INQUIRE ACTIVITYID(child-id)
    ABCODE(data-area)
    ABPROGRAM(data-area)
    RESP(data-area) RESP2(data-area) END-EXEC
    Tip: A simpler way of obtaining the activity-identifier of the failed child activity (used on the EXEC CICS INQUIRE ACTIVITYID command) would be to code the ACTIVITYID option of the DEFINE ACTIVITY command used to define the child, and to store the returned value.
  4. Try failed activities again.
    If a child activity fails, you can try it again. The parent issues a CHECK ACTIVITY command, if it has not already done so, to check the current completion status of the child activity.
    1. Issue a RESET ACTIVITY command.
      The child activity is reset to its initial state: its completion event is added to the event pool of the parent, with the status set to NOTFIRED; any children of the child activity are deleted. The data-containers of the child activity are not disturbed.
    2. Issue a RUN ACTIVITY command.
      The child activity is invoked with a DFHINITIAL event.