|
As the man with the short leg said after surgery, I stand corrected. > -----Original Message----- > From: rob@dekko.com [SMTP:rob@dekko.com] > Sent: Monday, November 04, 2002 1:23 PM > To: rpg400-l@midrange.com > Subject: RE: On-Error > > This is a multipart message in MIME format. > -- > [ Picked text/plain from multipart/alternative ] > On-Error, and Monitor, is new with V5. > > Your %status is a good example of what it can do. What it can do versus > the %status is it can check after every operation, like the following: > Monitor; > a=b/c; > On-Error DivideByZero; > ... > EndMon; > > Rob Berendt > -- > "They that can give up essential liberty to obtain a little temporary > safety deserve neither liberty nor safety." > Benjamin Franklin > > > > > "Johnson, Duane" <djohnson@POWERMATE.com> > Sent by: rpg400-l-admin@midrange.com > 11/04/2002 02:16 PM > Please respond to rpg400-l > > To: "'rpg400-l@midrange.com'" <rpg400-l@midrange.com> > cc: > Fax to: > Subject: RE: On-Error > > > Rob, > To the best of my knowledge (which means that I could very likely be > wrong) there is no On-Error function in any of the various forms of RPG. > The manual does, however, have this information, and it might be what > you're looking for. > (note: for some reason I couldn't cut and paste properly from the > internet, so I retyped this. i.e. there could be misspellings and/or > other > errors) > Duane > > * The "E" extender indicates that if an error occurs, the error > * is to be handled as though an error indicator were coded. > * The success of the operation can then be checked using the > * %ERROR built-in function. The status associated with the error > * can be checked using the %STATUS built-in function. > /FREE > exfmt(e) InFile; > if %error; > exsr CheckError; > endif; > //------------------------------------ > //CheckError: Subroutine to process a file I/O error > //------------------------------------ > begsr CheckError; > select; > when %status, 01000; > // No error occurred > when %status = 01211; > // Attempted to read a file that was not open > exsr InternalError; > when %status = 01331; > // The wait time was exceeded for a READ operation > exsr TimeOut; > when %status = 01261; > // Operation to unacquired device > exsr DeviceError; > when %status = 01251; > // Permanent I/O error > exsr PermError; > other; > // Some other error occurred > exsr FileError; > endsl; > endsr; > /END-FREE > > > -----Original Message----- > > From: rob@dekko.com [SMTP:rob@dekko.com] > > Sent: Monday, November 04, 2002 12:22 PM > > To: rpg400-l@midrange.com > > Subject: On-Error > > > > This is a multipart message in MIME format. > > -- > > [ Picked text/plain from multipart/alternative ] > > Is it possible to do the following: > > D NoError C 0 > > D RecordNotFound C 12 > > D FileIsClosed C 1211 > > /free > > Monitor; > > Chain mykey myfile; > > On-Error NoError; > > // perform normal processing > > ... > > On-Error RecordNotFound; > > // perform new record processing > > ... > > On-Error FileIsClosed; > > // Oops, forgot to open file > > ... > > ... > > EndMon; > > > > Or will NoError not activate since it is not an error? > > > > I know that most people assume that if a Chain fails that it is because > > the record is not found, but I like to do more error trapping. This > > especially comes into play when you do updates and deletes and you have > > Referential Integrity defined on your files. > > > > Rob Berendt > > -- > > "They that can give up essential liberty to obtain a little temporary > > safety deserve neither liberty nor safety." > > Benjamin Franklin > > _______________________________________________ > > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing > list > > To post a message email: RPG400-L@midrange.com > > To subscribe, unsubscribe, or change list options, > > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > > or email: RPG400-L-request@midrange.com > > Before posting, please take a moment to review the archives > > at http://archive.midrange.com/rpg400-l. > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > 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 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.