× 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: Open Source discussion on error handling was: RPGIII/RPG400 ERROR MONITORING
  • From: "Pravin" <rjenterprises@xxxxxxxxxxxxxx>
  • Date: Tue, 8 Feb 2000 17:01:06 -0000


-----Original Message-----
From: Buck Calabro <buck.calabro@aptissoftware.com>
To: RPG400-L@midrange.com <RPG400-L@midrange.com>
Date: 08 February 2000 16:31
Subject: Open Source discussion on error handling was: RPGIII/RPG400 ERROR
MONITORING


>Oludare wrote:
>
>>How do one monitor ERROR MESSAGES within an RPG
>>progam?  e.g. If program stratus is 00907= decimal-data
>>error in field.  How do one continue processing and
>>ignoring the message.
>
>Leslie's link to the *PSSR chapter of the RPG manual is a great place to
>start looking!  After you've viewed the chapter on error handling, you'll
be
>ready to deal with some of the practical issues that surround the use of
>*PSSR to trap errors.  In fact, this is probably a really good place to
>start an "open source" discussion on the merits of the various ways to trap
>and handle errors within RPG programs.
>
>You specifically asked about error handling in RPG III; alas my "boiler
>plate example" is in RPG IV.  It doesn't really matter because it is a
>simple conversion from RPG III.  I'll post it here and invite active
>discussion on the pros and cons of why this code came about and how to make
>it better.  When we're all done, perhaps we'll have an open source routine
>that Leslie can post on his site.  If there's no discussion, I guess we'll
>know why Open Source RPG doesn't work...
>
>     H Debug
>
>      * Sample code to demonstrate use of *PSSR directing
>      * traffic after an error occurs
>
>      * Global declarations
>     D ErrFlag         S              1    Inz('N')
>     D ErrAction       S              6    Inz('*DETC ')
>     D CurrRoutine     S             10    Inz
>
>      * Test numbers
>     D POSITIVE        S              5S 0 Inz(15)
>     D NEGATIVE        S              5S 0 Inz(-15)
>     D ZERO            S              5S 0 Inz(0)
>     D PI              S             10S 9 Inz(3.141592654)
>     D Result          S              3S 0 Inz(0)
>
>      * Routine names describe where we are in the program
>      * When an error occurs, we can steer ourselves
>      * back to the appropriate place in the program
>     D RTNADD          S             10    Inz('Add       ')
>     D RTNSUB          S             10    Inz('Sub       ')
>     D RTNMUL          S             10    Inz('Mul       ')
>     D RTNDIV          S             10    Inz('Div       ')
>
>     D                SDS
>     D  PGNAME           *PROC
>     D  STATUS           *STATUS
>     D  TMNAME               244    253
>     D  USRNAM               254    263
>     D  JOBNBR               264    269  0
>
>      * Mainline.  This is just simple code to demonstrate
>      * how we can direct traffic after an error occurs
>      * The *PSSR traps the error, gets control and then
>      * returns to this point in the program.
>      *    *DETC         Tag
>
>      * Did an error occur?  If so, recover!
>      * For example's sake, only test/recover from an error
>      * in the division routine
>      * A huge disadvantage to this style of error recovery is that
>      * the "error handler" needs to know the internals of the
>      * failing routine.  Here, we're setting Result to 0: we need
>      * to know that the RTNDIV routine is doing a divide, that it
>      * returns Result and that the "proper" recovery is to set
>      * Result to 0.
>
>     C                   If        ErrFlag='Y'
>     C                   Eval      ErrFlag='N'
>
>     C                   Select
>
>     C                   When      CurrRoutine = RTNDIV
>     C                   Eval      Result=0
>     C                   GoTo      PastDiv
>
>     C                   Other
>     C                   Dump
>
>     C                   EndSl
>     C                   EndIf
>
>      * Program processing occurs here
>     C     Add           Tag
>     C                   Eval      CurrRoutine=RTNADD
>     C                   Eval      Result=ZERO+1
>
>     C     Sub           Tag
>     C                   Eval      CurrRoutine=RTNSUB
>     C                   Eval      Result=ZERO-1
>
>     C     Mul           Tag
>     C                   Eval      CurrRoutine=RTNMUL
>     C                   Eval      Result=ZERO*1
>
>     C     Div           Tag
>     C                   Eval      CurrRoutine=RTNDIV
>     C                   Eval      Result=PI/ZERO
>     C     PastDiv       Tag
>
>     C                   Eval      *InLR=*On
>
>      * An error has occurred
>      * Set the "Error is happening" flag and return to the mainline
>      * We could also take recovery actions here as well as setting the
flag
>      * but that would entail duplicating the "traffic cop" code somewhat.
>     C     *PSSR         BegSR
>     C                   Eval      ErrFlag='Y'
>     C                   EndSR     ErrAction
>
>Buck
>(thinking positive instead of ranting for a change)
>+---
>| This is the RPG/400 Mailing List!
>| To submit a new message, send your mail to RPG400-L@midrange.com.
>| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
>| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
>| Questions should be directed to the list owner/operator:
david@midrange.com
>+---
>

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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.