|
Amt_Due IFGT 0
Payment ANDGT 0
Chk_Amt ANDGT 0
EXSR Do_Payment
Endif
Endif
Endif
IMHO,
The above code is the most straight forward of the examples. The use of
descriptive
variables names allows the programmer maintaining this code to get a quick
read
on what the code doing. The placement of these names in factor 1 help
because
it is the first thing you see (reading L to R).
Also, in the other example, the use of "+" as a logical operator is less
intuitive
then ANDGT.
Dave
----------
> From: John Carr <74711.77@compuserve.com>
> To: Midrange-L <MIDRANGE-L@midrange.com>
> Subject: Structured RPG ? - Was ITER/LEAVE
> Date: Tuesday, April 28, 1998 12:00 AM
>
>
> Was - ILE RPG:Is the use of ITER & LEAVE Structured Programming?
>
>
> >Booth said
> >or,
> > C 01 02 03 EXSR SR001
> >
> >Can left side indicators be all wrong? I know, I know. I won't use
them,
> >but really, what is unclear about that line of code?
> >
>
> >> at 10:45 PM, Neil Palmer <npalmer@NxTrend.com> said:
> >>
> >>Or:
> >> *IN01 IFEQ '0'
> >> *IN02 ANDEQ '1'
> >> *IN03 ANDEQ '0'
> >> ....
> >> code
> >> ....
> >> ENDIF
> >>
>
> Hi all
> I think these are both examples of "What would you do if you were in
> a dark alley, in a bad section of town, and ....."
>
> There is no good answer. You have to look back upstream for the answer.
> Why do you have three Indicators defining some condition as variable
> flags. The structure and read-ability has already been compromised.
>
> Can either one of the above provide lucidity on whats going on there??
> Is there more information about the decision being made than is being
> shown?
>
> Curious, Which one of these is more readable?? Whats everyones opinion?
>
> -----------------------------------------
> Amt_Due IFGT 0
> Payment ANDGT 0
> Chk_Amt ANDGT 0
> EXSR Do_Payment
>
> Endif
> Endif
> Endif
>
> or this --------------------------------------------------
>
> IF ((Amt_Due >0) + (Payment >0) +
> (Chk_Amt >0))
>
> EXSR Do_Payment
> Endif
>
> With writing it one of these ways, Not only do you know that something
> will be done if these three conditions are true, BUT you also know this
> is most likely dealing with money and something to do with payments.
>
> These add tremendous leveraging power to the Maintenance/Enhancement
> capability of your staff as well as the application base.
>
> Things won't break as often from a mis-diagnosis of the problem and have
> the fix break more than the fix.
>
> Just Curious. Which of the 4, people like better?
>
> John Carr
>
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
david@midrange.com
> +---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.