RTVJOBINF
// Demonstrates use of QUSRJOBI to retrieve long library list. Format JOBI0750 is used.
* Retrieves the current job's library list, then prints each library name, along
* with an identification of placement within the library list (System, Product,
* Current, User)
* Example use of QUSRJOBI API by Dennis Lovelady http://www.lovelady.com
* Released to public domain 17-June-2009
FQSYSPRT O F 132 Printer
D RtvJobInf PR ExtPgm(QUSRJOBI)
D receiver 65535 Options(*VarSize)
D rcvrLen 10U 0 Const
D fmtName 8 Const
D job Const Like(qualJob)
D internalID 16 Const
D errorDS LikeDS(errorStr)
D/COPY QSYSINC/QRPGLESRC,QUSRJOBI
D/COPY QSYSINC/QRPGLESRC,QUSEC
D my0750 DS Qualified
D main LikeDS(QUSI0750)
D libraries 50000
D libEnt DS Based(pLib) likeDS(QUSQLL2)
D Library S 10
D errorStr DS Qualified Inz
D hdr LikeDS(QUSEC)
D errData 1024
D myUSEC DS LikeDS(errorStr) Inz
D qualJob DS
D jobname 10
D username 10
D jobnbr 6
D entType S 10
D entnbr S 10U 0
/Free
Clear myUSEC ;
myUSEC.hdr.QUSBPRV = %Size(myUSEC) ;
rtvJobInf(my0750: %Size(my0750): 'JOBI0750': '*': *Blanks: myUSEC) ;
If myUSEC.hdr.QUSBAVL = *Zero ; // No error found
// Library list is in my0750
pLib = %Addr(my0750) + my0750.main.QUSOSL00 ;
entType = 'System' ;
For entnbr = 1 to my0750.main.QUSNBRSL ; // For each system lib
Library = libEnt.QUSLN02 ;
except line ;
pLib += my0750.main.QUSLOLE ;
EndFOR ;
pLib = %Addr(my0750) + my0750.main.QUSOPL ;
entType = 'Product' ;
For entnbr = 1 to my0750.main.QUSNBRPL ;
Library = libEnt.QUSLN02 ;
except line ;
pLib += my0750.main.QUSLOLE ;
EndFOR ;
pLib = %Addr(my0750) + my0750.main.QUSOCL ;
entType = 'Current' ;
For entnbr = 1 to my0750.main.QUSNBRCL ;
Library = libEnt.QUSLN02 ;
except line ;
pLib += my0750.main.QUSLOLE ;
EndFOR ;
pLib = %Addr(my0750) + my0750.main.QUSOUL ;
entType = 'User' ;
For entnbr = 1 to my0750.main.QUSNBRUL ;
Library = libEnt.QUSLN02 ;
except line ;
pLib += my0750.main.QUSLOLE ;
EndFOR ;
Else ;
// TODO - Error handling
EndIF ;
*INLR = *On ;
/End-free
OQSYSPRT E LINE 1
O Library +0
O entType +1
This page is devoted to examples that demonstrate how to call certain IBM APIs from ILE-RPG on iSeries (System i, AS/400 or whatever its name is this week). Generally, any programs and/or snippets placed here are not intended to be plug-in solutions for whatever current problem, but are rather intended as a how-to by example. My hope is that some will benefit from these and will be able to roll their own improvements.
List of examples:
crtusrspc | Create a user space, make it extendable, and return pointer |
RTVJOBINF | Demonstrates use of QUSRJOBI to retrieve long library list. Format JOBI0750 is used. |
qjob | Demonstrates use of QUSLJOB with the JOBL0200 format (to return select list of fields) |
Quote of the day:"
"The best way to convince a fool he is wrong is to let him have his way." |