View previous topic :: View next topic
|
Author |
Message |
sasanka Warnings : 1 New User
Joined: 18 Jan 2008 Posts: 34 Location: India
|
|
|
|
I have a CICS program PGM1 which gives details of employees. We can pass 50 employee nos to this CICS program and it will return back details of all the 50 employees to the calling program. I want to write a batch cobol program BATPGM1 which passes 50 employee nos to the CICS program PGM1 and needs to write details of all these 50 employees (returned from PGM1) into a flat file.
So, can anybody please help me how to write such a batch cobol program which calls the CICS program PGM1 and also the run jcl to execute the batch program. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Review the following post -
ibmmainframes.com/viewtopic.php?p=269161&highlight=#269161
There will be good documentation at the IBM link included in the above post, along with sample programs in several languages.
You may also want to check the SDFHSAMP lib provided with your version/release of CICS, where you can also find sample programs.
Bill |
|
Back to top |
|
|
sasanka Warnings : 1 New User
Joined: 18 Jan 2008 Posts: 34 Location: India
|
|
|
|
Hi Bill, I am not able to find out any document related to my question in the link you provides |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Google is your friend. Googling cics external interfaces guide returns 14,900 hits and one of them will surely be for your release of CICS. Read the Guide cover to cover and you will know exactly how to code a batch program to interact with a CICS program since that is one of the purposes of the External Interface Guide manual. |
|
Back to top |
|
|
sasanka Warnings : 1 New User
Joined: 18 Jan 2008 Posts: 34 Location: India
|
|
|
|
Can anybody confirm whether the following part of code is enough to call CICS program PGM1 from batch program BATPGM1.
WORKING-STORAGE SECTION.
01 WS-LINK-VAR.
05 WS-PROGRAM PIC X(08) VALUE ‘PGM1’.
05 WS-LEN PIC S9(04) COMP.
05 WS-DATA-LEN PIC S9(04) COMP.
01 EXCI-EXEC-RETURN-CODE.
05 EXEC-RESP PIC 9(08) COMP.
05 EXEC-RESP2 PIC S9(08) COMP.
05 EXEC-ABCODE PIC X(04).
05 EXEC-MSG-LEN PIC 9(08) COMP.
05 EXEC-MSG-PTR POINTER.
01 WS-COMMAREA.
05 WS-INPUT-AREA PIC X(100) VALUE SPACES.
05 WS-OUTPUT-AREA PIC X(500) VALUE SPACES.
01 WS-EMP-NOS.
05 WS-EMP-NO-01 PIC X(02) VALUE ‘01’.
05 WS-EMP-NO-02 PIC X(02) VALUE ‘02’.
05 WS-EMP-NO-03 PIC X(02) VALUE ‘03’.
--------------------------------------------------------
--------------------------------------------------------
05 WS-EMP-NO-50 PIC X(02) VALUE ‘50’.
01 WS-EMP-DETAILS.
05 WS-EMP-DETAIL-01 PIC X(10) VALUE SPACES.
05 WS-EMP-DETAIL-02 PIC X(10) VALUE SPACES.
05 WS-EMP-DETAIL-03 PIC X(10) VALUE SPACES.
-------------------------------------------------------
-------------------------------------------------------
05 WS-EMP-DETAIL-50 PIC X(10) VALUE SPACES.
In Procedure Division, we call the CICS program PGM1 (whose transaction id is TRN1) in the following way
MOVE WS-EMP-NOS TO WS-INPUT-AREA.
EXEC CICS LINK
PROGRAM(WS-PROGRAM)
RETCODE(EXCI-EXEC-RETURN-CODE)
COMMAREA(WS-COMMAREA)
LENGTH(WS-LEN)
TRANSID(‘TRN1’)
DATALENGTH(WS-DATA-LEN)
END-EXEC
IF WS-RESP = 0 AND EXEC-ABCODE = ‘00’
MOVE WS-OUTPUT-AREA TO WS-EMP-DETAILS.
END-EXEC.
Please confirm whether the run jcl for this program is same as a simple batch program run jcl. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
If you have 1 -- or 17 -- or 231 -- CICS regions, how does your batch program determine which region to connect to, in order to start that transaction? Getting batch programs to interact with CICS is a LOT more complicated than just doing an EXEC CICS LINK in your batch program -- which is why you have been told to read the manuals. The BEST case for what you've done would be for the batch job to not be able to start the transaction. The WORST case would be for your batch program to start the transaction, and after the batch program issues the STOP RUN statement your production CICS region comes down. |
|
Back to top |
|
|
Earl Haigh
Active User
Joined: 25 Jul 2006 Posts: 475
|
|
Back to top |
|
|
|