|
Rob, some time ago I did some "research" on this problem. I created a procedure called YRCVPRVMSG (Receive previous message). An example for the usage: D yRcvPrvMsg PR Like($GEMDS) D $GEMDS E DS ExtName(YGEMDS) Qualified p$CmdStg = 'CHKOBJ OBJ(''HUGO'') OBJTYPE(*PGM)'; CallP(E) QCMDEXC(p$CmdStg:%len(p$CmdStg)); If %error; // Call Procedure $GEMDS = yRcvPrvMsg(); // Display Error Message If $GEMDS <> *blanks; r$RtnVal = yDspMsgWdw($GEMDS.MsgId:$GEMDS.MsgF:$GEMDS.MsgFLib: $GEMDS.MsgDta); EndIf; EndIf; The code of the procedure yRcvPrvMsg is: yRcvPrvMsg B Export yRcvPrvMsg PI Like($GEMDS) r$GEMDS S Like($GEMDS) #MsgKey S 4A #StackCnt S 10I 0 /free $GEMDS = *blanks; r$GEMDS = *blanks; #MsgKey = *ALLx'00'; #StackCnt = 1; QMHRCVPM($RCVM0200:%size($RCVM0200):'RCVM0200':'*':#StackCnt:'*PRV': #MsgKey:0:'*SAME':$APIErrDS); If $GEMDS.MsgId = 'CPF0006'; #MsgKey = $RCVM0200.MsgKey; QMHRCVPM($RCVM0200:%size($RCVM0200):'RCVM0200':'*':#StackCnt:'*PRV': #MsgKey:0:'*SAME':$APIErrDS); EndIf; If $APIErrDS.ByteRtn = *zeros; $GEMDS.MsgId = $RCVM0200.MsgID; $GEMDS.MsgF = $RCVM0200.MsgF; $GEMDS.MsgFLib = $RCVM0200.MsgFLibU; $GEMDS.MsgDta = %subst($RCVM0200.MsgText:1:$RCVM0200.LenRtn); EndIf; r$GEMDS = $GEMDS; Return r$GEMDS; /end-free P yRcvPrvMsg E There are some company individual specials inside it (e.g. $GEMDS). But the usage of the QMHRCVPM can be reproduced by my code. The procedure works, but I didn't implement it yet in applications. Hope it can be proposal for you. Regards, Werner Noll -----Ursprüngliche Nachricht----- Von: rob@xxxxxxxxx [mailto:rob@xxxxxxxxx] Gesendet: Mittwoch, 23. Februar 2005 17:13 An: rpg400-l@xxxxxxxxxxxx Betreff: Exception handling with QCMDEXC I have a routine that executes a command using QCMDEXC. I want to check the results of the command. I use the PSDS to find the results. However from the joblog I get: CALL TSTEH01 CPD0032-Not authorized to command KICKBOOTY in library *LIBL. CPF0001-Error found on KICKBOOTY command. CPF0006-Errors occurred in command. And what appears in the Exception message field from the PSDS? Just CPF0006. I was hoping for the CPD0032. Tried using system(), but that just showed the CPF0006 message also. Suggestions? End goal is to ENDSBS and I want to see the plethora of messages displayed on the help for ENDSBS. I'll process it differently depending on whether or not the subsystem is running, etc. Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx 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.