The Receive Last Message tool supports three commands that can be
used to receive the last message sent to the current programs message
queue. The command interface may be used, but the major intent of
the tool is to allow simple access to the last message received by a
HLL program.
Three commands are supported:
** RCVLSTMSG. Provides for a single return value which is the
last message received. The message is not removed from the
program message queue.
** RCVLSTMSG2. Same as RCVLSTMSG except that the message is
removed from the program message queue.
** RCVLSTMSG3. Provides for several return values which are
typically accessed for a message (such as the message ID,
message data, etc.) The RMV option exists which defaults to
*YES.
The last message received would normally be an escape or completion
message type.
The CPP names and parameter lists are:
RCVLST (Not removed) MSG *CHAR 256
RCVLST2 (Removed) MSG *CHAR 256
RCVLST3 MSGID *CHAR 7
MSG *CHAR 256
MSGDTA *CHAR 512
MSGF *CHAR 10
MSGFLIB *CHAR 10
RTNTYPE *CHAR 2
RMV *CHAR 4 Default is *YES
A typical use of RCVLST from an RPG program would be to execute a
command using QCMDEXC and then receive the completion message such
as:
C CALL 'QCMDEXC' QCMDEXC
C PARM CMD Cmd value
C PARM LENGTH 155 Length
C CALL 'RCVLST' RCVLSTMSG
C PARM LSTMSG256 Last msg
To receive an escape message, the code is identical, but the CALL
operation must specify an error indicator.
RCVLST Command parameters *CMD
-------------------------
MSG The 1st level text of the last message sent to the
current programs message queue. If no message
exists or a blank message is received, blanks are
returned without any error. The message is not
removed from the program message queue. The
variable must be specified as *CHAR LEN(256).
RCVLST2 Command parameters *CMD
--------------------------
MSG The 1st level text of the last message sent to the
current programs message queue. If no message
exists or a blank message is received, blanks are
returned without any error. The message is removed
from the program message queue. The variable must
be specified as *CHAR LEN(256).
RCVLST3 Command parameters *CMD
--------------------------
MSGID An optional return value for the message ID
received. If no message exists or no message ID was
used (an impromptu message), the value will be
blank. To determine if a message exists, see the
RTNTYPE parameter. If specified, the variable must
be declared as *CHAR LEN(7).
MSG An optional value for the 1st level text of the last
message received. If no message exists or a blank
message is received, blanks are returned without any
error. If specified, the variable must be declared
as *CHAR LEN(256).
MSGDTA An optional value for the message data of the last
message received. If no message data exists or a
blank message is received, blanks are returned
without any error. If specified, the variable must
be declared as *CHAR LEN(512).
MSGF An optional value for the message file of the last
message received. If no message file was used (an
impromptu message) or no message exists, blanks are
returned without any error. If specified, the
variable must be declared as *CHAR LEN(10).
MSGFLIB An optional value for the message file library of
the last message received. If no message file was
used (an impromptu message) or no message exists,
blanks are returned without any error. This value
is the SNDMSGFLIB value on RCVMSG. If specified,
the variable must be declared as *CHAR LEN(10).
RTNTYPE An optional value for the return type of the last
message received. The values are defined by the
RCVMSG RTNTYPE parameter. If no message exists,
blanks are returned. If specified, the variable
must be declared as *CHAR LEN(2).
RMV A *YES/*NO parameter for whether to remove the
message from the program message queue. The default
is *YES (same as on RCVMSG). *NO may be specified
to retain the message on the program message queue.
Restrictions
------------
None.
Prerequisites
-------------
None.
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
RCVLSTMSG *CMD TAAMSHL QATTCMD
RCVLSTMSG2 *CMD TAAMSHL2 QATTCMD
RCVLSTMSG3 *CMD TAAMSHL3 QATTCMD
RCVLST *PGM CLP TAAMSHLC QATTCL
RCVLST2 *PGM CLP TAAMSHLC2 QATTCL
RCVLST3 *PGM CLP TAAMSHLC3 QATTCL
Structure
---------
RCVLSTMSG Cmd
RCVLST CL pgm
RCVLSTMSG2 Cmd
RCVLST2 CL pgm
RCVLSTMSG3 Cmd
RCVLST3 CL pgm
|