MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

C - DB2 Program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vani
Beginner


Joined: 28 May 2003
Posts: 51
Topics: 30

PostPosted: Mon Nov 10, 2003 9:31 am    Post subject: C - DB2 Program Reply with quote

Hi,

There is a C DB2 program wherein I am using the objects created for a particuler database. As I haved hard coded the qualifier, I want it to be dynamcally done through JCLs. So how to pass parmeters through JCLS and what changes to be done in The program,


for ex: in the application

INSERT INTO aaaa.table1 (SELECT * from bbbb.table1);

So want it to be
INSERT INTO &creator.table1 (SELECT * &creator.table1);
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Nov 10, 2003 10:13 am    Post subject: Reply with quote

vani,

You need a dynamic sql instead of a static sql. The performance might be poor since you are using select *.

Change your program to use DYNAMIC SQl and it will solve your problem

The other alternative is to code all the SQL'S with all the possible combinations and in the program read in a parm and decide as to which sql needs to execueted.

ex:
Code:

10000-INSERT-TABLEA
 
   EXEC SQL
        INSERT INTO aaaa.table1 (SELECT * from bbbb.table1)
  END-EXEC

20000-INSERT-TABLEB
 
   EXEC SQL
        INSERT INTO BBBB.table1 (SELECT * from CCCC.table2)
  END-EXEC

.....

80000-INSERT-TABLEN
 
   EXEC SQL
        INSERT INTO MMMM.table1 (SELECT * from NNNN.tableN)
  END-EXEC



Then read in parm which passes the table name to be inserted.
Code:

  EVALUATE PARM
           WHEN 'AAAA'
                PERFORM 10000-INSERT-TABLEA
           WHEN 'BBBB'
                PERFORM 20000-INSERT-TABLEB
           ....
  END-EVALUATE
 


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sri_naveen
Beginner


Joined: 29 Oct 2003
Posts: 10
Topics: 0
Location: Indore, India

PostPosted: Mon Nov 10, 2003 11:35 pm    Post subject: Reply with quote

Vani..
The db2 code embedded in the host language is the middle tier...if you need to directly pass the parameters using JCL .. there is a DD parameter option to attach objects created in a HLL...... thats how you actually accomplish runtime binding...
_________________
Regards,
Naveen Srinivasan
Computer Sciences Corporation

--To err is human, to err again is more human--
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group