IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Call a CICS program from a batch COBOL program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Jun 18, 2011 10:50 pm
Reply with quote

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
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
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Sun Jun 19, 2011 1:05 am
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
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Sun Jun 19, 2011 9:49 pm
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
Reply with quote

Review this link:

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

For vendor software , try
Use [URL] BBCode for External Links
and
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top