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 

Set table qualifier for COBOL program with static SQL

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


Joined: 19 Sep 2004
Posts: 14
Topics: 11
Location: Dallas, TX

PostPosted: Wed Nov 03, 2004 9:18 pm    Post subject: Set table qualifier for COBOL program with static SQL Reply with quote

I have attempted to use the SET CURRENT SQLID to set the qualifier for an SQL statement in a COBOL program. I realize I can use Dynamic SQL and the PREPARE command to make it happen, but I was hoping for simpler way. I have over 300 identical databases (qualifiers). Is there any way to do it or am I just dreaming? Thanks in advance.

Example:

EXEC SQL
SET CURRENT SQLID = :VARNAME
END-EXEC

EXEC SQL
INSERT .... INTO TABLE_NAME
...
END-EXEC

The set works but the insert fails with unqualified table name.
Back to top
View user's profile Send private message
CZerfas
Intermediate


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Thu Nov 04, 2004 3:29 am    Post subject: Reply with quote

The qualifier used in a static sql statement is fixed during bind processing of the associated package. Issuing the bind statement you can define the qualifier via the QUALIFIER() parameter.
To have the freedom of choosing between different qualifiers during processing, you can achieve that with the following method:
1. You bind all of the packages of your application with the same QUALIFIER-setting into one collection, which is associated to that qualifier. For addressing 100 different qualifiers, you have to bind your packages into 100 different collections.
2. The plan you use has all these 100 collections in it's collection list (PKLIST(collid-1.*, collid-2.*, ...)).
3. During execution you swith between these collections with SET CURRENT PACKAGESET = 'collid-n'.

regards
Christian
Back to top
View user's profile Send private message
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