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

97 lines
5.7 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="reference" />
<meta name="DC.Title" content="Example: Send last diagnostic message as an escape message" />
<meta name="abstract" content="This example is a program that sends the last diagnostic message as an escape message." />
<meta name="description" content="This example is a program that sends the last diagnostic message as an escape message." />
<meta name="DC.subject" content="example, sample default message program" />
<meta name="keywords" content="example, sample default message program" />
<meta name="DC.Relation" scheme="URI" content="esmsg.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="exdfp" />
<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 last diagnostic message as an escape message</title>
</head>
<body id="exdfp"><a name="exdfp"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Send last diagnostic message as an escape message</h1>
<div><p>This example is a program that sends the last diagnostic message
as an escape message.</p>
<div class="section"><p>The following program is a sample default program that could be
used when a diagnostic message is sent followed by an escape message. This
program could be an OPM CL program or an ILE program that has this single
CL procedure. </p>
<pre> PGM PARM(&amp;MSGQ &amp;MRK)
DCL VAR(&amp;MRK) TYPE(*CHAR) LEN(4)
DCL VAR(&amp;MSGQ) TYPE(*CHAR) LEN(6381)
DCL VAR(&amp;QNAME) TYPE(*CHAR) LEN(4096)
DCL VAR(&amp;MODNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&amp;BPGMNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&amp;BLANKMRK) TYPE(*CHAR) LEN(4) VALUE(' ')
DCL VAR(&amp;DIAGMRK) TYPE(*CHAR) LEN(4) VALUE(' ')
DCL VAR(&amp;SAVEMRK) TYPE(*CHAR) LEN(4)
DCL VAR(&amp;MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&amp;MSGDTA) TYPE(*CHAR) LEN(100)
DCL VAR(&amp;MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&amp;MSGLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&amp;OFFSET) TYPE(*DEC)
DCL VAR(&amp;LENGTH) TYPE(*DEC)
/* Check for OPM program type */
IF (%SST(&amp;MSGQ 277 1) *EQ '0') THEN(DO)
CHGVAR VAR(&amp;QNAME) VALUE(%SST(&amp;MSGQ 1 10))
CHGVAR VAR(&amp;MODNAME) VALUE('*NONE')
CHGVAR VAR(&amp;BPGMNAME) VALUE('*NONE')
ENDDO
ELSE DO
/* Not an OPM program; always use the long procedure name */
<span>CHGVAR VAR(&amp;OFFSET) VALUE(%BIN(&amp;MSGQ 281 4))</span>
CHGVAR VAR(&amp;LENGTH) VALUE(%BIN(&amp;MSGQ 285 4))
CHGVAR VAR(&amp;QNAME) VALUE(%SST(&amp;MSGQ &amp;OFFSET &amp;LENGTH))
CHGVAR VAR(&amp;MODNAME) VALUE(%SST(&amp;MSGQ 11 10))
CHGVAR VAR(&amp;BPGMNAME) VALUE(%SST(&amp;MSGQ 1 10))
ENDDO
GETNEXTMSG: CHGVAR VAR(&amp;SAVEMRK) VALUE(&amp;DIAGMRK)
RCVMSG PGMQ(*SAME (&amp;QNAME &amp;MODNAME &amp;BPGMNAME)) +
MSGTYPE(*DIAG) RMV(*NO) KEYVAR(&amp;DIAGMRK)
IF (&amp;DIAGMRK *NE &amp;BLANKMRK) THEN(GOTO GETNEXTMSG)
ELSE IF (&amp;SAVEMRK *NE ' ') THEN(DO)
/* If no diag message is sent, no message is sent to the previous program */
RCVMSG PGMQ(*SAME (&amp;QNAME &amp;MODNAME &amp;BPGMNAME)) +
MSGKEY(&amp;SAVEMRK) RMV(*NO) MSGDTA(&amp;MSGDTA) +
MSGID(&amp;MSGID) MSGF(&amp;MSGF) MSGFLIB(&amp;MSGLIB)
SNDPGMMSG MSGID(&amp;MSGID) MSGF(&amp;MSGLIB/&amp;MSGF) +
MSGDTA(&amp;MSGDTA) TOPGMQ(*PRV (&amp;QNAME +
&amp;MODNAME &amp;BPGMNAME))
MSGTYPE(*ESCAPE)
ENDDO
ENDPGM</pre>
</div>
<div class="section"><p>The program receives all the diagnostic messages in FIFO order.
Then it sends the last diagnostic message as an escape message to allow the
previous program to monitor for it.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="esmsg.htm" title="For each message you create that can be sent as an escape message, you can set up a default message handling action to be used if the message, when sent, is not handled any other way.">Specify default message handling for escape messages</a></div>
</div>
</div>
</body>
</html>