Figure 16 shows the Sale application’s Order activity being created and run synchronously with SAL002.
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 command’s processing. 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 may result from processing the activity itself.
To check the response from the actual processing of any activity other than a root activity, 5 you must issue one of the following commands:
For information about acquiring activities, see Acquiring processes and activities.
The Sale root activity, 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:
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.)
The firing of the completion event causes the activity’s parent 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 Acquiring an activity.