View previous topic :: View next topic
|
Author |
Message |
Ramanan-R
New User
Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Hello All,
Is it possible to use a host variable with dynamic values moved to it?
I tried moving values embedded within quotes and separated by commas but it doesn't seem to work.
Any help is much appreciated...
Thanks! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You can put any value you want into a host variable - as long as it is a compatible data type. Possibly i misunderstand the question.
Quote: |
I tried moving values embedded within quotes and separated by commas but it doesn't seem to work. |
Posting "it didn't work" is probably the biggest waste of forum time and space. . .
What did you code (post the code)?. What happened (abend, unexpected results, other)? We can only use what you provide to help you. |
|
Back to top |
|
|
Ramanan-R
New User
Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Dick,
Code: |
SELECT A.FIELD1
,A.FIELD2
,A.FIELD3
,B.FIELD1
FROM TBLB B
,TBLA A
WHERE B.FIELD1 = 'ABC'
AND B.FIELD2 = 'D888888888'
AND A.FIELD1 = B.FIELD1
AND A.FIELD2 = B.FIELD2
AND A.FIELD3 IN ('AAA', 'BBB', 'CCC', 'DDD', 'EEE', 'FFF') |
The values, 'AAA', 'BBB', 'CCC', 'DDD', 'EEE', 'FFF' are needs to be dynamically added but there will be atleast one value...
I tried declaring a host variable and concatenated these dynamically added values using COBOL String function but when fetching the cursor, it returns nothing.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Thanks for using the Code tag
What is the sqlcode of the problem run?
You need to post the code that actually encountered the problem. . . I suspect this is not it.
What happens when you run the code you've posted? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Where is this query running?
Is it from a COBOL program, by any chance? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
if you have max 5 values you could do it this way.
If only 1 value is needed, you can move the same value to all 5 work-fields.
Code: |
01 ws-invalues.
03 ws-val1 pic x(3).
03 ws-val2 pic x(3).
03 ws-val3 pic x(3).
03 ws-val4 pic x(3).
03 ws-val5 pic x(3).
01 -ws-invaltab redefines ws-invalues.
03 ws-val pic x(3) occurs 5.
...
WHERE A.FIELD3 IN (:ws-invalues)
... |
|
|
Back to top |
|
|
|