159 lines
8.9 KiB
HTML
159 lines
8.9 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: Receive messages from QSYSMSG" />
|
||
|
<meta name="abstract" content="This sample program receives messages from the QSYSMSG message queue." />
|
||
|
<meta name="description" content="This sample program receives messages from the QSYSMSG message queue." />
|
||
|
<meta name="DC.subject" content="sample program to receive message from QSYSMSG, example, receiving message from QSYSMSG, message, sample program to receive from QSYSMSG" />
|
||
|
<meta name="keywords" content="sample program to receive message from QSYSMSG, example, receiving message from QSYSMSG, message, sample program to receive from QSYSMSG" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="qsysm.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="sprmq" />
|
||
|
<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: Receive messages from QSYSMSG</title>
|
||
|
</head>
|
||
|
<body id="sprmq"><a name="sprmq"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example: Receive messages from QSYSMSG</h1>
|
||
|
<div><p>This sample program receives messages from the QSYSMSG message
|
||
|
queue.</p>
|
||
|
<div class="section"> <p>The program consists of a single procedure which is receiving
|
||
|
messages and handling message CPF1269. The reason code in the CPF1269 message
|
||
|
is in binary format. This must be converted to a decimal value for the comparisons
|
||
|
to the 704 and 705 reason codes. The procedure issues the <span class="cmdname">End Mode
|
||
|
(ENDMOD)</span> command to prevent new jobs from being started until the
|
||
|
situation is understood. It then sends the same message to a user-defined
|
||
|
message queue to be reviewed by the security officer. It also sends a message
|
||
|
to the system operator to indicate what occurred. If a different message
|
||
|
is received, it is sent to the system operator.</p>
|
||
|
<p>A separate job would
|
||
|
be started to call this sample program. The job would remain active, waiting
|
||
|
for a message to arrive. The job could be ended using the <span class="cmdname">End Job
|
||
|
(ENDJOB)</span> command.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm">Code license and disclaimer information</a> for
|
||
|
important legal information.</div>
|
||
|
<pre> /********************************************************************/
|
||
|
/* */
|
||
|
/* Sample program to receive messages from QSYSMSG */
|
||
|
/* */
|
||
|
/********************************************************************/
|
||
|
/* */
|
||
|
/* Program looks for message CPF1269 with a reason code of 704 */
|
||
|
/* or 705. If found then notify QSECOFR of the security failure. */
|
||
|
/* Otherwise resend the message to QSYSOPR. */
|
||
|
/* */
|
||
|
/* The following describes message CPF1269 */
|
||
|
/* */
|
||
|
/* CPF1269: Program start request received on communications */
|
||
|
/* device &1 was rejected with reason codes &6,; &7; */
|
||
|
/* */
|
||
|
/* Message data from DSPMSGD CPF1269 */
|
||
|
/* */
|
||
|
/* Data type offset length Description */
|
||
|
/* */
|
||
|
/* &1 *CHAR 1 10 Device */
|
||
|
/* &2 *CHAR 11 8 Mode */
|
||
|
/* &3 *CHAR 19 10 Job - number */
|
||
|
/* &4 *CHAR 29 10 Job - user */
|
||
|
/* &5 *CHAR 39 6 Job - name */
|
||
|
/* &6 *BIN 45 2 Reason code - major */
|
||
|
/* &7 *BIN 47 2 Reason code - minor */
|
||
|
/* &8 *CHAR 49 8 Remote location name */
|
||
|
/* &9 *CHAR 57 *VARY Unit of work identifier */
|
||
|
/* */
|
||
|
/********************************************************************/
|
||
|
|
||
|
PGM
|
||
|
|
||
|
DCL &MSGID *CHAR LEN( 7)
|
||
|
DCL &MSGDTA *CHAR LEN(100)
|
||
|
DCL &MSG *CHAR LEN(132)
|
||
|
|
||
|
DCL &DEVICE *CHAR LEN( 10)
|
||
|
DCL &MODE *CHAR LEN( 8)
|
||
|
DCL &RMTLOC *CHAR LEN( 8)
|
||
|
|
||
|
MONMSG CPF0000 EXEC(GOTO PROBLEM)
|
||
|
/**********************************************************/
|
||
|
/* Fetch messages from QSYSMSG message queue */
|
||
|
/**********************************************************/</pre>
|
||
|
<pre> LOOP: RCVMSG MSGQ(QSYS/QSYSMSG) WAIT(*MAX) MSGID(&MSGID) +
|
||
|
MSG(&MSG) MSGDTA(&MSGDTA)
|
||
|
|
||
|
IF ((&MSGID *EQ 'CPF1269') /* Start failed msg */ +
|
||
|
*AND ((%BIN(&MSGDTA 45 2) *EQ 704) +
|
||
|
*OR (%BIN(&MSGDTA 45 2) *EQ 705)) ) +
|
||
|
THEN(DO)
|
||
|
/********************************************************/
|
||
|
/* Report security failure to QSECOFR */
|
||
|
/********************************************************/
|
||
|
|
||
|
CHGVAR &DEVICE %SST(&MSGDTA 1 10) /* Extract device */
|
||
|
CHGVAR &MODE %SST(&MSGDTA 11 8) /* Extract mode */
|
||
|
CHGVAR &RMTLOC %SST(&MSGDTA 49 8) /* Get loc name */
|
||
|
|
||
|
ENDMOD RMTLOCNAME(&RMTLOC) MODE(&MODE)
|
||
|
|
||
|
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
|
||
|
TOMSGQ(QSECOFR)
|
||
|
|
||
|
SNDPGMMSG MSG('Device ' *CAT &DEVICE *TCAT ' Mode ' +
|
||
|
*CAT &MODE *TCAT ' had security failure, +
|
||
|
session max changed to zero') +
|
||
|
TOMSGQ(QSYSOPR)
|
||
|
ENDDO
|
||
|
ELSE DO
|
||
|
/********************************************************/
|
||
|
/* Other message - Resend to QSYSOPR */
|
||
|
/********************************************************/
|
||
|
|
||
|
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
|
||
|
TOMSGQ(QSYSOPR)
|
||
|
|
||
|
/* SNDPGMMSG would fail if the message does */
|
||
|
/* not have a MSGID or is not in QCPFMSG */
|
||
|
|
||
|
MONMSG MSGID(CPF0000) +
|
||
|
EXEC(SNDPGMMSG MSG(&MSG) TOMSGQ(QSYSOPR))
|
||
|
ENDDO
|
||
|
|
||
|
GOTO LOOP /* Go fetch next message */
|
||
|
|
||
|
|
||
|
/**********************************************************/
|
||
|
/* Notify QSYSOPR of abnormal end */
|
||
|
/**********************************************************/
|
||
|
|
||
|
PROBLEM: SNDPGMMSG MSG('QSYSMSG job has abnormally ended') +
|
||
|
TOMSGQ(QSYSOPR)
|
||
|
MONMSG CPF0000
|
||
|
|
||
|
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGTYPE(*ESCAPE) +
|
||
|
MSGDTA('Unexpected error occurred')
|
||
|
MONMSG CPF0000
|
||
|
|
||
|
ENDPGM</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="qsysm.htm" title="QSYSMSG is a queue that you can create if you plan to handle the list of serious messages that are sent to the queue.">Use QSYSMSG message queue</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|