383 lines
17 KiB
HTML
383 lines
17 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 RPG: List Object API" />
|
||
|
<meta name="abstract" content="The example program prints a report that shows all objects that adopt owner authority." />
|
||
|
<meta name="description" content="The example program prints a report that shows all objects that adopt owner authority." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="listOverview.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="listRPG.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="listRPG.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="listILERPG" />
|
||
|
<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: List Object API</title>
|
||
|
</head>
|
||
|
<body id="listILERPG"><a name="listILERPG"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example in ILE RPG: List Object API</h1>
|
||
|
<div><p>The example program prints a report that shows all objects that
|
||
|
adopt owner authority.</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 RPG: List Object
|
||
|
API for the original example.</p>
|
||
|
<pre> F***************************************************************
|
||
|
F***************************************************************
|
||
|
F*
|
||
|
F* Program: List objects that adopt owner authority
|
||
|
F*
|
||
|
F* Language: ILE RPG
|
||
|
F*
|
||
|
F* Description: This program prints a report showing all objects
|
||
|
F* that adopt owner authority. The two parameters
|
||
|
F* passed to the program are the profile to be
|
||
|
F* checked and the type of objects to be listed.
|
||
|
F* The parameter values are the same as those
|
||
|
F* accepted by the QSYLOBJP API.
|
||
|
F*
|
||
|
F* APIs Used: QSYLOBJP - List Objects that Adopt Owner Authority
|
||
|
F* QUSCRTUS - Create User Space
|
||
|
F* QUSPTRUS - Retrieve Pointer to User Space
|
||
|
F* QUSROBJD - Retrieve Object Description
|
||
|
F*
|
||
|
F***************************************************************
|
||
|
F***************************************************************
|
||
|
F*
|
||
|
FQPRINT O F 132 PRINTER OFLIND(*INOF)
|
||
|
D*
|
||
|
D* Error Code parameter include
|
||
|
D*
|
||
|
D/COPY QSYSINC/QRPGLESRC,QUSEC
|
||
|
D*
|
||
|
DSPC_NAME S 20 INZ('ADOPTS QTEMP ')
|
||
|
DSPC_SIZE S 9B 0 INZ(1)
|
||
|
DSPC_INIT S 1 INZ(X'00')
|
||
|
DLSTPTR S *
|
||
|
DSPCPTR S *
|
||
|
DARR S 1 BASED(LSTPTR) DIM(32767)
|
||
|
DRCVVAR S 8
|
||
|
DRCVVARSIZ S 9B 0 INZ(8)
|
||
|
D*****************************************************************
|
||
|
D*
|
||
|
D* The following QUSGEN include from QSYSINC is copied into
|
||
|
D* this program so that it can be declared as BASED on SPCPTR
|
||
|
D*
|
||
|
D*****************************************************************
|
||
|
DQUSH0100 DS BASED(SPCPTR)
|
||
|
D* Qus Generic Header 0100
|
||
|
D QUSUA 1 64
|
||
|
D* User Area
|
||
|
D QUSSGH 65 68B 0
|
||
|
D* Size Generic Header
|
||
|
D QUSSRL 69 72
|
||
|
D* Structure Release Level
|
||
|
D QUSFN 73 80
|
||
|
D* Format Name
|
||
|
D QUSAU 81 90
|
||
|
D* API Used
|
||
|
D QUSDTC 91 103
|
||
|
D* Date Time Created
|
||
|
D QUSIS 104 104
|
||
|
D* Information Status
|
||
|
D QUSSUS 105 108B 0
|
||
|
D* Size User Space
|
||
|
D QUSOIP 109 112B 0
|
||
|
D* Offset Input Parameter
|
||
|
D QUSSIP 113 116B 0
|
||
|
D* Size Input Parameter
|
||
|
D QUSOHS 117 120B 0
|
||
|
D* Offset Header Section
|
||
|
D QUSSHS 121 124B 0
|
||
|
D* Size Header Section
|
||
|
D QUSOLD 125 128B 0
|
||
|
D* Offset List Data
|
||
|
D QUSSLD 129 132B 0
|
||
|
D* Size List Data
|
||
|
D QUSNBRLE 133 136B 0
|
||
|
D* Number List Entries
|
||
|
D QUSSEE 137 140B 0
|
||
|
D* Size Each Entry
|
||
|
D QUSSIDLE 141 144B 0
|
||
|
D* CCSID List Ent
|
||
|
D QUSCID 145 146
|
||
|
D* Country ID
|
||
|
D QUSLID 147 149
|
||
|
D* Language ID
|
||
|
D QUSSLI 150 150
|
||
|
D* Subset List Indicator
|
||
|
D QUSERVED00 151 192
|
||
|
D* Reserved
|
||
|
D*****************************************************************
|
||
|
D*
|
||
|
D* The following QSYLOBJP include from QSYSINC is copied into
|
||
|
D* this program so that it can be declared as BASED on LSTPTR
|
||
|
D*
|
||
|
D*****************************************************************
|
||
|
D QSYLOBJP C 'QSYLOBJP'
|
||
|
D*****************************************************************
|
||
|
D*Header structure for QSYLOBJP
|
||
|
D*****************************************************************
|
||
|
DQSYOBJPH DS BASED(LSTPTR)
|
||
|
D* Qsy OBJP Header
|
||
|
D QSYUN00 1 10
|
||
|
D* User name
|
||
|
D QSYCV00 11 30
|
||
|
D* Continuation Value
|
||
|
D*****************************************************************
|
||
|
D*Record structure for OBJP0200 format
|
||
|
D*****************************************************************
|
||
|
DQSY0200L02 DS BASED(LSTPTR)
|
||
|
D* Qsy OBJP0200 List
|
||
|
D QSYNAME06 1 10
|
||
|
D* Name
|
||
|
D QSYBRARY06 11 20
|
||
|
D* Library
|
||
|
D QSYOBJT13 21 30
|
||
|
D* Object Type
|
||
|
D QSYOBJIU00 31 31
|
||
|
D* Object In Use
|
||
|
D QSYOBJA11 32 41
|
||
|
D* Object Attribute
|
||
|
D QSYOBJT14 42 91
|
||
|
D* Object Text
|
||
|
C*
|
||
|
C* Start of mainline
|
||
|
C*
|
||
|
C *ENTRY PLIST
|
||
|
C PARM USR_PRF 10
|
||
|
C PARM OBJ_TYPE 10
|
||
|
C EXSR INIT
|
||
|
C EXSR PROCES
|
||
|
C EXSR DONE
|
||
|
C*
|
||
|
C* Start of subroutines
|
||
|
C*
|
||
|
C*****************************************************************
|
||
|
C PROCES BEGSR
|
||
|
C*
|
||
|
C* This subroutine processes each entry returned by QSYLOBJP
|
||
|
C*
|
||
|
C*
|
||
|
C* Do until the list is complete
|
||
|
C*
|
||
|
C MOVE QUSIS LST_STATUS 1
|
||
|
C*
|
||
|
C LST_STATUS DOUEQ 'C'
|
||
|
C*
|
||
|
C* If valid information was returned
|
||
|
C*
|
||
|
C QUSIS IFEQ 'C'
|
||
|
C QUSIS OREQ 'P'
|
||
|
C*
|
||
|
C* and list entries were found
|
||
|
C*
|
||
|
C QUSNBRLE IFGT 0
|
||
|
C*
|
||
|
C* set LSTPTR to the first byte of the User Space
|
||
|
C*
|
||
|
C EVAL LSTPTR = SPCPTR
|
||
|
C*
|
||
|
C* increment LSTPTR to the first List entry
|
||
|
C*
|
||
|
C EVAL LSTPTR = %ADDR(ARR(QUSOLD + 1)) <span class="uicontrol">(5)</span>
|
||
|
C*
|
||
|
C* and process all of the entries
|
||
|
C*
|
||
|
C DO QUSNBRLE <span class="uicontrol">(6)</span>
|
||
|
C EXCEPT OBJ_ENTRY
|
||
|
C*
|
||
|
C* after each entry, increment LSTPTR to the next entry
|
||
|
C*
|
||
|
C EVAL LSTPTR = %ADDR(ARR(QUSSEE + 1)) <span class="uicontrol">(7)</span>
|
||
|
C END
|
||
|
C END
|
||
|
C*
|
||
|
C* If all entries in this User Space have been processed, check
|
||
|
C* if more entries exist than can fit in one User Space
|
||
|
C*
|
||
|
C QUSIS IFEQ 'P'
|
||
|
C*
|
||
|
C* by resetting LSTPTR to the start of the User Space
|
||
|
C*
|
||
|
C EVAL LSTPTR = SPCPTR
|
||
|
C*
|
||
|
C* and then incrementing LSTPTR to the Input Parameter Header
|
||
|
C*
|
||
|
C EVAL LSTPTR = %ADDR(ARR(QUSOIP + 1))
|
||
|
C*
|
||
|
C* If the continuation handle in the Input Parameter Header is
|
||
|
C* blank, then set the List status to Complete
|
||
|
C*
|
||
|
C QSYCV00 IFEQ *BLANKS
|
||
|
C MOVE 'C' LST_STATUS
|
||
|
C ELSE
|
||
|
C*
|
||
|
C* Else, call QSYLOBJP reusing the User Space to get more
|
||
|
C* List entries
|
||
|
C*
|
||
|
C MOVE QSYCV00 CONTIN_HDL <span class="uicontrol">(2)</span>
|
||
|
C EXSR GETLST
|
||
|
C MOVE QUSIS LST_STATUS
|
||
|
C END
|
||
|
C END
|
||
|
C ELSE
|
||
|
C*
|
||
|
C* And if an unexpected status, log an error (not shown) and exit
|
||
|
C*
|
||
|
C EXSR DONE
|
||
|
C END
|
||
|
C END
|
||
|
C ENDSR
|
||
|
C*****************************************************************
|
||
|
C GETLST BEGSR
|
||
|
C*
|
||
|
C* Call QSYLOBJP to generate a list
|
||
|
C* The continuation handle is set by the caller of this
|
||
|
C* subroutine.
|
||
|
C*
|
||
|
C CALL QSYLOBJP
|
||
|
C PARM SPC_NAME
|
||
|
C PARM 'OBJP0200' MBR_LIST 8
|
||
|
C PARM USR_PRF
|
||
|
C PARM OBJ_TYPE
|
||
|
C PARM CONTIN_HDL 20 <span class="uicontrol">(3)</span>
|
||
|
C PARM QUSEC
|
||
|
C*
|
||
|
C* Check for errors on QSYLOBJP
|
||
|
C*
|
||
|
C QUSBAVL IFGT 0
|
||
|
C MOVEL 'QSYLOBJP' APINAM 10
|
||
|
C EXSR APIERR
|
||
|
C END
|
||
|
C ENDSR
|
||
|
C*****************************************************************
|
||
|
C INIT BEGSR
|
||
|
C*
|
||
|
C* One time initialization code for this program
|
||
|
C*
|
||
|
C* Set Error Code structure not to use exceptions
|
||
|
C*
|
||
|
C Z-ADD 16 QUSBPRV
|
||
|
C*
|
||
|
C* Check to see if the User Space was previously created in
|
||
|
C* QTEMP. If it was, simply reuse it.
|
||
|
C*
|
||
|
C CALL 'QUSROBJD'
|
||
|
C PARM RCVVAR
|
||
|
C PARM RCVVARSIZ
|
||
|
C PARM 'OBJD0100' ROBJD_FMT 8
|
||
|
C PARM SPC_NAME
|
||
|
C PARM '*USRSPC' SPC_TYPE 10
|
||
|
C PARM QUSEC
|
||
|
C*
|
||
|
C* Check for errors on QUSROBJD
|
||
|
C*
|
||
|
C QUSBAVL IFGT 0
|
||
|
C*
|
||
|
C* If CPF9801, then User Space was not found
|
||
|
C*
|
||
|
C QUSEI IFEQ 'CPF9801'
|
||
|
C*
|
||
|
C* So create a User Space for the List generated by QSYLOBJP
|
||
|
C*
|
||
|
C CALL 'QUSCRTUS'
|
||
|
C PARM SPC_NAME
|
||
|
C PARM 'QSYLOBJP ' EXT_ATTR 10
|
||
|
C PARM SPC_SIZE
|
||
|
C PARM SPC_INIT
|
||
|
C PARM '*ALL' SPC_AUT 10
|
||
|
C PARM *BLANKS SPC_TEXT 50
|
||
|
C PARM '*YES' SPC_REPLAC 10
|
||
|
C PARM QUSEC
|
||
|
C PARM '*USER' SPC_DOMAIN 10
|
||
|
C*
|
||
|
C* Check for errors on QUSCRTUS
|
||
|
C*
|
||
|
C QUSBAVL IFGT 0
|
||
|
C MOVEL 'QUSCRTUS' APINAM 10
|
||
|
C EXSR APIERR
|
||
|
C END
|
||
|
C*
|
||
|
C* Else, an error occurred accessing the User Space
|
||
|
C*
|
||
|
C ELSE
|
||
|
C MOVEL 'QUSROBJD' APINAM 10
|
||
|
C EXSR APIERR
|
||
|
C END
|
||
|
C END
|
||
|
C*
|
||
|
C* Set QSYLOBJP (via GETLST) to start a new list
|
||
|
C*
|
||
|
C MOVE *BLANKS CONTIN_HDL
|
||
|
C EXSR GETLST
|
||
|
C*
|
||
|
C* Get a resolved pointer to the User Space for performance
|
||
|
C*
|
||
|
C CALL 'QUSPTRUS'
|
||
|
C PARM SPC_NAME
|
||
|
C PARM SPCPTR
|
||
|
C PARM QUSEC
|
||
|
C*
|
||
|
C* Check for errors on QUSPTRUS
|
||
|
C*
|
||
|
C QUSBAVL IFGT 0
|
||
|
C MOVEL 'QUSPTRUS' APINAM 10
|
||
|
C EXSR APIERR
|
||
|
C END
|
||
|
C ENDSR
|
||
|
C*****************************************************************
|
||
|
C APIERR BEGSR
|
||
|
C*
|
||
|
C* Log any error encountered, and exit the program
|
||
|
C*
|
||
|
C APINAM DSPLY
|
||
|
C QUSEI DSPLY
|
||
|
C EXSR DONE
|
||
|
C ENDSR
|
||
|
C*****************************************************************
|
||
|
C DONE BEGSR
|
||
|
C*
|
||
|
C* Exit the program
|
||
|
C*
|
||
|
C EXCEPT END_LIST
|
||
|
C EVAL *INLR = '1'
|
||
|
C RETURN
|
||
|
C ENDSR
|
||
|
OQPRINT E OBJ_ENTRY 1
|
||
|
O 'Object: '
|
||
|
O QSYNAME06
|
||
|
O ' Library: '
|
||
|
O QSYBRARY06
|
||
|
O ' Type: '
|
||
|
O QSYOBJT13
|
||
|
O ' Text: '
|
||
|
O QSYOBJT14
|
||
|
OQPRINT E END_LIST 1
|
||
|
O '*** End of List'</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="listOverview.htm" title="List APIs return a list unique to a given API. The section discusses the characteristics of a list API and provides information that you should be aware of when you use list APIs.">List APIs overview</a></div>
|
||
|
</div>
|
||
|
<div class="relref"><strong>Related reference</strong><br />
|
||
|
<div><a href="listRPG.htm" title="This example program prints a report that shows all objects that adopt owner authority.">Example in RPG: List Object API</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|