Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Call a CICS program from a batch COBOL program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sasanka
Warnings : 1

New User


Joined: 18 Jan 2008
Posts: 34
Location: India

PostPosted: Sat Jun 18, 2011 9:54 pm    Post subject: Call a CICS program from a batch COBOL program
Reply with quote

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
View user's profile Send private message

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sat Jun 18, 2011 10:50 pm    Post subject: Reply to: Call a CICS program from a batch COBOL program
Reply with quote

Review the following post -

http://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
View user's profile Send private message
sasanka
Warnings : 1

New User


Joined: 18 Jan 2008
Posts: 34
Location: India

PostPosted: Sun Jun 19, 2011 12:07 am    Post subject: Reply to: Call a CICS program from a batch COBOL program
Reply with quote

Hi Bill, I am not able to find out any document related to my question in the link you provides
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7932
Location: Bellevue, IA

PostPosted: Sun Jun 19, 2011 1:05 am    Post subject:
Reply with quote

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
View user's profile Send private message
sasanka
Warnings : 1

New User


Joined: 18 Jan 2008
Posts: 34
Location: India

PostPosted: Sun Jun 19, 2011 8:29 pm    Post subject: Reply to: Call a CICS program from a batch COBOL program
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7932
Location: Bellevue, IA

PostPosted: Sun Jun 19, 2011 9:49 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Fri Jun 24, 2011 5:53 pm    Post subject:
Reply with quote

Review this link:

http://cicswiki.org/cicswiki1/index.php?title=How_do_I_interact_with_a_transaction_from_a_batch_program%3F

For vendor software , try
www.batchcics.com
and
http://www.hostbridge.com/index.php/products/detail/connectors
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts CICS transaction slow response time vasanthz All Other Mainframe Topics 2 Thu Jan 19, 2017 1:31 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us