• Subject: Re: Eval Exception Error Trapping
  • From: John Hall <jhall@xxxxxxxxxxx>
  • Date: Tue, 27 Jul 1999 10:30:30 -0400



Joep Beckeringh wrote:
...snip... 
> In those situations where we know an error might occur, but preventing it
> would be impractical.
> For instance:
> - Chances of data base errors are growing, with the expanding possibilities
> of putting constraints in the data base.  Especially when adding constraints
> to an existing data base, it is good to know that existing programs won't
> bomb, when they violate a rule that was not known when they were created.
> - The infamous overflow.  In commercial applications it is not very
> practical to make amount fields big enough to accommodate for the largest
> number times the highest price (would make printing invoices very
> interesting :-).  That leads to code like:
> CF  IF number * price <= Maximum_Value
> CF     EVAL amount = number * price
> CF  ELSE
> CF     signal the error to the user
> CF  ENDIF
> (assuming we have CF-specs, that is).
> 
> Joep Beckeringh
> 

I agree.  We are being told that all business rules should be in the
database and not in our applications.  This means we need to rely on the
database to generate the error and RPG to handle it.
The error handling needs to be designed to allow programmers to easily
take advantage of this.  Yes I know you can do it now through *PSSR but
what percentage of programs in use today actually use it ??  I know I
inherited several thousand which never even heard of it.

OS400 has fantastic message handling compared to some other operating
systems which rely on each program to create it's own log files to
record exceptions and this has made it possible to have programs with
little or no error trapping and just rely on the operating system to
handle it.  

The monitor statements also need to have the capability of being nested.

CF      Monitor
Cf         Read SCREEN1
CF         Monitor
CF             Amount = price/per * qty
CF         on-error
CF            Monitor
CF               Amount = price * qty
CF            on-error
CF               Amount = 0
CF            endmo
CF         endMon
CF         Update PurchOrd
CF      on-error
CF         write SCreenErr
CF      endmon

note: the above code is intended as as example only and does not
necessarily represent any logical way of doing anything useful.

John Hall
Home Sales Co.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].