Why not use '=" instead of "IN" since you are checking only a single value?
Regards,
Vivek G _________________ Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
where type in (:ws1 , :ws2 , :ws3 , :ws4 , :ws5 , :ws6 , :ws7)
(actually 50 parameters)
The DB2-guru on site told me that it was safe, because db2 will compress/distinct all the double's found in the "IN" before accessing the data. So effectively I threw this to the database
Code:
where type in ('x','y','z','x','x','x','x')
but DB2 would look-up value 'x' only once.
I still wonder if that DB2-guru knew what he was talking about..... Can anyone acknowledge or did I create a monster ?
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Wed Aug 29, 2007 4:10 am Post subject:
kbn,
you can try this:
Code:
01 WS-TYPE.
05 WS-TYP-1 PIC X(01) VALUE 'X'.
05 WS-TYP-2 PIC X(01) VALUE 'Y'.
05 WS-TYP-3 PIC X(01) VALUE 'Z'.
SELECT TYPE, NUMBER, NAME
FROM A
WHERE TYPE IN (:WS-TYPE)
assuming TYPE is 1 char.
But since this seems to be rather static (values for desired TYPE are always the same), would suggest that you form the IN list in the SQL as TYPE IN ('X','Y','Z') _________________ Dick Brenholtz
American living in Varel, Germany
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Wed Aug 29, 2007 7:59 am Post subject:
vivek1983,
well, first of all an 88 level does not contain a Picture clause, only level nbr, reference name and value. Even if you had generated the correct data definitions, you need a SET statement to populate WS-TYPE with something.
2nd, I interpreted
Quote:
I have types in WS-TYPE which has the value 'X', 'Y', 'Z'
to mean that the OP had an IN list containing three values: X, Y and Z.
If I misinterpreted the OP's question, then I provided info when it was not needed. _________________ Dick Brenholtz
American living in Varel, Germany
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