Checking the response from a synchronous activity

Figure 16 shows the Sale application’s Order activity being created and run synchronously with SAL002.

Figure 16. 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 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:

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 by means of an ACQUIRE ACTIVITYID command.

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.)

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 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.

Related concepts
Using the BTS API to write business applications
The Sale example application
Related tasks
Checking the response from an asynchronous activity
Getting details of activity ABENDs
Retrying failed activities
Related reference
Overview of BTS API commands
BTS application programming commands

5.
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.

[[ Contents Previous Page | Next Page Index ]]