Lovelady's API Samples

Back to lovelady.com Music pages Unix sources RPG API Samples The TAO of Programming Fortune cookies Picture gallery

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:

crtusrspcCreate a user space, make it extendable, and return pointer
RTVJOBINFDemonstrates use of QUSRJOBI to retrieve long library list. Format JOBI0750 is used.
qjobDemonstrates use of QUSLJOB with the JOBL0200 format (to return select list of fields)




counter visitors since 8-July-2008

Quote of the day:"

"The most difficult thing in the world is to know how to do a thing and to watch someone else doing it wrong, without commenting."
    — T.H. White


Last updated: Dec 31, 1969 at 07:00PM America/New_York
image
There's no place like home
image
Write to me
Make a request