Call COBOL-DB2 program from pure COBOL program?

All sort of Mainframes Interview Questions.

Topic author
Shalini Sameera
New Member
Posts: 7
Joined: Mon May 23, 2016 10:39 am

Call COBOL-DB2 program from pure COBOL program?

Postby Shalini Sameera » Sun Oct 23, 2016 2:42 pm

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: 544
Joined: Wed Apr 23, 2014 8:45 pm
Been thanked: 11 times

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

Postby nicc » Sun Oct 23, 2016 3:32 pm

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: 822
Joined: Wed Sep 11, 2013 3:57 pm
Been thanked: 69 times

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

Postby enrico-sorichetti » Sun Oct 23, 2016 5:39 pm

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?

Postby Arun Raj » Mon Oct 24, 2016 9:15 pm

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: 822
Joined: Wed Sep 11, 2013 3:57 pm
Been thanked: 69 times

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

Postby enrico-sorichetti » Mon Oct 24, 2016 10:43 pm

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?

Postby Arun Raj » Mon Oct 24, 2016 11:57 pm

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: 2392
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Has thanked: 152 times
Been thanked: 66 times

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

Postby Anuj Dhawan » Tue Oct 25, 2016 12:02 am

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

User avatar

Anuj Dhawan
Founder
Posts: 2392
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Has thanked: 152 times
Been thanked: 66 times

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

Postby Anuj Dhawan » Tue Oct 25, 2016 12:05 am

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

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?

Postby Arun Raj » Tue Oct 25, 2016 12:10 am

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?

Postby Arun Raj » Tue Oct 25, 2016 12:10 am

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: 2392
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Has thanked: 152 times
Been thanked: 66 times

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

Postby Anuj Dhawan » Tue Oct 25, 2016 12:18 am

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


Chandan Yadav
Website Team
Website Team
Posts: 69
Joined: Wed Jul 31, 2013 10:19 pm
Has thanked: 10 times
Been thanked: 7 times

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

Postby Chandan Yadav » Wed Oct 26, 2016 4:11 pm

Nice to see you here Arun..




enrico-sorichetti
Global Moderator
Global Moderator
Posts: 822
Joined: Wed Sep 11, 2013 3:57 pm
Been thanked: 69 times

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

Postby enrico-sorichetti » Wed Oct 26, 2016 6:24 pm

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-)


Return to “Interview Questions.”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests