× 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 agree on the need to consider rather or not this was a previous undetected
bug.

However, if it turns out that it is, I don't think simply correcting the if
via a free-format statement with parentheses is the best way to fix it.

Instead, consider moving the if statement to it's own appropriately named
procedure. It may seem silly at first glance to have what amounts to a
single line procedure:
d DescriptionOfBusinessCondition...
d pi n
d inTTBAST const like(TTBAST)
d inTTA9CD const like(TTA9CD)
/free
return ( (inTTBAST = 'D' and ( inTTA9CD = '001'
or inTTA9CD = '002'
or inTTA9CD = '003'
or inTTA9CD = '012'
or inTTA9CD = '013'
)

or ( inTTBAST = 'H' and inTTA9CD = ' ')
);
/end-free

But from a maintenance standpoint, it makes life much easier.

You might even consider putting the test of TTA9CD in
('001','002','003','012','013') in it's own appropriately named procedure.

Then you'd be starting on the path to have modularized and reusable business
logic.

Charles


On Mon, Nov 10, 2008 at 3:41 PM, Douglas Handy <dhandy@xxxxxxxxx> wrote:


the free form converter does not change things much - does not add
parentheses - and/or precedence still controls it - and we are still
left with Joe's observation - this is a do-nothing condition, it seems.


While I agree Joe's observation means his simple one-liner performs the
equivalent function of the existing code, the fact they tried to setup the
IF construct makes me suspect the code isn't working as originally
intended. So Joe's simplified version may just be maintaining a previously
undetected bug.

If I saw something like that in code, before simplifying to Joe's method I
think it would be prudent to try to find out what the various fields and
codes mean and whether a (different and corrected) form of the IF statment
should be implemented. Using free form and parentheses around each AND set
and new lines for each OR condition can make the corrected code much easier
to follow.

Long live free format. :)

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

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.