I need to use dynamic SQL in my COBOL program. Environment is DB2 / COBOL 370.
I need to build the actual select statement for the cursor, including a term "LOCATION IN ('xxx', 'xxx',...)
where I'll be getting a random (but small) number of
xxx's at run time. I now have a kludgey set up with
(LOCATION = :WS-XXX-1 OR
LOCATION = :WS-XXX-2 OR
LOCATION = :WS-XXX-3 OR
LOCATION = :WS-XXX-4 OR
LOCATION = :WS-XXX-5 )
which looks dopey and has to be increased when I
need to handle 6 or 7 locations...
I know there is a way to do this, but I can't find any
examples to steal (my favorite way of coding).
If I have to build a work area for the dynamic SQL, how
do I estimate its size?
(I posted this originally in the COBOL Forum, & was advised to try here also...)
Thanks much,
-Dun<TD /
I need to build the actual select statement for the cursor, including a term "LOCATION IN ('xxx', 'xxx',...)
where I'll be getting a random (but small) number of
xxx's at run time. I now have a kludgey set up with
(LOCATION = :WS-XXX-1 OR
LOCATION = :WS-XXX-2 OR
LOCATION = :WS-XXX-3 OR
LOCATION = :WS-XXX-4 OR
LOCATION = :WS-XXX-5 )
which looks dopey and has to be increased when I
need to handle 6 or 7 locations...
I know there is a way to do this, but I can't find any
examples to steal (my favorite way of coding).
If I have to build a work area for the dynamic SQL, how
do I estimate its size?
(I posted this originally in the COBOL Forum, & was advised to try here also...)
Thanks much,
-Dun<TD /