Note: Built-In Function Rules Usage Options
This Built-In Function is used in conjunction with START_RTV_SPLF_LIST and END_RTV_SPLF_LIST. The START_RTV_SPLF_LIST must be used first to provide the selection criteria for the retrieval of spool files. The selection criteria which can be specified are User Name, Output queue name and library, Form Type, User Data and Status. Once the START_RTV_SPLF_LIST has been used to establish the selection, this Built-In Function, GET_SPLF_LIST_ENTRY can be used to retrieve the details of the spool files. The END_RTV_SPLF_LIST must be used after the list of spool files have been retrieved. This will close the list and release the storage allocated to that list.
Arguments
|
Return Values
|
Example
A user wants to retrieve all the spool files on output queue PAYOUTQ in library PAYLIB and then perform some processing on each spool file.
********* Define arguments and lists
DEFINE FIELD(#RETURN) TYPE(*CHAR) LENGTH(2)
**********
DEFINE FIELD(#SPLF) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#JOB) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#USER) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#JOBNO) TYPE(*CHAR) LENGTH(6)
DEFINE FIELD(#SPLFNO) TYPE(*CHAR) LENGTH(4)
DEFINE FIELD(#TOTPAGE) TYPE(*DEC) LENGTH(7) DECIMALS(0)
DEFINE FIELD(#CURPAGE) TYPE(*DEC) LENGTH(7) DECIMALS(0)
DEFINE FIELD(#COPIES) TYPE(*DEC) LENGTH(7) DECIMALS(0)
DEFINE FIELD(#OUTQ) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#OUTQL) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#USERDATA) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#STATUS) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#FORM) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#PRTY) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#RESV1) TYPE(*CHAR) LENGTH(32)
DEFINE FIELD(#DEVICE) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#RESV2) TYPE(*CHAR) LENGTH(14)
**********
DEFINE FIELD(#START) TYPE(*DEC) LENGTH(7) DECIMALS(0) DEFAULT(0)
DEFINE FIELD(#LASTREC) TYPE(*DEC) LENGTH(7) DECIMALS(0) DEFAULT(0)
**********
DEF_LIST NAME(#LIST) FIELDS((#SPLF) (#JOB) (#USER) (#JOBNO) (#SPLFNO) (#TOTPAGE) (#CURPAGE) (#COPIES) (#OUTQ) (#OUTQL) (#USERDATA) (#STATUS) (#FORM) (#PRTY) (#RESV1) (#DEVICE) (#RESV2)) COUNTER(#LISTCOUNT) TYPE(*WORKING)
**********
********** Retrieve spool files on output Q PAYLIB/PAYOUTQ
**********
USE BUILTIN(START_RTV_SPLF_LIST) WITH_ARGS('''*ALL''' PAYOUTQ PAYLIB) TO_GET(#RETURN)
IF COND('#RETURN = OK')
**********
CLR_LIST NAMED(#LIST)
BEGIN_LOOP
USE BUILTIN(GET_SPLF_LIST_ENTRY) WITH_ARGS(#START) TO_GET(#LASTREC #LIST #RETURN)
IF COND('(#return = ER) *OR (#return = NR)')
LEAVE
ENDIF
SELECTLIST NAMED(#LIST)
*********
********** At this point some processing on the spool file can
********** be done.
********** eg IBM i commands such as CPYSPLF DLTSPLF
********** or release (RLSSPLF) all files which are currently
********** held (have a status of *HELD)
**********
ENDSELECT
IF COND('(#return = OV)')
CHANGE FIELD(#START) TO('#LASTREC + 1')
ELSE
LEAVE
ENDIF
END_LOOP
**********
USE BUILTIN(END_RTV_SPLF_LIST)
ENDIF