|
|
![]() |
|
|
|
|
||
|
Sending Escape Messages from RPG Hey, Ted: I know how to use the Send Program Message (SNDPGMMSG) command to send an escape message from a CL program to its caller. How do I send an escape message from an RPG program? -- Len Use the Send Program Message API, QMHSNDPM. Here's an example:
D SendEscMsg pr extpgm('QMHSNDPM')
D MsgID 7 const
D MsgFile 20 const
D MsgDta 80 const
D MsgDtaLen 10i 0 const
D MsgType 10 const
D MsgQ 10 const
D MsgQNbr 10i 0 const
D MsgKey 4
D ErrorDS 16
D ErrorDS ds 16
D BytesProv 10i 0 inz(16)
D BytesAvail 10i 0
D ExceptionID 7
D MsgDta s 80
D MsgKey s 4
C eval MsgDta = 'Something went wrong'
C callp SendEscMsg ('CPF9898':
C 'QCPFMSG QSYS':
C MsgDta:
C %len(MsgDta):
C '*ESCAPE':
C '*':
C 2:
C MsgKey:
C ErrorDS)
Notice the sixth and seventh parameters. The asterisk (*) in parameter six refers to the current call stack. The seventh parameter tells how far up the call stack to send the message. In this example, it has a value of two, because there is a program-entry-point call stack entry between the sender of the message and the calling program. In OPM programming, this parameter should have a value of one. For more information, see the "Send Program Message (QMHSNDPM) API ," iSeries Information Center . -- Ted
|
Editors
Contact the Editors |
|
Last Updated: 7/26/02 Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved. |