|
I think you could eliminate the "else" C STATE IFne 'OREGON' C STATE andne 'WASHINGTON" C STAET andne 'IDAHO' C MOVE '0' NWSTATE ENDIf I don't know that it makes the code any prettier. I think the 'OR's are a good demonstration of how if statments work. I have to admit I've used an empty select statement as a nicer looking goto. select; when cond_a asdf(); when cond_b; jlljas(); when cond_c; when cond d; zxc(); endsl; My programming teachers in junior college were all high school math teachers who couldn't take high school students any more. They thought it was great that compulsory education didn't apply to junior college. One of them told us "There are three things you need to know about logic to do programming: The truth table for and, the truth table for or, and DeMorgan's law." I found out later that she skipped the truth table for xor, but not all languages support it. I haven't needed anything else. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bob Cozzi Sent: Friday, March 11, 2005 3:11 PM To: 'RPG programming on the AS400 / iSeries' Subject: RE: Convert QUERY record select to RPG I used to use the following example in my RPG IV classes back when OS/400 V3R1 was about to ship: RPG III Style: C STATE IFEQ 'OREGON' C STATE OREQ 'WASHINGTON" C STAET OREQ 'IDAHO' C ELSE C MOVE '0' NWSTATE C ENDIF In RPG IV you'd can simply code the word "NOT" in front of the conditional expression and avoid the ELSE statement altogether. -Bob Cozzi www.RPGxTools.com If everything is under control, you are going too slow. - Mario Andretti -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Tony Carolla Sent: Friday, March 11, 2005 4:58 PM To: RPG programming on the AS400 / iSeries Subject: Re: Convert QUERY record select to RPG <snip> > The idea is to select all of the records you don't want with the if > statement, then immediately have an Else line. It simplifies many filters. > > For instance, an if statement listing all of the States excepting > Oregon could as easily be an if Oregon, Else. </snip> Why not simply use If Not Oregon; // Stuff; EndIf; ??? -- "Enter any 11-digit prime number to continue..." -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. ***************************** NOTICE: All e-mail sent to or from this e-mail address will be received or otherwise recorded by The Sharper Image corporate e-mail system and is subject to archival, monitoring, and review by and/or disclosure to Sharper Image security and other management. This message is intended only for the use of the addressee and may contain information that is privileged and confidential. The contents of this message may contain personal views which are not the views of The Sharper Image. If you are not the intended recipient, dissemination of this communication is prohibited. *****************************
As an Amazon Associate we earn from qualifying purchases.
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.