117 lines
6.5 KiB
HTML
117 lines
6.5 KiB
HTML
<?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="Example: Send an immediate message and handling a reply" />
|
|
<meta name="abstract" content="This example shows how a procedure sends an inquiry message and handles the reply." />
|
|
<meta name="description" content="This example shows how a procedure sends an inquiry message and handles the reply." />
|
|
<meta name="DC.Relation" scheme="URI" content="amsgf.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="immsgdbcs.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="sndrcpy.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="immmsg" />
|
|
<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>Example: Send an immediate message and handling a reply</title>
|
|
</head>
|
|
<body id="immmsg"><a name="immmsg"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Send an immediate message and handling a reply</h1>
|
|
<div><p>This example shows how a procedure sends an inquiry message and
|
|
handles the reply.</p>
|
|
<div class="section"> <p>In this example, the procedure does the following:</p>
|
|
<ul><li>Sends an immediate inquiry message to QSYSOPR</li>
|
|
<li>Requests a reply of yes or no (Y or N)</li>
|
|
<li>Ensures that a valid reply has been entered</li>
|
|
<li>Does a time-out if the operator does not reply within 120 seconds</li>
|
|
</ul>
|
|
<pre> PGM
|
|
DCL &MSGKEY *CHAR LEN(4)
|
|
DCL &MSGRPY *CHAR LEN(1)
|
|
SNDMSG: SNDPGMMSG MSG('.... Reply Y or N') TOMSGQ(QSYSOPR) +
|
|
MSGTYPE(*INQ) KEYVAR(&MSGKEY)
|
|
RCVMSG MSGTYPE(*RPY) MSGKEY(&MSGKEY) WAIT(120) +
|
|
MSG(&MSGRPY)
|
|
IF ((&MSGRPY *EQ 'Y') *OR (&MSGRPY *EQ 'y')) DO
|
|
.
|
|
.
|
|
GOTO END
|
|
ENDDO /* Reply of Y */
|
|
IF ((&MSGRPY *EQ 'N') *OR (&MSGRPY *EQ 'n')) DO
|
|
.
|
|
.
|
|
GOTO END
|
|
ENDDO /* Reply of N */
|
|
IF (&MSGRPY *NE ' ') DO
|
|
SNDPGMMSG MSG('Reply was not Y or N, try again') +
|
|
TOMSGQ(QSYSOPR)
|
|
GOTO SNDMSG
|
|
ENDDO /* Reply not valid */
|
|
/* Timeout occurred */
|
|
SNDPGMMSG MSG('No reply from the previous message +
|
|
was received in 120 seconds and a 'Y'' +
|
|
value was assumed') TOMSGQ(QSYSOPR)
|
|
.
|
|
.
|
|
END: ENDPGM</pre>
|
|
<p>The SNDUSRMSG command cannot be used instead in this procedure
|
|
because it does not support a time-out option (SNDUSRMSG waits until it receives
|
|
a reply or until the job is canceled).</p>
|
|
<p>The SNDPGMMSG command sends the
|
|
message and specifies the KEYVAR parameter. This returns a message reference
|
|
key, which uniquely identifies this message so that the reply can be properly
|
|
matched with the RCVMSG command. The KEYVAR value must be defined as a character
|
|
field length of 4.</p>
|
|
<p>The RCVMSG command specifies the message reference
|
|
key value from the SNDPGMMSG command for the MSGKEY parameter to receive the
|
|
specific message. The reply is passed back into the MSG parameter. The WAIT
|
|
parameter specifies how long to wait for a reply before timing out.</p>
|
|
<p>When
|
|
the reply is received, the procedure logic checks for an upper or lower case
|
|
value of the Y or N. Normally the value is entered by the operator as a lower
|
|
case value. If the operator enters a non-blank value other than Y or N, the
|
|
procedure sends a different message and then repeats the inquiry message.</p>
|
|
<p>If
|
|
the operator had entered a blank, no reply is sent to the procedure. If a
|
|
blank is returned to the procedure, the time out occurred (the operator did
|
|
not reply). The procedure sends a message to the system operator stating
|
|
that a reply was not received and the default was assumed (the 'Y'' value
|
|
is shown as 'Y' in the message queue). Because the assumed value of 'Y' is
|
|
not displayed as the reply, you cannot determine when looking at a message
|
|
queue whether the message should be answered or has already timed out. The
|
|
procedure does not remove a message from the message queue once it has been
|
|
sent. The second message should minimize this concern and provides an audit
|
|
trail for what has occurred.</p>
|
|
<p>If the time out has already occurred and
|
|
the operator replies to the message, the reply is ignored. The operator receives
|
|
no indication that the reply has been ignored.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<ul class="ullinks">
|
|
<li class="ulchildlink"><strong><a href="immsgdbcs.htm">Send immediate messages with double-byte characters</a></strong><br />
|
|
To send an immediate message with double-byte text, limit the text to 37 double-byte characters plus the shift control characters. The limited size of the message ensures it is properly displayed.</li>
|
|
</ul>
|
|
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="amsgf.htm" title="You use the Add Message Description (ADDMSGD) command to describe your predefined messages and to add them to the message file you created.">Add messages to a file</a></div>
|
|
</div>
|
|
<div class="reltasks"><strong>Related tasks</strong><br />
|
|
<div><a href="sndrcpy.htm" title="This topic describes how to obtain a reply to an inquiry message by using a sender copy message.">Using a sender copy message to obtain a reply</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |