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

238 lines
10 KiB
HTML
Raw 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="reference" />
<meta name="DC.Title" content="Example in ILE RPG: Retrieving the HOLD parameter (exception message)" />
<meta name="abstract" content="This program retrieves the HOLD value from a job description. It expects errors to be sent as escape messages." />
<meta name="description" content="This program retrieves the HOLD value from a job description. It expects errors to be 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="cmnHoldILERPG" />
<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 RPG: Retrieving the HOLD parameter (exception message)</title>
</head>
<body id="cmnHoldILERPG"><a name="cmnHoldILERPG"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example in ILE RPG: Retrieving the HOLD parameter (exception message)</h1>
<div><p>This program retrieves the HOLD value from a job description.
It expects errors to be 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.</p>
<pre> D***************************************************************
D***************************************************************
D*
D* Program Name: JOBDAPI
D*
D* Programming Language: ILE RPG
D*
D* Description: This program retrieves the HOLD value from
D* a job description. It expects errors to be
D* sent as escape messages.
D*
D* Header Files Included: QUSEC - Error Code Parameter
D* QWDRJOBD - Retrieve Job Description API
D*
D***************************************************************
D***************************************************************
D*
D* Error Code parameter include
D*
D/COPY QSYSINC/QRPGLESRC,QUSEC
D*
D* Retrieve Job Description API Include
D*
D/COPY QSYSINC/QRPGLESRC,QWDRJOBD <span class="uicontrol">(2)</span>
D*
D* Command string data structure
D*
DCMD_STRING DS
D 26 INZ('SNDMSG MSG(''HOLD value is ')
D HOLD 10
D 15 INZ(''') TOUSR(QPGMR)')
D*
D* Miscellaneous data structure
D* <span class="uicontrol">(4)</span> <span class="uicontrol">(2)</span> <span class="uicontrol">(3)</span>
DRCVLEN S 9B 0 INZ(%SIZE(QWDD0100))
DFORMAT S 8 INZ('JOBD0100') <span class="uicontrol">(5)</span>
DLENSTR S 15 5 INZ(%SIZE(CMD_STRING))
C*
C* Beginning of mainline
C*
C* Two parameters are being passed into this program
C*
C *ENTRY PLIST <span class="uicontrol">(8)</span>
C PARM JOBD 10
C PARM JOBD_LIB 10
C*
C* Move the two parameters passed into LFNAM
C*
C JOBD CAT JOBD_LIB LFNAM 20 <span class="uicontrol">(9)</span>
C*
C* Error Code Bytes Provided is set to 0
C*
C Z-ADD 0 QUSBPRV <span class="uicontrol">(6)</span>
C*
C* Call the API.
C*
C CALL QWDRJOBD
C PARM QWDD0100
C PARM RCVLEN
C PARM FORMAT
C PARM LFNAM
C PARM QUSEC
C*
C MOVEL QWDHJQ HOLD
C*
C* Let's tell everyone what the hold value was for this job
C*
C CALL 'QCMDEXC'
C PARM CMD_STRING
C PARM LENSTR
C*
C EVAL *INLR = '1'
C RETURN
C*
C* End of MAINLINE
C*</pre>
</div>
<div class="section"><h4 class="sectiontitle">Example in ILE RPG: Handling Error Conditions</h4><p>Refer
to Example in OPM RPG: Handling error conditions for the original example.
This example can be written only in OPM RPG and ILE RPG.</p>
<pre> D***************************************************************
D***************************************************************
D*
D* Program Name: JOBDAPI
D*
D* Programming Language: ILE RPG
D*
D* Description: This program retrieves the HOLD value from
D* a job description. It expects errors to be
D* sent as escape messages.
D*
D* Header Files Included: QUSEC - Error Code Parameter
D* QWDRJOBD - Retrieve Job Description API
D*
D***************************************************************
D***************************************************************
D*
D* Error Code parameter include
D*
D/COPY QSYSINC/QRPGLESRC,QUSEC
D*
D* Retrieve Job Description API Include
D*
D/COPY QSYSINC/QRPGLESRC,QWDRJOBD
D*
D* Program status DS
D*
DPGMSTS SDS <span class="uicontrol">(12)</span>
D MSG_ID 40 46
D*
D* Command string data structure
D*
DCMD_STRING DS
D 26 INZ('SNDMSG MSG(''HOLD value is ')
D HOLD 10
D 15 INZ(''') TOUSR(QPGMR)')
D*
D* Miscellaneous data structure
D*
DRCVLEN S 9B 0 INZ(%SIZE(QWDD0100))
DFORMAT S 8 INZ('JOBD0100')
DLENSTR S 15 5 INZ(%SIZE(CMD_STRING))
DNO_JOBD S 47 INZ('SNDMSG MSG(''No such *JOBD -
D exists'') TOUSR(QPGMR)')
DNO_JOBD_SZ S 15 5 INZ(%SIZE(NO_JOBD))
C*
C* Beginning of mainline
C*
C* Two parameters are being passed into this program
C*
C *ENTRY PLIST
C PARM JOBD 10
C PARM JOBD_LIB 10
C*
C* Move the two parameters passed into LFNAM
C*
C JOBD CAT JOBD_LIB LFNAM 20
C*
C* Error Code Bytes Provided is set to 0
C*
C Z-ADD 0 QUSBPRV <span class="uicontrol">(11)</span>
C*
C* Call the API.
C*
C CALL QWDRJOBD 01 <span class="uicontrol">(10)</span>
C PARM QWDD0100
C PARM RCVLEN
C PARM FORMAT
C PARM LFNAM
C PARM QUSEC
C*
C* Test for an error on the API call
C*
C IF *IN01 = *ON
C*
C* If there was an error, exit to ERROR subroutine
C*
C EXSR ERROR
C*
C* Else, process the HOLD value
C*
C ELSE
C MOVEL QWDHJQ HOLD
C*
C* Let's tell everyone what the hold value was for this job
C*
C CALL 'QCMDEXC'
C PARM CMD_STRING
C PARM LENSTR
C END
C*
C EVAL *INLR = '1'
C RETURN
C*
C* End of MAINLINE
C*
C* Subroutine to handle errors received on the CALL
C*
C ERROR BEGSR
C IF MSG_ID = 'CPF9801'
C*
C* Process errors returned from the API
C*
C CALL 'QCMDEXC'
C PARM NO_JOBD
C PARM NO_JOBD_SZ
C END
C ENDSR</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>