DYNAMIC SQL MVS DB2 V6 DYNAMIC WHERE 
Author Message
 DYNAMIC SQL MVS DB2 V6 DYNAMIC WHERE

Hi
I am constructing a Dynamic SQL in a COBOL program.

The intend of the dynamic SQL is for the reason the WHERE clause is
derived dynamically.

I have anywhere between 3 to 15 columns in the WHERE clause.  All the
columns to be used in the WHERE clause are dynamically derived.
The columns to be used in the WHERE clause is stored in a VSAM file.

Since I cannot use Host variables in the WHERE clause, I have to
achieve this in the COBOL program using the USING HOST VARIABLE clause
in the OPEN Cursor statement.  Since the number of columns to be used
in the USING clause is determined only at the run time, how do I
define the Host Variables in the USING Clause in my COBOL programs.

Any example of the above would greatly help me.

Can some one help please....

Thanks a million for the help.

Ivar



Tue, 24 May 2005 02:22:16 GMT
 DYNAMIC SQL MVS DB2 V6 DYNAMIC WHERE

Any help would be greatly appreciated....


Quote:
> Hi
> I am constructing a Dynamic SQL in a COBOL program.

> The intend of the dynamic SQL is for the reason the WHERE clause is
> derived dynamically.

> I have anywhere between 3 to 15 columns in the WHERE clause.  All the
> columns to be used in the WHERE clause are dynamically derived.
> The columns to be used in the WHERE clause is stored in a VSAM file.

> Since I cannot use Host variables in the WHERE clause, I have to
> achieve this in the COBOL program using the USING HOST VARIABLE clause
> in the OPEN Cursor statement.  Since the number of columns to be used
> in the USING clause is determined only at the run time, how do I
> define the Host Variables in the USING Clause in my COBOL programs.

> Any example of the above would greatly help me.

> Can some one help please....

> Thanks a million for the help.

> Ivar



Wed, 25 May 2005 22:57:28 GMT
 DYNAMIC SQL MVS DB2 V6 DYNAMIC WHERE
If you are building the WHERE clause dynamically, why do you have to
use host variables? Can't you just build the entire SQL statement with
the values embedded in the string.

Example:

build the string "select x, y, z from some_table where a = 'abc' and b

Quote:
> 2 and c < 'something'"

and use EXEC SQL PREPARE to prepare the statement.

Lorne



Quote:
> Any help would be greatly appreciated....


> > Hi
> > I am constructing a Dynamic SQL in a COBOL program.

> > The intend of the dynamic SQL is for the reason the WHERE clause is
> > derived dynamically.

> > I have anywhere between 3 to 15 columns in the WHERE clause.  All the
> > columns to be used in the WHERE clause are dynamically derived.
> > The columns to be used in the WHERE clause is stored in a VSAM file.

> > Since I cannot use Host variables in the WHERE clause, I have to
> > achieve this in the COBOL program using the USING HOST VARIABLE clause
> > in the OPEN Cursor statement.  Since the number of columns to be used
> > in the USING clause is determined only at the run time, how do I
> > define the Host Variables in the USING Clause in my COBOL programs.

> > Any example of the above would greatly help me.

> > Can some one help please....

> > Thanks a million for the help.

> > Ivar

--
Lorne Sunley


Wed, 25 May 2005 23:51:31 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. DB2/MVS access slow because of dynamic statements

2. DB2/MVS access slow because of dynamic statements

3. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

4. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

5. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

6. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

7. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

8. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

9. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

10. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

11. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS

12. 18727-MS-Jackson-DB2-COBOL-C++-MVS-ORACLE-Programmers(6) MVS COBOL DB2 CICS


 
Powered by phpBB® Forum Software