Conversational transactions
Follow this pseudocode to see how to run a conversational 3270 transaction. Potential problems with solutions are illustrated.
A potential problem is that, at one or more stages, the 3270 transaction requires further data to continue. The bridge exit program cannot obtain this data from the client. That is, it cannot end its current activation, to be reactivated with the required data—because the 3270 transaction has not completed, issuing an EXEC CICS RETURN command would merely return control to the latter. Nor can the exit program get information back to the client by issuing an EXEC CICS SYNCPOINT command, because this would modify the 3270 transaction.

One possible problem of creating a separate activity to deal with each intermediate map is that the output message sent to the client by the exit program at transaction end contains only the final 3270 map. If it is important that intermediate messages are preserved, the conversational activities could put them in other containers associated with the client.
The following table contains example pseudocode for running a 3270 conversational transaction.
Read_Message.
encode conv-in-buffer from 3270-msg-out-buffer
EXEC CICS DEFINE ACTIVITY (next-conv-act-name)
TRANSID(conv-transaction-id)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS PUT CONTAINER('Request')
ACTIVITY(next-conv-act-name)
FROM(conv-in-buffer)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS LINK ACTIVITY(next-conv-act-name)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS CHECK ACTIVITY(next-conv-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('Request')
ACTIVITY(next-conv-act-name)
INTO(3270-msg-in-buffer)
RESP(data-area) RESP2(data-area) END-EXEC..
Write_Message.
Intermediate writes cannot be sent
to the client.
EXEC CICS NOOP
RESP(data-area) RESP2(data-area) END-EXEC.
“Conversational” activity
WHEN DFH-Initial
EXEC CICS GET CONTAINER('Request')
INTO(msg-in-buffer)
RESP(data-area) RESP2(data-area) END-EXEC.
decode msg-in-buffer
encode msg-out-buffer.
EXEC CICS PUT CONTAINER('Request')
FROM(msg-out-buffer)
RESP(data-area) RESP2(data-area) END-EXEC.
EXEC CICS RETURN END-EXEC
The exit program issues a LINK ACTIVITY, rather than a RUN ACTIVITY SYNCHRONOUS, command to activate the “conversational” child activity. This is necessary to ensure that the child executes in the same unit of work as the exit program.