× 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.



I understand what you are saying.  Those who do not, might have suggested:

Except detail;
Select;
   When A=5;
      // take action 
   When A=7;
      // take different action
    When A=8;
      // take different action
EndSL;

Perhaps a better example is:
Select;
   When A=5;
      // take action 
   When A=7;
      // take different action
   When A=8;
      // take different action
   Either way;
     Except detail;
   When A=6;
      // take 6 unique action
   When A=9;
      // take 9 unique action
   Either way;
     Except Hark; 
EndSL;

Currently this is handled by nesting select's and if's.  And it's not the 
prettiest thing.  The purest might suggest taking any breakdown into 
separate subprocedures.  Thus:
Select;
  When A=5 or A=7 or A=8;
    Select;
      When A=5;
        // take action
      When A=7;
        // take different action
      When A=9;
        // take different action
    EndSl;
    Except detail;
  When A=6 or A=9;
    Select;
      When A=6;
        // take 6 unique action
      When A=9;
        // take 9 unique action
    EndSl;
  Except Hark;
EndSl;

Becomes:

Select;
  When A=5 or A=7 or A=8;
    A567Sub(); // will have it's own separate select for 5 or 7 or 8
  When A=6 or A=9;
    A69Sub(); // will have it's own separate select for 6 or 9
EndSl;
 

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





Tony Carolla <carolla@xxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
12/30/2004 11:18 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Re: Select/When vs. If/ElseIf






Personally, I use If/Else/EndIf if there are only two possibilities,
and I only use the Else if there is something to do either way.  For
all other situations, I use Select/When/Other.  If I revise a program,
and there is an If/Else/EndIf that now has another possiblilty, I
replace it with Select/When/Other.  I don't make use of the ElseIf
clause.

But this brings up another idea I had.  Occasionally, I will encounter
a set of conditions that may or may not be true, and for each
condition, a different action must be taken, but if any one of the
conditions in the set are true, I want to do something in addition to
the different tasks for each one in the set.  ex.:

Select;
   When A=5;
      // take action 
       Except detail
   When A=7;
      // take different action
       Except detail;
    When A=8;
      // take different action
       Except detail;
EndSL;

In this snippet, I want to print the 'detail' exception format if A=5,
7 or 8, but not otherwise.  Wouldn't it be nice to have an 'EitherWay'
op, which was executed if any of the when clauses were true?  i.e.

Select;
   When A=5;
      // take action 
   When A=7;
      // take different action
    When A=8;
      // take different action
     EitherWay;
       Except detail;
EndSL;

Wacky idea?  What do you think?

On Wed, 29 Dec 2004 16:12:51 -0600, Kurt Anderson
<kjanderson@xxxxxxxxxxxxx> wrote:
> Is there a difference to these two types of condition checking?
> They seem identical in function at a high level, so I'm unsure if one is
> better performance-wise or something.  I guess I'm looking for something
> to distinguish the two so I know when to use one and when to use the
> other.
> 
> Thanks,
> 
> Kurt Anderson
> Application Developer
> Highsmith Inc.
> W5527 State Road 106, P.O. Box 800
> Fort Atkinson, WI 53538-0800
> TEL (920) 563-9571  FAX (920) 563-7395
> EMAIL kjanderson@xxxxxxxxxxxxx
> 
> --
> 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.
> 
> 


-- 
"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.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.