View previous topic :: View next topic
|
Author |
Message |
gokuldass
New User
Joined: 18 Mar 2005 Posts: 48 Location: india
|
|
|
|
Hi,
I have two programs main and sub program.
My main program doesn;t have any db2 statements and hence no package was created during compile and linkedit.
My sub program have db2 statements and hence compiled and linked edit with a package/plan.
My question:
Do I need to give the below statement in JCL while running the main program ???
//SYSTSIN DD *
DSN SYSTEM(TEST)
RUN PROG(SUB) PLAN(SUB)
END
/*
Thanks in advance. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
My first reaction is- is it the very first appication of this kind written at your shop? You must have some standard JCLs to execute such things, don't you? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
You've 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.
From MVS(z/OS, OS/390...) point of view, 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. Remember, DB2 is running as just another sub-system and 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 (and forget about the dynamic SQL for the time being).
So MVS(z/OS, OS/390...) environment in the JCL instead of coding a EXEC PGM=PureCobol, you would code a call to TSO, as in EXEC PGM-IKJEFT01, passing the actual execution in the SYSIN. |
|
Back to top |
|
|
sampathkmn Warnings : 1 New User
Joined: 12 Dec 2005 Posts: 31 Location: bangalore
|
|
|
|
Does this mean, even if main program does not contain SQL statements we need to precompile/bind it?
If yes, does this has any changes based on type of call(static/dynamic) to sub program? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Anuj Dhawan wrote: |
From MVS(z/OS, OS/390...) point of view, 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. Remember, DB2 is running as just another sub-system and 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 (and forget about the dynamic SQL for the time being). |
|
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
You can not bind the main program as it has no DBRM.
While your environment setup is surely different than mine, in a similar situation I would set this up like:
//SYSTSIN DD *
DSN SYSTEM(TEST)
RUN PROG(MAIN) PLAN(SUB)
END
/*
This arrangement would startup the DB2 System, use the attributes in the Plan(SUB) and run the Cobol program MAIN.
This is using a dynamic call, since I have not done a static call in many years. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
It would be like this in our shop,
Code: |
//CG25EXEC EXEC PGM=purecobol
//SYSCAFIP DD *
DB2D planname |
|
|
Back to top |
|
|
|