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



> is there an easy way to exit the program from a subprocedure?

This list gave me the answer; I am happy to return something useful to the
list.
Send an escape message to the calling program.  This will cause an exception
(you need to trap it) in the calling program farther up the stack.

 * send the escape message that will terminate the caller
PescMsg           b
DescMsg           pi
D inpText                       80    const

 * Send message API parameters
D msgID           s              7    inz('CPF9898')
D msgFil          s             20    inz('QCPFMSG   *LIBL     ')
D msgData         s                   like(inpText)
D msgDataLen      s             10i 0 inz(%size(msgData))
D msgType         s             10    inz('*ESCAPE')
D msgStackEnt     s             10    inz('*CTLBDY')
D msgStackCnt     s             10i 0 inz(1)
D msgKey          s              4
D msgErrStruc     s                   like(ErrStruc)

 * API error structure
D errStruc        DS                  inz
D  errSSize                     10i 0 inz(%len(errStruc))
D  errSUse                      10i 0
D  errSmsgID                     7
D  errSResrv                     1
D  errSData                     80

C                   eval      msgData = inpText
C                   eval      msgErrStruc = errStruc

C                   Call(e)   'QMHSNDPM'
C                   Parm                    msgID
C                   Parm                    msgFil
C                   Parm                    msgData
C                   Parm                    msgDataLen
C                   Parm                    msgType
C                   Parm                    msgStackEnt
C                   Parm                    msgStackCnt
C                   Parm                    msgKey
C                   Parm                    msgErrStruc

C                   Eval      errStruc = msgErrStruc

 * last chance trap for proc
 * swallow errors without worry.  I don't care if sndmsg didn't work.
c     *pssr         begsr
c                   return
c                   endsr

PescMsg           e

c                   callp(e)  escMsg('RPG ABEND from main')

  --buck





As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.