Checking the response from a synchronous activity

The Order activity of the Sale application is created and run synchronously with SAL002.

About this task

Figure 1 shows the Order activity of the Sale application being created and run synchronously with SAL002.
Figure 1. Requests to create and activate an activity. The conditions returned by the RESP and RESP2 options on the LINK ACTIVITY command do not relate to the processing of the activity itself.

Order-Activity..
EXEC CICS DEFINE ACTIVITY('Order')
TRANSID('SORD')
PROGRAM('ORD001')
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS PUT CONTAINER(Sale-Container)
ACTIVITY('Order') FROM(Process-Name)
RESP(data-area) RESP2(data-area) END-EXEC.
 EXEC CICS LINK ACTIVITY('Order')
RESP(data-area) RESP2(data-area) END-EXEC.

The RESP and RESP2 options on a RUN ACTIVITY or LINK ACTIVITY command return any exceptional condition that is raised during the processing of the command. However, what is processed is a request for BTS to run the activity—that is, for BTS to accept and schedule the activity. Therefore, the RESP and RESP2 options do not return any exceptional condition that might result from processing the activity itself.

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)
Used to check a child of the current activity.
CHECK ACQACTIVITY
Used 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.

Figure 2. The Sale root activity. SAL002,. SAL002, checks to see if the Order activity completed successfully or whether an error occurred.
 EXEC CICS CHECK ACTIVITY('Order') COMPSTATUS(status)
RESP(RC) RESP2(data-area) END-EXEC.
If RC NOT = DFHRESP(NORMAL).
End-If..
If status NOT = DFHVALUE(NORMAL).
End-If.
.

Because Order is one of its child activities, SAL002 uses the CHECK ACTIVITY(child_name) form of the command.

The RESP and RESP2 options on the CHECK ACTIVITY command return a condition that tells you whether the CHECK command is understood by CICS® —for example, ACTIVITYERR occurs if an activity named Order has not been defined to SAL002.

The COMPSTATUS option returns a CVDA value indicating the completion status of the activity:
  • NORMAL is returned if the activity has completed all its processing steps.
  • FORCED is returned if the activity was forced to complete with a CANCEL ACTIVITY command.
  • INCOMPLETE is returned if the activity needs to be reactivated in order to complete all its processing steps.
  • ABEND is returned if the program that implements the activity abended.

If a child activity completes, either successfully or unsuccessfully, and its parent issues a CHECK ACTIVITY command, the execution of the command causes CICS to delete the activity-completion event. Before a parent activity completes, it should ensure that the completion events of all its child activities have been deleted.

Note: If an activity completes and a CHECK ACQACTIVITY command is issued by a program other than its parent, the activity-completion event is not deleted. For example, a program executing outside a BTS process might issue an ACQUIRE ACTIVITYID command to acquire control of an activity within the process. It might then run the activity, and issue a CHECK ACQACTIVITY command to check the outcome. If the activity has completed, its completion event is not deleted.

The firing of the completion event causes the parent of the activity to be activated. Only if the parent issues a CHECK ACTIVITY command does CICS delete the completion event.

For an explanation of why a program executing outside a process might want to acquire an activity within the process, see Interacting with BTS processes and activities . For an example of the use of the ACQUIRE ACTIVITYID and CHECK ACTIVITYID commands, see Activity processing.