View previous topic :: View next topic |
Author |
Message |
shootingstar Beginner
Joined: 19 Sep 2004 Posts: 14 Topics: 11 Location: Dallas, TX
|
Posted: Wed Nov 03, 2004 9:18 pm Post subject: Set table qualifier for COBOL program with static SQL |
|
|
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 |
|
 |
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Thu Nov 04, 2004 3:29 am Post subject: |
|
|
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 |
|
 |
|
|