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

253 lines
12 KiB
HTML
Raw Permalink 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 OPM RPG: Retrieve exit point and exit program information" />
<meta name="abstract" content="This program retrieves exit point and exit program information. After retrieving the exit point information, the program calls each exit program. The Retrieve Exit Information API returns a continuation handle when it has more information to return than what fits in the receiver variable." />
<meta name="description" content="This program retrieves exit point and exit program information. After retrieving the exit point information, the program calls each exit program. The Retrieve Exit Information API returns a continuation handle when it has more information to return than what fits in the receiver variable." />
<meta name="DC.Relation" scheme="URI" content="ileScenario.htm" />
<meta name="DC.Relation" scheme="URI" content="conContinuation.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="ileRetrieveRPG" />
<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 OPM RPG: Retrieve exit point and exit program information</title>
</head>
<body id="ileRetrieveRPG"><a name="ileRetrieveRPG"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example in OPM RPG: Retrieve exit point and exit program information</h1>
<div><p>This program retrieves exit point and exit program information.
After retrieving the exit point information, the program calls each exit
program. The Retrieve Exit Information API returns a continuation handle when
it has more information to return than what fits in the receiver variable.</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>
<pre> F***************************************************************
F***************************************************************
F*
F* Program: Retrieve Exit Point and Exit Program Information
F*
F* Language: OPM RPG
F*
F* Description: This program retrieves exit point and exit
F* program information. After retrieving the
F* exit point information, the program calls each
F* exit program.
F*
F* APIs Used: QUSRTVEI - Retrieve Exit Information
F*
F***************************************************************
F***************************************************************
F*
FQPRINT O F 132 PRINTER UC
I*
I* Error Code parameter include. As this sample program
I* uses /COPY to include the error code structure, only the first
I* 16 bytes of the error code structure are available. If the
I* application program needs to access the variable length
I* exception data for the error, the developer should physically
I* copy the QSYSINC include and modify the copied include to
I* define additional storage for the exception data.
I*
I/COPY QSYSINC/QRPGSRC,QUSEC
I*
I* Formats for the Retrieve Exit Information API.
I*
I/COPY QSYSINC/QRPGSRC,QUSREG
I*
I* Miscellaneous data
I*
I DS
I I 'EXAMPLE_EXIT_POINT ' 1 20 EPNTNM
I I -1 B 21 240EPGMNB
I I 3500 B 25 280RCVSZ
I B 29 320X
I B 33 360Y
I 37 57 CALLPG
IRCV DS 3500
C*
C* Beginning of mainline
C*
C* Retrieve the exit point information first. If the current
C* number of exit programs is not zero, retrieve the exit
C* programs. It is not necessary to call for the exit point
C* information to determine if the exit point has any exit
C* programs. It is done here for illustrative purposes only.
C* You can make one call to the API for the exit program
C* information and check the number of exit program entries
C* returned field to see if there are any exit programs to call.
C*
C* Initialize the error code to inform the API that all
C* exceptions should be returned through the error code parameter.
C*
C Z-ADD16 QUSBNB
C*
C* Blank out the continuation handle to let the API know that this
C* is a first attempt at the retrieve operation.
C*
C MOVE *BLANKS CONTHD 16
C*
C* Call the API to retrieve the exit point information
C*
C CALL 'QUSRTVEI'
C PARM CONTHD
C PARM RCV
C PARM RCVSZ
C PARM 'EXTI0100'FORMAT 8
C PARM EPNTNM
C PARM 'EXMP0100'EPTFMT 8
C PARM EPGMNB
C PARM 0 QUSCCB
C PARM QUSBN
C*
C* If an exception occurs, the API returns the exception in the
C* error code parameter. The bytes available field is set to
C* zero if no exception occurs and greater than zero if an
C* exception does occur.
C*
C QUSBNC IFGT 0
C OPEN QPRINT
C EXCPTERREPT
C EXSR DONE
C ENDIF
C*
C* If the call to retrieve exit point information is successful,
C* check to see if there are any exit programs to call.
C*
C 36 SUBSTRCV:1 QUSCG
C QUSCGG IFGT 0
C 1 ADD QUSCGF X
C 201 SUBSTRCV&amp;#58;X QUSCF
C QUSCFF IFGT 0
C*
C* There are some exit programs to call. Blank out the continuation
C* handle to let the API know that this is a first attempt at the
C* retrieve operation.
C*
C MOVE *BLANKS CONTHD
C*
C* Call the exit programs
C*
C EXSR CUSREI
C*
C* If the continuation handle field in the receiver variable is
C* not set to blanks, the API has more information to return than
C* what could fit in the receiver variable. Call the API for
C* more exit programs to call.
C*
C QUSCGD DOWNE*BLANKS
C MOVELQUSCGD CONTHD
C EXSR CUSREI
C ENDDO
C ENDIF
C ENDIF
C EXSR DONE
C*
C* End of MAINLINE
C*
C* Process exit programs in receiver variable
C*
C CUSREI BEGSR
C*
C* Call the API to retrieve the exit program information
C*
C CALL 'QUSRTVEI'
C PARM CONTHD
C PARM RCV
C PARM RCVSZ
C PARM 'EXTI0200'FORMAT 8
C PARM EPNTNM
C PARM 'EXMP0100'EPTFMT 8
C PARM EPGMNB
C PARM 0 QUSCCB
C PARM QUSBN
C*
C* If an exception occurs, the API returns the exception in the
C* error code parameter. The bytes available field is set to
C* zero if no exception occurs and greater than zero if an
C* exception does occur.
C*
C QUSBNC IFGT 0
C OPEN QPRINT
C EXCPTERRPGM
C EXSR DONE
C ENDIF
C*
C* If the call to retrieve exit program information is successful,
C* check to see if there are any exit programs to call.
C*
C* The receiver variable offers enough room for a minimum of one
C* exit program entry because the receiver variable was declared
C* as 3500 bytes. Therefore, this example only checks the
C* number of exit programs returned field. If the receiver
C* variable were not large enough to hold at least one entry,
C* the bytes available field would need to be checked as well as
C* the number of exit programs returned field. If the number of
C* exit programs returned field is set to zero and the bytes
C* available field is greater than the bytes returned field, the
C* API had at least one exit program entry to return but was
C* unable to because the receiver variable was too small.
C*
C 36 SUBSTRCV:1 QUSCJ
C 1 ADD QUSCJF Y
C 72 SUBSTRCV&amp;#58;Y QUSCH
C DO QUSCJG
C*
C* Get the exit program name and library
C*
C MOVE *BLANKS CALLPG
C MOVELQUSCHL CALLPG
C CALLPG CAT '/':0 CALLPG
C CALLPG CAT QUSCHK:0 CALLPG
C*
C* Call the exit program while ignoring failures on the call
C*
C CALL CALLPG 01
C PARM EXTPRM 10
C*
C* Set Y to point to the next exit program entry
C*
C 1 ADD QUSCHB Y
C 72 SUBSTRCV&amp;#58;Y QUSCH
C ENDDO
C ENDSR
C*
C* Return to programs caller
C DONE BEGSR
C SETON LR
C RETRN
C ENDSR
O*
OQPRINT E 106 ERREPT
O 'Attempt to retrieve infor'
O 'mation failed: '
O QUSBND
OQPRINT E 106 ERRPGM
O 'Attempt to retrieve Exit'
O ' Programs failed: '
O QUSBND</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="ileScenario.htm" title="The example APIs in this section represent two general functions of APIs--change and retrieve.">Scenario: Integrated Language Environment (ILE) APIs</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="conContinuation.htm" title="Some APIs that return information offer a continuation handle.">Continuation handle</a></div>
</div>
</div>
</body>
</html>