Eric,
What I am looking for is a method to test conditions in a field I have already read from the file (or screen).
Basically a shortcut method using SQL instead of multiple and/or conditions in an IF statement.
ie: Test field Order_Line_Code for values 'MS', M1',MO','LS' ....
In SQL, I can just list the values to test using the IN condition, but in RPG I would have to test each value separately.
I do not know if this can be done, but figured that if it could, than this list was the place to find out.
Thanks,
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3
----- Original Message ----
From: "DeLong, Eric" <EDeLong@xxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Sent: Monday, February 4, 2008 11:33:48 AM
Subject: RE: SQL Question
Coudn't you just use a CASE statement?
Select key, d1, d2,
case when d3 in ('a', 'b', 'c')
then '1' else '0' end as Ind_Flag
From abcdata
hth,
Eric
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of Jeff Young
Sent: Monday, February 04, 2008 10:24 AM
To: midrange-l@xxxxxxxxxxxx; rpg400-l@xxxxxxxxxxxx
Subject: SQL Question
Using SQL, is there any way to test a variable for a value and return an indicator flag?
What I would like to do is to be able to use the SQL BIF's to test a variable for a list of values and then return a '1' or '0' (on/off) to the program.
Thanks,
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3
As an Amazon Associate we earn from qualifying purchases.