I have a COBOL DB2 pgm that updates a table with record counts for a request. Can my COBOL pgm pass the request number and record count to my DB2 pgm and succesfully call it?
Hi nxm150,
I'm going to talk from an OS390 point of view here. Your standard Cobol program can call a DB2 program without any differences to the Cobol. In the calling program, the 'call' statement is exactly as it would be in any other program.
The difference lies in the 'outside' environment. In order to access DB2 tables, you must start off with in a DB2 environment, and specify a plan (or package) name, which has got the db2 statements already defined to it (let's ignore dynamic SQL for the time being).
What this means in an OS390 environment is that in the JCL rather than coding a EXEC PGM=COBPROGA, you would code a call to TSO, as in EXEC PGM-IKJEFT01, passing the actual execution in the SYSIN.
Hope this has not been a grandmother and eggs situation and if I have over explained things, sorry. If I've not explained things enough, get back to us.
what if the Calling program needs to be a Non-DB2 program. I wrote the DB2 sub-routine and another programmer who doesn't know DB2 wrote a Non-DB2 Cobol program which should call my DB2 program. I got a -927 sqlcode executing it.
Can I use the above mentioned JCL for my situation?
You HAVE to use the IKJEFT01-JCL even if your main program doesn't use DB2-commands. An you have to bind a plan for this program. Ohterwise you cannot connect to the DB2-system an receive a SQL-Code -927.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.