× 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: Error handling
  • From: bmorris@xxxxxxxxxx
  • Date: Fri, 14 Jul 2000 16:01:51 -0400




>Date: Fri, 14 Jul 2000 12:06:40 -0400 (EDT)
>From: keith mcintosh <keith_eh@yahoo.ca>
>
>
>or Using Example 2.
>
> * ...
>D PgmSts         SDS
>D  ErrTyp                40     42
>D  CPFNum                43     46
> * ... the file keithm doesn't exist.
>C             Eval  rc = System('CLRPFM FILE(keithm)')
>
> * ...
>C   *PSSR     BegSR
>C             Eval ErrCPF = ErrTyp + CPFNum
>C   ErrCPF    dsply
>C             EndSR

Keith, the problem with your second method is that if 'system'
fails, there's no exception so your PSSR won't fire, and there
won't be any error info in the PSDS.  To get that to work,
you'd have to use QCMDEXC.

Using 'system' you can only get the msgid for the exception
causing the failure.  There's nothing in the joblog, so you
can't get any more information.  ('system' is great if you
DON'T want anything in the joblog, say in the case where you
create/clear a file - no matter which one you try first,
you'll sometimes have error messages to delete if you want to
be tidy).

I like the following method.  The doCmd procedure could be
setup to optionally clean up the joblog, or return any amount
of information about the exceptions.  (By the way, I only
use one subfield in my PSDS for the whole message id, avoiding
the extra line of code and the + operation to stick them back
together.  I have no idea why these are listed separately
in the RPG documentation.)

    * DOCMD_P prototype file
   D doCmd           PR         LIKE(ExcId)
   D   cmd               3000A  VARYING CONST

    * Module calling doCmd
    /COPY DOCMD_P
   C         EVAL    excId = doCmd ('CLRPFM FILE(keithm)')

    * Module with procedure doCmd
    /COPY DOCMD_P
   D PgmSts         SDS
   D  ExcId         40     46

   P doCmd           B          EXPORT
   D doCmd           PI         LIKE(ExcId)
   D   cmd               3000A  VARYING CONST

   D QcmdExc         PR         EXTPGM('QCMDEXC')
   D   cmd               3000A  CONST
   D   cmdlen              15P 0

   C        CALLP(E)  QcmdExc (cmd : %len(cmd))
   C        IF        %error
   C        RETURN    ExcId
   C        ELSE
   C        RETURN    *BLANKS
   C        ENDIF
   P doCmd           E

Barbara Morris


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