Back-end transaction initiation
The back-end transaction is initiated as a result of the front end transaction's EXEC CICS® CONNECT PROCESS command. Initially, the back-end transaction should determine the CONVID. This is not strictly necessary because the conversation is the back-end transaction's principal facility. Therefore, the CONVID parameter is optional for DTP commands on this conversation. However, the CONVID is useful for audit trails. Also, if the back-end transaction is involved in more than one conversation, by always specifying the CONVID option, you improve program readability and problem determination.
* …
DATA DIVISION.
WORKING-STORAGE SECTION.
* …
01 FILLER.
02 WS-CONVID PIC X(4).
02 WS-STATE PIC S9(7) COMP.
02 WS-SYSID PIC X(4) VALUE 'SYSB'.
02 WS-PROC PIC X(32) VALUE 'BBBB'.
02 WS-LEN-PROCN PIC S9(5) COMP VALUE +4.
02 WS-SYNC-LVL PIC S9(5) COMP VALUE +2.
* …
01 FILLER.
02 WS-RECORD PIC X(100).
02 WS-MAX-LEN PIC S9(5) COMP VALUE +100.
02 WS-RCVD-LEN PIC S9(5) COMP VALUE +0.
* …
PROCEDURE DIVISION.
* …
EXEC CICS ASSIGN FACILITY(WS-CONVID) END-EXEC.
* …
* Extract the conversation characteristics.
*
EXEC CICS EXTRACT PROCESS PROCNAME(WS-PROC)
PROCLENGTH(WS-LEN-PROCN)
SYNCLEVEL(WS-SYNC-LVL)
END-EXEC.
* …
* Receive data from the front-end transaction.
*
EXEC CICS RECEIVE CONVID(WS-CONVID) STATE(WS-STATE)
INTO(WS-RECORD) MAXLENGTH(WS-MAX-LEN)
NOTRUNCATE LENGTH(WS-RCVD-LEN)
END-EXEC.
*
* … Check outcome of EXEC CICS RECEIVE.
* …
The back-end transaction can also retrieve its transaction name by issuing the EXEC CICS EXTRACT PROCESS command. In the example that is shown in Figure 1, CICS places the transaction name in WS-PROC and the length of the name in WS-LEN-PROCN.
With the EXEC CICS EXTRACT PROCESS, the back-end transaction can also retrieve the synchronization level at which the conversation was started. In the example, CICS places the synchronization level in WS-SYNC-LVL.
The EXEC CICS ASSIGN and the EXEC CICS EXTRACT PROCESS commands are discussed here to give you some idea of what you can do in the back-end transaction. They are not essential.
The back-end transaction starts in receive state (state 5), and must issue an EXEC CICS RECEIVE command. By doing this, the back-end transaction receives whatever data the front-end transaction has sent and allows CICS to raise EIB flags and change the conversation state to reflect any request that the front-end transaction has issued.