View previous topic :: View next topic |
Author |
Message |
vani Beginner
Joined: 28 May 2003 Posts: 51 Topics: 30
|
Posted: Mon Nov 10, 2003 9:31 am Post subject: C - DB2 Program |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Mon Nov 10, 2003 10:13 am Post subject: |
|
|
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 |
|
|
sri_naveen Beginner
Joined: 29 Oct 2003 Posts: 10 Topics: 0 Location: Indore, India
|
Posted: Mon Nov 10, 2003 11:35 pm Post subject: |
|
|
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 |
|
|
|
|