× 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: Trapping errors with CALLP?
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Thu, 23 Dec 1999 11:26:11 -0500

David,

> david@midrange.com on 12/23/99 10:34:35 AM wrote:
> 
>> CALLP(E)  and check %error
>> 
>> I've run into a problem using CALLP ... I can't trap errors.
>
>I forgot to mention ... I'm compiling to V3R2 :(
>
>david

You are stuck.  Your only choices are to target a more recent release, not
use CALLP or call a procedure that cannot fail.  For this particular
problem, I'd build a cheap CL program to do the CALL to QCMDEXC, MONMSG it
and pass back a "failed" return code:

DQCMDEXC          PR                  EXTPGM('CMDCLPGM')
D prCmdStr                    4096A   CONST            
D prCmdLen                      15P 5 CONST            
D prCmdErr                       1A   

C                   callp     QCMDEXC(CMD:128:ReturnCode)


PGM (&CmdInp &CmdLen &ReturnCode)           
                                            
DCL &CmdInp     *CHAR 4096                  
DCL &CmdLen     *DEC (15 5)                 
DCL &ReturnCode *CHAR 1                     
                                            
ChgVar &ReturnCode ' '  /* OK by default */ 
                                            
CALL   QCMDEXC (&CmdInp &CmdLen)            
MONMSG CPF0000 Exec(Do)                     
  ChgVar &ReturnCode 'F'  /* Failed! */     
EndDo                                       
                                            
ENDPGM                                      

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