Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB2 Tech Question

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Environment - DB2 OS/390. IMS-DC & COBOL.
I am looking for alternative to Dynamic SQL feature.Can any one explain or provide some info how to accomplish this.I have two tables - WorkTBL and BaseTBL.
Note - the copylibs for these tables are identical but has different table names. Nightly batch jobs updates BaseTBL with days worth of data from WorkTBL. We want our online inquiry systems to read WorkTBL or BaseTBL based on an input entered on the screen which will determine set the criteria whether to read the WorkTBLor BaseTBL.
Now my question is, how do I code single sql statement to
access either table. In other words how to pass the tables names to the sql statements to select/fetch data from the desired table during the runtime instead of coding two separate statements to do the same thing. Please provide samples(code) and reference materials if any available.
TIA. Nexus
 
Hi,
Is it possible (and would it not be easier) to change the online program to access both tables? Two Cursor declares, opens, fetches and closes, but into the same working storage. The program could then interogate the user input and perform the relevant section to obtain the coorect information.
Marc
 
Look up the use of sysnonyms on tables in DB2. I think you may be able to accomplish what you require simply using synonyms.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top