ibm-information-center/dist/eclipse/plugins/i5OS.ic.rbam6_5.4.0.1/rmclp.htm

157 lines
11 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="task" />
<meta name="DC.Title" content="Receive messages into a CL procedure or program" />
<meta name="abstract" content="You can use the Receive Message (RCVMSG) command to obtain a message from a message queue for your procedure or program. This topic includes general information on receiving messages and the details on receiving request messages and request processing programs." />
<meta name="description" content="You can use the Receive Message (RCVMSG) command to obtain a message from a message queue for your procedure or program. This topic includes general information on receiving messages and the details on receiving request messages and request processing programs." />
<meta name="DC.subject" content="receiving, message, in CL procedure, procedure, receiving message, CL procedure, control language (CL), program, receiving message, CL program, RCVMSG (Receive Message) command, Receive Message (RCVMSG) command, command, CL, RCVMSG (Receive Message), Receive Message (RCVMSG), in CL program, queue, receiving message from, message reference key, reference key, RCVMSG (Receive Message) command, Receive Message (RCVMSG) command, RCVMSG (Receive Message), Receive Message (RCVMSG), information placement, exception message, using the RMV keyword" />
<meta name="keywords" content="receiving, message, in CL procedure, procedure, receiving message, CL procedure, control language (CL), program, receiving message, CL program, RCVMSG (Receive Message) command, Receive Message (RCVMSG) command, command, CL, RCVMSG (Receive Message), Receive Message (RCVMSG), in CL program, queue, receiving message from, message reference key, reference key, RCVMSG (Receive Message) command, Receive Message (RCVMSG) command, RCVMSG (Receive Message), Receive Message (RCVMSG), information placement, exception message, using the RMV keyword" />
<meta name="DC.Relation" scheme="URI" content="wmsgs.htm" />
<meta name="DC.Relation" scheme="URI" content="rqmsg.htm" />
<meta name="DC.Relation" scheme="URI" content="wrppg.htm" />
<meta name="DC.Relation" scheme="URI" content="msgdeterm.htm" />
<meta name="DC.Relation" scheme="URI" content="msgmq.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rmclp" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Receive messages into a CL procedure or program</title>
</head>
<body id="rmclp"><a name="rmclp"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Receive messages into a CL procedure or program</h1>
<div><p>You can use the <span class="cmdname">Receive Message (RCVMSG)</span> command
to obtain a message from a message queue for your procedure or program. This
topic includes general information on receiving messages and the details on
receiving request messages and request processing programs.</p>
<div class="section"> <p> Messages can be received in the following ways: </p>
<ul><li>By message type. You can specify that all types or that a specific type
can be received (MSGTYPE parameter). New messages (those that have not been
received in the procedure or program) are received in a first-in-first-out
(FIFO) order. However, ESCAPE type messages are received in last-in-first-out
(LIFO) order.</li>
<li>By message reference key. You can do one of the following: <ul><li>Receive a message using its message reference key. The system assigns
a message reference key to each message on a message queue and passes the
key as variable data because it is unprintable. You must declare this variable
in your CL procedure or program (DCL command). You must specify the MSGKEY
parameter on the <span class="cmdname">Receive Message (RCVMSG)</span> command to identify
the CL variable through which the key is to be passed. This will indicate
the specific message to be received.</li>
<li>Receive the next message on a message queue following the message with
a specified message reference key. In addition to specifying the MSGKEY parameter,
you must specify MSGTYPE(*NEXT).</li>
<li>Receive the message on a message queue that is before a message with a
specified message reference key. In addition to specifying the MSGKEY parameter,
you must specify MSGTYPE(*PRV).</li>
</ul>
</li>
<li>By its location on the message queue. You must specify MSGTYPE(*FIRST)
for the first message on the message queue; specify MSGTYPE(*LAST) for the
last.</li>
<li>By both message type and message reference key (MSGTYPE and MSGKEY parameters).</li>
</ul>
<p>To receive a message, you can specify: </p>
<ul><li>Message queue. Where the message is to be received from.</li>
<li>Message type. Specify either a specific message type, or a value of *ANY
to represent any type of message.</li>
<li>Whether to wait for the arrival of a message. After the wait is over and
no message is received, the CL variables requested to be returned are filled
with blanks (or zeros if numeric) and control returns to the procedure or
program running the <span class="cmdname">Receive Message (RCVMSG)</span> command.</li>
<li>Whether to remove the message from the message queue after it is received.
If it is not removed, it becomes an old message on the message queue and can
only be received again (by a procedure) through its message reference key.
However, if messages on the message queue are reset to new messages through
the <span class="cmdname">Change Message Queue (CHGMSGQ)</span> command, you do not
have to use the message reference key to receive the message. Note that inquiry
messages that have already been replied to are not reset to a new status.</li>
<li>CCSID to convert to. Specifies the CCSID that you want your message text
returned in.</li>
<li>A group of CL variables into which the following information is placed
(each corresponds to one variable on the <span class="cmdname">Receive Message (RCVMSG)</span> command).
One or more of the following return variables can be specified: <ul><li>Message reference key of the message in the message queue (character variable,
4 characters)</li>
<li>Message (character variable, length varies)</li>
<li>Length of message, including length of substitution variable data (decimal
variable, 5 decimal positions)</li>
<li>Message online help information (character variable, length varies)</li>
<li>Length of message help, including length of substitution variable data
(decimal variable, 5 decimal positions)</li>
<li>Message data for the substitution variables provided by the sender of
the message (character variable, length varies)</li>
<li>Length of the message data (decimal variable, 5 decimal positions)</li>
<li>Message identifier (character variable, 7 characters)</li>
<li>Severity code (decimal variable, length of 2)</li>
<li>Sender of the message (character variable, minimum of 80 characters, but
a minimum of 87 characters are needed to obtain the current user information)</li>
<li>Type of message received (character variable, 2 characters long)</li>
<li>Alert option of the message received (character variable, 9 characters)</li>
<li>Message file that contains the predefined message (character variable,
10 characters)</li>
<li>Message file library name that contains the message file used to receive
the message (character variable, 10 characters)</li>
<li>Message file library name that contains the message file used to send
the message (character variable, 10 characters)</li>
<li>Message data CCSID is the coded character set identifier associated with
the replacement data returned (decimal variable, 5 decimal positions)</li>
<li>Text data CCSID is the coded character set identifier associated with
the text returned by the Message and the Message help parameters (decimal
variable, 5 decimal positions)</li>
</ul>
</li>
</ul>
<p>In the following sample <span class="cmdname">Receive Message (RCVMSG)</span> command,
a message is obtained from message queue INVN in the QGPL library. The message
text received is placed in the variable &amp;MSG. *ANY is the
default value on the MSGTYPE parameter.</p>
<pre>RCVMSG MSGQ(QGPL/INVN) MSGTYPE(*ANY) MSG(&amp;MSG)</pre>
<p>When working with the call stack entry message queue of an
ILE procedure written in a language other than CL, it is possible to receive
an exception message (Escape or Notify) when the exception is not yet handled.
The <span class="cmdname">Receive Message (RCVMSG)</span> command can be used to both
receive a message and indicate to the system that the exception has been handled.</p>
<p>This
can be controlled by using the RMV keyword. If *NO is specified for this keyword,
the exception is handled and the message is left on the message queue as an
old message. If *KEEPEXCP is specified, the exception is <u>not</u> handled
and the message is left on the message queue as a new message. If *YES is
specified, the exception message is handled and the message is removed from
the message queue.</p>
<p>The RTNTYPE keyword can be used to determine if the
message received is an exception message, and if so, whether the exception
has been handled.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rqmsg.htm">Receive request messages</a></strong><br />
Receiving request messages is a method for your CL procedure or program to process CL commands.</li>
<li class="ulchildlink"><strong><a href="wrppg.htm">Write request-processing procedures and programs</a></strong><br />
You can specify a CL procedure as a request processor within a program.</li>
<li class="ulchildlink"><strong><a href="msgdeterm.htm">Determine if a request-processor exists</a></strong><br />
You can determine if a job has a request processor by displaying the job's call stack.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="wmsgs.htm" title="This discusses some of the ways that messages can be used to communicate between users and programs.">Messages</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="msgmq.htm" title="Messages are held on a message queue until they are removed">Remove messages from a message queue</a></div>
</div>
</div>
</body>
</html>