There are 2 ways we can access CICS from DB2 stored procedure.
- Accessing CICS Systems Through EXCI
- Accessing CICS Systems Through Stored Procedure DSNACICS
Method:1 Preparing CICS and WLM for EXCI
Prior to executing a stored procedure that invokes EXCI, you must define the following resources on the resource definition screen in the CICS region where the CICS program will execute: connections, sessions, transaction, program, and any files accessed.
You can perform the resource definition (RDO) process using the CEDA transaction. We have included access to a VSAM file.
The VSAM file is defined to CICS via the RDO since we access the file from the CICS transaction. Therefore, there is no need to add a DD statement for the VSAM file to the startup JCL for the address space.
We defined all the RDO entries for our test case in group SG247083, which is a copy of the resource group DFH$EXCI supplied with CICS.
All of the RDO definitions that are used by EXCI must be defined in the same group. RDO definitions can be maintained by using the CEDA transaction in CICS.
Here are the steps we followed to define the resources to CICS. We used a CICS Transaction Server V3.1 system for out testing.
CICS Resource Definitions
Connections definition – Issue the following command to define a connection:
CEDA DEF GROUP(SG247083) CON
The required fields and the values we chose were as follows. For each field, you can use an abbreviation by specifying only those characters shown in capital letters.
The values we chose for each field are shown in bold.
- CONnection – XCTG
- Group – SG247083 (this is carried over from the CEDA command). Once the first resource has been defined, the group is automatically defined.
- Description – This is optional.
- ACcessmethod – IRC (Abbreviation: IR)
- PRotocol – Exci (Abbreviation: E)
- Conntype – Generic (Abbreviation: G)
Sessions definition – Issue the following command to define a session:
CEDA DEF GROUP(SG247083) SES
The required fields and the values we chose were as follows:
- Sessions – XCTGSESS
- Connection – XCTG, which refers to the definition of the connection.
- Protocol – Exci (Abbreviation: E)
- RECEIVECount – 4 (should be some non-zero number)
Program definition – You need one entry for the CICS program called by the stored procedure. Issue the following command to define program EMPEXC2C:
CEDA DEF GROUP(SG247083) PRO
The required fields and the values we chose were as follows:
- PROGram – EMPEXC2C
- Language – COBOL (Abbreviation: CO)
Transaction definition – You need one entry for the CICS transaction ID that is associated with the CICS program to be executed.
The transaction definition refers to the CICS program DFHMIRS, which is a stub for the EXCI call.
Program DFHMIRS will then execute the CICS program you specify in the CICS LINK statement in your stored procedure. Issue the following command to define transaction DPT1:
CEDA DEF GROUP(SG247083) TR
The required fields and the values we chose were as follows:
- TRANSaction – DPT1
- PROGram – DFHMIRS
- PROFile – DFHCICSA
You need to specify a profile with parameter INBFMH=ALL as in DFHCICSA, otherwise the transactions fail with abend code AXFQ.
VSAM file definition – Issue the following command to define VSAM file Sg247083.DEPT with a DDname of DEPTNAME:
CEDA DEF GROUP(SG247083) FI
- File – DEPTNAME
- DSNAME – SG247083.DEPT.CL, which is the VSAM cluster name
- Install the group SG247083: CEDA I GROUP(SG247083)
- ISC parameter – Verify that the SIT parameter ISC is set to YES.
- RRMS parameter – Verify that the SIT parameter RRMS is set to YES. CICS supports the MVS resource recovery services (RRS) in applications that use the external CICS interface.
- Remember that changes made to program EMPEXC2C only become active in CICS after executing the following command in CICS to pull in the latest version of program EMPEXC2C:
- CEMT SET PROG(EMPEXC2C) NEWCOPY
WLM Definitions:
We recommend that you define a separate WLM application environment for your EXCI transactions to minimize the impact that problems with CICS systems can have on your stored procedures. We chose to name the environment DB9AEXCI.
The load library that contains the EXCI stub program DFHMIRS needs to be included in the startup JCL for the WLM procedure.
The name of the load library typically ends in SDFHEXCI.
Coding a Stored Procedure to Use EXCI:
Stored procedure EMPEXC1C includes an EXEC CICS LINK statement to invoke the new transaction defined in the RDO entry as described in the section above.
EXEC CICS LINK PROGRAM ('EMPEXC2C') TRANSID ('DPT1') APPLID ('SCSCPAPB') COMMAREA(WS-COMM-AREA) LENGTH (WS-COMM-LEN) RETCODE (EXCI-EXEC-RETURN-CODE) SYNCONRETURN END-EXEC.
When the LINK statement is executed, CICS loads program DFHMIRS, the EXCI mirror program, which in turn will load the program that is passed in the PROGRAM field of the LINK statement, which is EMPEXC2C in our case.
This program then reads the commarea that is passed, uses the DEPTNO field in the commarea, and reads file DEPTNAME to obtain the department name, which is then passed back in the commarea.
The fields WS-COMM-AREA and WS-COMM-LEN represent the commarea, and the length of the commarea that is passed from the stored procedure to the CICS program EMPEXC2C.
Method: 2: Preparing a Stored Procedure to Use EXCI
Stored procedures that use EXCI to call CICS programs must include a CICS translation step in the program preparation process.
The CICS program needs to be prepared using standard CICS preparation JCL. Refer to the link for more details in the IBM doc.
Related Posts
5 thoughts
Comments are closed.