Pseudoconversational transactions
Follow this pseudocode to see how to run a pseudoconversational 3270 transaction.
A pseudoconversation is indicated by the fact that the output data returned to the client by the exit program contains a bridge facility token (and possibly a next-transaction ID). It is the responsibility of the client to check the appropriate field in the output message and to start the next transaction.
The example shown here contains pseudocode for running a 3270 pseudoconversational transaction.
Client activity
When DFH-Initial
encode msg-in-buffer
EXEC CICS DEFINE ACTIVITY (3270-act-name)
TRANSID(transaction-id) EVENT(3270-Complete)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS PUT CONTAINER('Message')
ACTIVITY(3270-act-name) FROM(msg-in-buffer)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS RUN ACTIVITY(3270-act-name)
ASYNCHRONOUS
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS RETURN END-EXEC..
When 3270-Complete
EXEC CICS CHECK ACTIVITY(3270-act-name)
COMPSTATUS(status) ABCODE(a)
RESP(data-area) RESP2(data-area) END-EXEC
If status NOT = DFHVALUE(NORMAL)
EXEC CICS ABEND ABCODE(a)
NODUMP
RESP(data-area) RESP2(data-area) END-EXEC
End-If..
EXEC CICS GET CONTAINER('Message')
ACTIVITY(3270-act-name) INTO(msg-out-buffer)
RESP(data-area) RESP2(data-area) END-EXEC.
decode msg-out-buffer
If mqcih-facility = blank
EXEC CICS RETURN ENDACTIVITY END-EXEC
Else
encode msg-in-buffer
EXEC CICS DEFINE ACTIVITY (3270-act-name)
TRANSID(next-transaction-id)
EVENT(3270-Complete)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS PUT CONTAINER('Message')
ACTIVITY(3270-act-name)
FROM(msg-in-buffer)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS RUN ACTIVITY(3270-act-name)
ASYNCHRONOUS
FACILITYTOKN(8-byte token)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS RETURN END-EXEC
End-If.
Bridge exit program
Init.
pass userdata from the brdata to BRXA..
Bind.
EXEC CICS GET CONTAINER('Message')
INTO(3270-msg-in-buffer)
RESP(data-area) RESP2(data-area) END-EXEC..
Term.
EXEC CICS PUT CONTAINER('Message')
FROM(3270-msg-out-buffer)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS RETURN END-EXEC
Note that:
- The client starts each transaction in the pseudoconversation by defining and running a new child activity, rather than by reactivating the same child activity with a different input event. This is necessary, in case the next-transaction IDs returned by the 3270 application are different—that is, in case each step of the pseudoconversation is implemented by a differently named transaction. (The variable next-transaction-id is used to name the transaction that implements each new child activity.)
- In this example, the variable 3270-act-name is used to name each child activity differently. An alternative approach might be to delete the completed child activity before redefining it with a different TRANSID.
- In this example, the variable 3270-Complete is used to name each activity completion event differently. This is not strictly necessary, because if the previous child activity completed normally its completion event is deleted from the event pool of the client following the CHECK ACTIVITY command.
- The output message returned by the bridge exit program should contain an 8-byte token representing the bridge facility. So that the bridge facility is reused for the next transaction in the pseudoconversation, the client uses the FACILITYTOKN option of the RUN ACTIVITY command to pass the token to the next child activity.