Call sub-program in batch and online

Customer Information Control System. Middleware and MQ Series.
Post Reply
arpitpatel01
New Member
Posts: 4
Joined: Fri Aug 26, 2016 3:51 pm

Call sub-program in batch and online

Post by arpitpatel01 »

Before asking question, let me detail about the programs in picture.

Program A - Main program
Program B - sub-program - COBOL + IMS.
Program C - sub-program - COBOL + DB2.
Program D - sub-program - COBOL + DB2.

Note - Program C & D have same logic. The difference is that..
a. Program D has CICS statements in case DB2 logic fails and program C does not have any CICS statements.
b. Program C is compiled with CICS option as 'N'. While, Program D is compiled with CICS option as 'Y'

Main program A calls sub-program B. Program B is calling 2 sub-programs - C & D.
Program B is compiled with CICS option as 'Y'.

Question-
We are trying to call Program B in batch, but it fails with S0C1 in the IMS call. To resolve it, we set the CICS option as 'N' during compilation and then executed in batch and it worked fine. But, then the same version failed while executing in CICS region.
This is obviously because of CICS flag being 'N' during compilation.

Is there a way we can compile / modify Program B to execute in both batch and online mode?
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Call sub-program in batch and online

Post by Anuj Dhawan »

If I've understood your question correctly - search for CICS DFHEIBLK and nested COBOL programs.

Edit:

There is an example at this link: https://www.ibm.com/docs/en/cics-ts/5.3 ... l-programs
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Abhishek Mehta
Registered Member
Posts: 15
Joined: Fri Dec 26, 2014 2:34 pm

Re: Call sub-program in batch and online

Post by Abhishek Mehta »

Why do you want to make it too complex, is there not a way to make it easy?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Call sub-program in batch and online

Post by Robert Sample »

Is there a way we can compile / modify Program B to execute in both batch and online mode?
The CICS and batch environments are different enough that there is no easy way to do this. The batch program would have to account for both DFHEIBLK and DFHCOMMAREA -- and that is without considering the ramifications of having IMS in there. You could extract the common logic into a new subprogram that has no CICS in it and use a COBOL CALL statement for the new subprogram to remove the dependency on CICS. If you wanted to do this, I'd recommend a static call and linking the subprogram into the load module.
Abhishek Mehta
Registered Member
Posts: 15
Joined: Fri Dec 26, 2014 2:34 pm

Re: Call sub-program in batch and online

Post by Abhishek Mehta »

Could you do it, if yes what was the solution arpitpatel0? Could you share that.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “CICS, Middleware and MQ Series.”