Transferring input and output data
Follow this task to see how to transfer data between a parent and a child activity. The task uses the Delivery activity Sale application as an example.
About this task
Delivery-Activity.
.
EXEC CICS DEFINE ACTIVITY('Delivery')
TRANSID('SDEL')
EVENT('Delivry-Complete')
RESP(data-area) RESP2(data-area) END-EXEC
.
EXEC CICS GET CONTAINER(Order-Container)
ACTIVITY('Order') INTO(Order-Buffer)
RESP(data-area) RESP2(data-area) END-EXEC
EXEC CICS PUT CONTAINER(Order-Container)
ACTIVITY('Delivery') FROM(Order-Buffer)
RESP(data-area) RESP2(data-area) END-EXEC
- Automatically by CICS®, when its parent completes.
- Before this, if its parent issues a DELETE ACTIVITY command against it.
The PUT CONTAINER command associates a data-container (also named Order) with the Delivery activity, and places the retrieved data in it.
Identification Division.
Program-id. DFH0DEL1.
Environment Division.
Data Division.
Working-Storage Section.
01 Event-Name pic x(16).
88 DFH-Initial value 'DFHINITIAL'.
01 Order-Ptr usage is pointer.
01 Order-Container pic x(16) value 'Order'.
01 Delivery-Container pic x(16) value 'Delivery'.
01 Deliver-Data.
.
Linkage Section.
01 DFHEIBLK.
.
01 Order-Details.
05 Order-Number pic 9(8).
.
Procedure Division..
Begin-Process.
.
EXEC CICS RETRIEVE REATTACH EVENT(Event-Name)
RESP(RC) END-EXEC
.
If RC NOT = DFHRESP(NORMAL)
.
End-If.
.
Evaluate True
When DFH-Initial
Perform Delivery-Work
Perform End-Activity
When Other
.
End Evaluate.
.
EXEC CICS RETURN END-EXEC
.
Delivery-Work.
.
EXEC CICS GET CONTAINER(Order-Container) SET(Order-Ptr)
RESP(data-area) RESP2(data-area) END-EXEC
.
set address of Order-Details to Order-Ptr.
.
EXEC CICS READ FILE .....
RESP(data-area) RESP2(data-area) END-EXEC
.
. logic to print delivery details
.
.
EXEC CICS PUT CONTAINER(Delivery-Container) FROM(Delivery-Data)
RESP(data-area) RESP2(data-area) END-EXEC
.
End-Activity.
.
EXEC CICS RETURN ENDACTIVITY
RESP(data-area) RESP2(data-area) END-EXEC
The Delivery activity issues a GET CONTAINER command to retrieve data from a data-container named Order. Because the command does not specify the ACTIVITY option, it references a data-container associated with the current activity; in other words, it references the same Order data-container as that referenced by the PUT CONTAINER command in Figure 1.
The Delivery activity uses the input data to execute its logic. Then it issues a PUT CONTAINER command to store its output in a data-container named Delivery. Again, the ACTIVITY option is not specified, so the data-container is associated with the current (Delivery) activity.