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



In regard to language statements being redundant, that has never bothered
me much. I don't expect perfection in syntax, and I find myself having to
adapt to multiple language environments, with multiple syntax differences.
Again, that may just be me. I'm a lot more concerned with application
architecture, and performance.



On Fri, Jan 25, 2019 at 2:21 PM Mark Waterbury <
mark.s.waterbury@xxxxxxxxxxxxx> wrote:

Mark,
The difference is intentional ...
When you code the form you show below, that generates the equivalent of a
"case" statement in Pascal, or a "switch" in C ... or a FORTRAN computed
GOTO ... whereas, if you code the equivalent with:
if ... elseif ... elseif ... ... else endif
that will always generate that many "tests"... and branches ...

A computed goto usually uses a "branch table" so it has an array of
addresses or labels, and does a "look-up" or index operation into that
array to get the address of where to go, so it is generally much faster
than having to perform all of those tests, especially if there are hundreds
of "cases"...

However, if you code something like:
select when a = b;
... when c = d; ...
etc;
... otherwise; ...
end-sel;

this format will also generate multiple tests and branches, just like the
" if-elseif-elseif-else-endif " scenario.

Hope that helps,
Mark S. Waterbury

On Friday, January 25, 2019, 4:01:55 PM EST, Mark Murphy <
jmarkmurphy@xxxxxxxxx> wrote:

Does anyone else find the redundancy between the select block and the
if-elseif-else block a little disconcerting? Seems to me that there should
be a clear distinction between the two. There never can be at this point,
so I tend to use a relatively inconsistent mix of the two in my code based
on what mood I am in. But the select syntax has a potentially game changing
syntax.

select <variable>;
when <value>;
...
when <value>;
...
when <value>;
...
other;
...
endsl;

This syntax reduces redundancy in a significant amount of code, by
reducing the need to retype code variable names over and over again.
Wouldn't it be nice?
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

-


-

-

-


-


On Friday, January 25, 2019, 4:01:55 PM EST, Mark Murphy <
jmarkmurphy@xxxxxxxxx> wrote:

Does anyone else find the redundancy between the select block and the
if-elseif-else block a little disconcerting? Seems to me that there should
be a clear distinction between the two. There never can be at this point,
so I tend to use a relatively inconsistent mix of the two in my code based
on what mood I am in. But the select syntax has a potentially game changing
syntax.

select <variable>;
when <value>;
...
when <value>;
...
when <value>;
...
other;
...
endsl;

This syntax reduces redundancy in a significant amount of code, by
reducing the need to retype code variable names over and over again.
Wouldn't it be nice?
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


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.