× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Brigitta,
Your method is even simpler than all of the others.
I had originaly thought of using the Set function, but could'nt get by head around how to make it work the way I wanted.

Thanks again to all who responded.

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: BirgittaHauser <Hauser@xxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Sent: Monday, February 4, 2008 12:16:40 PM
Subject: AW: SQL Question

Hi,

Just use SQL in RPG:

Exec SQL Set :Flag = Case When :MyFld in ('MS', 'M1', 'M2', ... 'LS')
Then '1'
Else '0'
End;

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Jeff Young
Gesendet: Monday, February 04, 2008 18:05
An: Midrange Systems Technical Discussion
Betreff: Re: SQL Question


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.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.