ibm-information-center/dist/eclipse/plugins/i5OS.ic.apiref_5.4.0.1/cmnHoldCOBOL.htm

140 lines
6.1 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 in ILE COBOL: Retrieving the HOLD parameter (exception message)" />
<meta name="abstract" content="This example expects errors sent as escape messages." />
<meta name="description" content="This example expects errors sent as escape messages." />
<meta name="DC.Relation" scheme="URI" content="opmScenario.htm" />
<meta name="DC.Relation" scheme="URI" content="cmnHoldRPG.htm" />
<meta name="DC.Relation" scheme="URI" content="cmnHoldRPG.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="cmnHoldCOBOL" />
<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 in ILE COBOL: Retrieving the HOLD parameter (exception message)</title>
</head>
<body id="cmnHoldCOBOL"><a name="cmnHoldCOBOL"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example in ILE COBOL: Retrieving the HOLD parameter (exception message)</h1>
<div><p>This example expects errors sent as escape messages.</p>
<div class="section"><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>
<p>Refer to Example in OPM RPG: Retrieving the HOLD
parameter (exception message) for the original example. The following program
also works for OPM COBOL.</p>
<pre> IDENTIFICATION DIVISION.
*****************************************************************
*****************************************************************
*
*Program Name: JOBDAPI
*
*Programming Language: COBOL
*
*Description: This example expects errors sent as
* escape messages.
*
*Header Files Included: QUSEC - Error Code Parameter
* QWDRJOBD - Retrieve Job Description API
*
*****************************************************************
*****************************************************************
*
PROGRAM-ID. JOBDAPI.
*
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-AS400.
OBJECT-COMPUTER. IBM-AS400.
*
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY QUSEC OF QSYSINC-QLBLSRC.
*
* Retrieve Job Description API Include
*
COPY QWDRJOBD OF QSYSINC-QLBLSRC. <span class="uicontrol">(2)</span>
*
* Command String Data Structure
*
01 COMMAND-STRING.
05 TEXT1 PIC X(26) VALUE 'SNDMSG MSG(''HOLD value is'.
05 HOLD PIC X(10).
05 TEXT2 PIC X(15) VALUE ''') TOUSR(QPGMR)'.
*
01 COMMAND-LENGTH PIC S9(10)V99999 COMP-3.
01 RECEIVER-LENGTH PIC S9(9) COMP-4. <span class="uicontrol">(4)</span>
01 FORMAT-NAME PIC X(8) VALUE 'JOBD0100'. <span class="uicontrol">(5)</span>
01 QCMDEXC PIC X(10) VALUE 'QCMDEXC'.
*
* Job Description and Library Name Structure
*
01 JOBD-AND-LIB-NAME.
05 JOB-DESC PIC X(10).
05 JOB-DESC-LIB PIC X(10).
*
LINKAGE SECTION.
*
* Two Parameters are being passed into this program.
*
01 JOBD PIC X(10).
01 JOBDL PIC X(10).
*
PROCEDURE DIVISION USING JOBD, JOBDL. <span class="uicontrol">(8)</span>
MAIN-LINE.
*
* Beginning of Mainline
*
* Move the two parameters passed into JOB-DESC and JOB-DESC-LIB. <span class="uicontrol">(9)</span>
MOVE JOBD TO JOB-DESC.
MOVE JOBDL TO JOB-DESC-LIB.
*
* Error Code Parameter is set to 0.
*
MOVE 0 TO BYTES-PROVIDED. <span class="uicontrol">(6)</span>
*
* Receiver Length Set to 390.
*
MOVE 390 TO RECEIVER-LENGTH. <span class="uicontrol">(3)</span>
*
* Call the QWDRJOBD API.
*
CALL QWDRJOBD USING QWD-JOBD0100, RECEIVER-LENGTH,
FORMAT-NAME, JOBD-AND-LIB-NAME, QUS-EC.
*
* Move HOLD-JOB-QUEUE to HOLD so that we can display the value using
* the command string.
*
MOVE HOLD-JOB-QUEUE TO HOLD.
*
* Let's tell everyone what the hold value was for this job.
*
MOVE 51 TO COMMAND-LENGTH.
CALL QCMDEXC USING COMMAND-STRING, COMMAND-LENGTH.
*
STOP RUN.</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="opmScenario.htm" title="This scenario demonstrates the use of an original program model (OPM) API in several different programs.">Scenario: Original Program Model (OPM) API</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="cmnHoldRPG.htm" title="This example expects errors to be sent as escape messages.">Example in OPM RPG: Retrieving the HOLD parameter (exception message)</a></div>
</div>
</div>
</body>
</html>