Back-end transaction initiation
The back-end transaction is initiated as a result of the front end transaction’s CONNECT PROCESS command.
Initially, the back-end transaction should determine the convid. This is not strictly necessary because the session is the back-end transaction’s principal facility making the CONVID parameter 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, always specifying the CONVID option improves program readability and problem determination.
Figure 1 shows a fragment of a back-end transaction that obtains the conversation identifier. The example uses the ASSIGN command for this purpose; another way is to access the information in EIBTRMID.
The back-end transaction can also retrieve its transaction name by issuing the EXTRACT PROCESS command. In the example shown in Figure 1 , CICS places the transaction name in WS-PROC and the length of the name in WS-LEN-PROCN. With the EXTRACT PROCESS, the back-end transaction can also retrieve the sync level at which the conversation was started. In the example, CICS places the sync level in WS-SYNC-LVL.
Both the ASSIGN and the EXTRACT PROCESS commands are discussed here only 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 a 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 the front-end transaction has issued.
* ...
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(4) VALUE 'BBBB'.
02 WS-LEN-PROCN PIC S9(4) COMP VALUE +4.
02 WS-SYNC-LVL PIC S9(4) COMP VALUE +2.
* ...
01 FILLER.
02 WS-RECORD PIC X(100).
02 WS-MAX-LEN PIC S9(4) COMP VALUE +100.
02 WS-RCVD-LEN PIC S9(4) 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 RECEIVE.
* ...