Page 1 of 1

Call COBOL-DB2 program from pure COBOL program?

Posted: Sun Oct 23, 2016 2:42 pm
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?

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

Posted: Sun Oct 23, 2016 3:32 pm
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.

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

Posted: Sun Oct 23, 2016 5:39 pm
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

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

Posted: Mon Oct 24, 2016 9:15 pm
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?

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

Posted: Mon Oct 24, 2016 10:43 pm
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

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

Posted: Mon Oct 24, 2016 11:57 pm
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 :)

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

Posted: Tue Oct 25, 2016 12:02 am
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.

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

Posted: Tue Oct 25, 2016 12:05 am
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! :)

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

Posted: Tue Oct 25, 2016 12:10 am
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.

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

Posted: Tue Oct 25, 2016 12:10 am
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".

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

Posted: Tue Oct 25, 2016 12:18 am
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...! :)

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

Posted: Wed Oct 26, 2016 4:11 pm
by Chandan Yadav
Nice to see you here Arun..

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

Posted: Wed Oct 26, 2016 6:24 pm
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