Call COBOL-DB2 program from pure COBOL program?

All sort of Mainframes Interview Questions.
Post Reply
Shalini Sameera
New Member
Posts: 7
Joined: Mon May 23, 2016 10:39 am

Call COBOL-DB2 program from pure COBOL program?

Post by Shalini Sameera »

Hi,

Did someone try to call COBOL-DB2 program from pure COBOL program? I have been asked this in an interview whichI could not answer in a good manner.

Can anyone of you please tell me what all things needsto be included in the RUN JCL? Bind should be done for called program only, as per my understanding, is this correct?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Call COBOL-DB2 program from pure COBOL program?

Post by nicc »

What is "pure" cobol?
To access any database from any language you need statements that are specific to that database. These are, generally, extensions to the language and so, perhaps, you could say that such programs are impure.
Regards
Nic
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Call COBOL-DB2 program from pure COBOL program?

Post by enrico-sorichetti »

it is usually accepted that it means ( on the forums )
having a &MAIN cobol program ( with no db2 calls ) calling a COBOL subroutine which does some DATABASE I/O

DB2 does not care about the logic flow of the program
( who calls who )
DB2 cares only about the correspondence between the DBRM in the PLAN/PACKAGE and the subroutines used/invoked

since a NON DB2 program does not have a DBRM
no need to mention it' s name anywhere
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
Arun Raj
New Member
Posts: 4
Joined: Sat Jul 19, 2014 8:42 am

Re: Call COBOL-DB2 program from pure COBOL program?

Post by Arun Raj »

Hi enrico,

Good to see you here!

If we are running the program under batch TSO (via program IKJEFT01), don't we need the non DB2 program name in the RUN program-name command in the SYSTSIN card?
Love is like an hourglass, with the heart filling up as the brain empties - Jules Renard.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Call COBOL-DB2 program from pure COBOL program?

Post by enrico-sorichetti »

Hello Arun,
nice to see You on this new playground

You just need the name of the load module ...
nobody knows after how many calls the call to db2 will be done
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
Arun Raj
New Member
Posts: 4
Joined: Sat Jul 19, 2014 8:42 am

Re: Call COBOL-DB2 program from pure COBOL program?

Post by Arun Raj »

True, so in this case I am assuming the name of the load module would be the one generated from the "pure COBOL program".
enrico-sorichetti wrote:nice to see You on this new playground
Thanks enrico. I wanted to say hi to our old friend Anuj too, but looks like private messaging is blocked for me, I think he is mad at inactive members :)
Love is like an hourglass, with the heart filling up as the brain empties - Jules Renard.
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Call COBOL-DB2 program from pure COBOL program?

Post by Anuj Dhawan »

Just my $.02 ...

The classic answer is follow the standards at your shop - however, as this is an interview question, so, benefit-of-doubt goes to the TS - You should Compile the main program as a standard non-DB2 program. "Compile", i.e. - (pre)compile and compile the DB2-sub-program. BIND it as a standard DB2 program. Now the main part - execute main-program in JCL as if it was a standard DB2 program with the plan name that has the collection for your DB2-sub-program.
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.
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Call COBOL-DB2 program from pure COBOL program?

Post by Anuj Dhawan »

Arun Raj wrote:Thanks enrico. I wanted to say hi to our old friend Anuj too, but looks like private messaging is blocked for me, I think he is mad at inactive members :)
Parity bit is still in control! ;)

Inactive are better than spammers - after 3rd message, I think you should be able to send the PMs.

Yes, nice to see you! :)
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.
User avatar
Arun Raj
New Member
Posts: 4
Joined: Sat Jul 19, 2014 8:42 am

Re: Call COBOL-DB2 program from pure COBOL program?

Post by Arun Raj »

with the plan name that has the collection for your DB2-sub-program
and the RUN program-name with the load module name from the non-DB2 calling program.
Love is like an hourglass, with the heart filling up as the brain empties - Jules Renard.
User avatar
Arun Raj
New Member
Posts: 4
Joined: Sat Jul 19, 2014 8:42 am

Re: Call COBOL-DB2 program from pure COBOL program?

Post by Arun Raj »

Lol. Thanks Anuj and same here, I actually tried the "Send Email" feature to reach you, but not sure if those really "reached".
Love is like an hourglass, with the heart filling up as the brain empties - Jules Renard.
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Call COBOL-DB2 program from pure COBOL program?

Post by Anuj Dhawan »

They do reach to me but could not really look at them lately. Had been working round the clock. Earning to pay the bills is not easy, I tell you! :(

Please check, you should be able to send the PMs now. Hopefully TS is not annoyed, we have hijacked this topic quite a bit, I think...! :)
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.
Chandan Yadav
Website Team
Website Team
Posts: 70
Joined: Wed Jul 31, 2013 10:19 pm

Re: Call COBOL-DB2 program from pure COBOL program?

Post by Chandan Yadav »

Nice to see you here Arun..
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Call COBOL-DB2 program from pure COBOL program?

Post by enrico-sorichetti »

one thing to remember ...
THERE IS NO RELATION WHATSOEVER BETWEEN THE DB2 PLAN/PACKAGE AND THE PROGRAM USING IT

as long as the PLAN/PACKAGE contains all the DBRMs of the things effectively called/used

many years a customer of mine discovered after six months an error ( missing dbrm )
because the module called was dealing with a situation that did never occur before

AFAIK it might be different now
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
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 “Interview Questions.”