Simple example of creating a list of system objects...
This example lists outqueues on the system.
This example lists outqueues on the system.
PHP Code:
H Option(*SrcStmt: *NoDebugIO) DftActGRP(*No)
*
* Field Definitions.
* ~~~~~~~~~~~~~~~~~~~~~~~~
D ObjNam s 10a
D ObjLib s 10a
D ObjTyp s 10a
**-- Api error data structure: ----------------------------------
D ApiError Ds
D AeBytPro 10i 0 Inz( %Size( ApiError ))
D AeBytAvl 10i 0 Inz
D AeMsgId 7a
D 1a
D AeMsgDta 128a
**-- Object description structure OBJD0200: ---------------------
D RoData Ds
D RoBytRtn 10i 0
D RoBytAvl 10i 0
D RoObjNam 10a
D RoObjLib 10a
D RoObjTypRt 10a
D RoObjLibRt 10a
D RoObjASP 10i 0
D RoObjOwn 10a
D RoObjDmn 2a
D RoObjCrtDts 13a
D RoObjChgDts 13a
D RoExtAtr 10a
D RoTxtDsc 50a
D RoSrcF 10a
D RoSrcLib 10a
D RoSrcMbr 10a
dTheData DS
d QUSBR05 10i 0
d QUSBA05 10i 0
d QUSJN08 10
d QUSUN07 10
d QUSJNBR07 06
d QUSIJID05 16
d QUSJS14 10
d QUSJT08 01
d QUSJS15 01
d QUSJS16 08
d QUSES00 01
d QUSSN00 10
d QUSSL06 10
d QUSCUN 10
d QUSDE 01
d QUSEK 01
d QUSCK00 01
d QUSPRC 10i 0
d QUSURC 10i 0
d QUSPGMRC 10i 0
d QUSSE02 10
d QUSDN 10
d QUSGPN 10
d QUSGRP 10 DIM(00015)
d QUSGN00 10 OVERLAY(QUSGRP:00001)
d QUSJUID 10
d QUSJUIDS 01
*
* Field Definitions.
*
d AllText s 10 Inz('*ALL')
d CmdString s 256
d CmdLength s 15 5
d Count s 4 0
d Format s 8
d GenLen s 8
d InLibrary s 10
d InType s 10
d ObjectLib s 20
d SpaceVal s 1 inz(*BLANKS)
d SpaceAuth s 10 inz('*CHANGE')
d SpaceText s 50 inz(*BLANKS)
d SpaceRepl s 10 inz('*YES')
d SpaceAttr s 10 inz(*BLANKS)
d UserSpaceOut s 20
d Worktype s 10 inz('*OUTQ')
* ?
* GenHdr ?
* ?
d GenHdr ds inz
d OffSet 10i 0
d OffSet2 10i 0
d NumEnt 10i 0
d Lstsiz 10i 0
* ?
* Data structures ?
* ?
d GENDS ds
d OffsetHdr 10i 0
d OffsetHdr2 10i 0
d NbrInList 10i 0
d SizeEntry 10i 0
*
d HeaderDs ds
d OutFileNam 10
d OutLibName 10
d OutType 05
d Outfiller 05
d OutFormat 10
d RecordLen 10i 0
*
* API Error Data Structure
*
d ErrorDs DS INZ
d BytesPrv 10i 0
d BytesAvl 10i 0
d MessageId 07
d ERR### 01
d MessageDta 99
*
d DS
d StartPosit 10i 0
d StartLen 10i 0
d SpaceLen 10i 0
d ReceiveLen 10i 0
d MessageKey 10i 0
d MsgDtaLen 10i 0
d MsgQueNbr 10i 0
*
* Date structure for retriving userspace info
*
d InputDs DS
d UserSpace 1 20
d SpaceName 1 10
d SpaceLib 11 20
d InpFileLib 29 48
d InpFFilNam 29 38
d InpFFilLib 39 48
d InpRcdFmt 49 58
*
d ObjectDs ds
d Object 10
d Library 10
d ObjectType 10
d InfoStatus 1
d ExtObjAttrib 10
d Description 50
**-- Retrieve object description: -------------------------------
d RtvObjD Pr ExtPgm( 'QUSROBJD' )
d RoRcvVar 32767a Options( *VarSize )
d RoRcvVarLen 10i 0 Const
d RoFmtNam 8a Const
d RoObjNamQ 20a Const
d RoObjTyp 10a Const
d RoError 32767a Options( *VarSize )
**-- List objects: ---------------------------------------------
d $ListObjects Pr ExtPgm( 'QUSLOBJ' )
d userspace 20a Const
d format 8a Const
d objectlib 20a Const
d type 10a Const
**-- Userspace pointer: ------------------------------------------
d $Userspace Pr ExtPgm( 'QUSRTVUS' )
d userspace 20a Const
d start 10i 0 Const
d Length 10i 0 Const
d Returned 32767a Options( *VarSize )
**-- Create Space: ---------------------------------------------
d $CreateSpace Pr ExtPgm( 'QUSCRTUS' )
d UserSpaceOut 20a Const
d SpaceAttr 10 Const
d SpaceLen 10i 0 Const
d SpaceVal 1a Const
d SpaceAuth 10a Const
d SpaceText 50a Const
d SpaceRepl 10a Const
d ErrorDs 32767a Options( *VarSize )
/free
exsr $QUSCRTUS;
ObjectLib = '*ALL ' + '*LIBL';
//
// List all the outqueues to the user space
//
Format = 'OBJL0200';
$ListObjects( Userspace : Format : ObjectLib : WorkType);
//
// Retrive header entry and process the user space
//
StartPosit = 125;
StartLen = 16;
$UserSpace( Userspace : StartPosit : StartLen : GENDS);
StartPosit = OffsetHdr + 1;
StartLen = %size(ObjectDS);
//
// Do for number of outqueues in the userspace ?
//
B1 for count = 1 to NbrInList;
$UserSpace( Userspace : StartPosit : StartLen : ObjectDs);
StartPosit += SizeEntry;
endfor;
*INLR = *On;
//--------------------------------------------------------
// $QUSCRTUS - create userspace
//--------------------------------------------------------
begsr $QUSCRTUS;
BytesPrv = 116;
Spacename = 'LISTOUTQS';
SpaceLib = 'QTEMP';
//
// Create the user space
//
$CreateSpace( Userspace : SpaceAttr : 4096 :
SpaceVal : SpaceAuth : SpaceText : SpaceRepl:
ErrorDs);
endsr;
/End-Free
Comment