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


  • Subject: Re: Structured RPG ?
  • From: Hans Boldt <boldt@xxxxxxxxxx>
  • Date: Tue, 28 Apr 1998 08:55:13 -0400

John Carr wrote:
>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?

Hi John!  While I don't think anyone here would
argue against what you're saying, I'd like to take
your example one step further (at the risk of being
picky).  Here's what I'd prefer:
--------------------------------------------------
C                   IF            Amt_Due > 0
C                             AND Payment > 0
C                             AND Chk_Amt > 0
C                   CALLP     Do_Payment (Transaction:
C                                Amt_Due: Payment:
C                                Chk_Amt)
C                   ENDIF
--------------------------------------------------
1st, the code as originally written won't compile.

2nd, I know the rationale for explicitly specifying
(unnecessary (redundant)) parentheses, but in most
cases, IMHO, it doesn't really add much value.  I
remember when Pascal was the "in" thing.  Pascal's
precedence rules meant that you always had to code
parentheses for any condition with more than one
sub-expression.  But languages like C and RPG have
more sensible precedence rules which mean that an
expression can be coded naturally without parens in
most situations.

3rd, using parameterized procedures has to be
preferable to old-style subroutines.

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.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 thread ...


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.