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




On 23/01/2007, at 3:43 AM, Dan wrote:

 STDERR1:               /* Standard error handling routine */
             IF         &ERRORSW SNDPGMMSG MSGID(CPF9999) +
                          MSGF(QCPFMSG) MSGTYPE(*ESCAPE) /* Func chk */
             CHGVAR     &ERRORSW '1' /* Set to fail ir error occurs */
 STDERR2:    RCVMSG     MSGTYPE(*DIAG) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                          MSGF(&MSGF) MSGFLIB(&MSGFLIB)
             IF         (&MSGID *EQ '       ') GOTO STDERR3
             SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                          MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
             GOTO       STDERR2 /* Loop back for addl diagnostics */
 STDERR3:    RCVMSG     MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                          MSGF(&MSGF) MSGFLIB(&MSGFLIB)
             SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                          MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)

             ENDPGM

Most of this code is simply fetching messages from the current call stack queue and resending them to the caller's queue. You can accomplish much the same effect by using the QMHMOVPM API.

Old code but you should get the idea:

CSR   *PSSR         BEGSR
 *    ----------

 * Ensure the PSSR is not invoked if we are already handling an error
C                   IF        ( *INLR )
C                   RETURN
C                   ENDIF

C                   SETON                                        LR
                                                                     
 * Force exceptions from the API -- just in case
C                   EVAL      Qus_Ec_Bytes_Avail = *ZERO

 * Forward any messages that may indicate the problem
C                   EVAL      PSSR_msgTypes(1) = $MH_MSGT_DIAG
C                   EVAL      PSSR_msgTypes(2) = $MH_MSGT_ESCAPE
C                   CALLP     QmhMovPgmMsg( *BLANKS               :
C                                           PSSR_msgTypes         :
C                                           %ELEM(PSSR_msgTypes)  :
C $MH_RPG_IV_ENTRY + PSDS_Pgm :
C                                           $MH_REL_MSG_Q_PRV     :
C                                           Qus_Ec :
C                                           20     :
C                                           '*NONE     *NONE     ')
 * Indicate a catastrophic failure
C                   CALLP     sndSmbEscpMsg( $SMB_FAILURE :
C                                            ''           :
C $MH_RPG_IV_ENTRY + PSDS_Pgm )

C                   RETURN
CSR ENDSR


Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         OS/400, i5/OS Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.