Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Question reqgaring Db2 usage in subprogram and main program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
gokuldass

New User


Joined: 18 Mar 2005
Posts: 48
Location: india

PostPosted: Wed Mar 03, 2010 12:27 pm    Post subject: Question reqgaring Db2 usage in subprogram and main program
Reply with quote

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
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Mar 03, 2010 6:27 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Mar 03, 2010 6:40 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sampathkmn
Warnings : 1

New User


Joined: 12 Dec 2005
Posts: 31
Location: bangalore

PostPosted: Wed Mar 03, 2010 6:55 pm    Post subject: Clarification required
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Mar 03, 2010 7:00 pm    Post subject:
Reply with quote

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
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 662
Location: Pennsylvania

PostPosted: Wed Mar 03, 2010 7:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Wed Mar 03, 2010 7:27 pm    Post subject:
Reply with quote

It would be like this in our shop,

Code:
//CG25EXEC EXEC PGM=purecobol   
//SYSCAFIP DD *                 
DB2D planname                   
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 3 Mon May 29, 2017 8:10 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts QUESTION: RETURN CHANNEL pahiker CA Products 21 Thu Apr 20, 2017 12:31 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts The Last Two Question For You To Ask ... CaptBill Mainframe Interview Questions 0 Fri Apr 14, 2017 5:42 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us