9 130 GET_SPLF_LIST_ENTRY

LANSA Technical

9.130 GET_SPLF_LIST_ENTRY

Þ Note: Built-In Function Rules.

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.

For use with

LANSA for i

YES

Not available for RDMLX.

Visual LANSA for Windows

NO

 

Visual LANSA for Linux

NO

 

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Req

Starting record number.

This must be 1 for the first use of this Built-In Function after each START_RTV_SPLF_LIST. On subsequent calls it will normally be one more than the last record returned on the previous call. This value must be a positive number greater than zero.

5

15

0

0

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Req

Last record number returned.

This will return the number of the last record returned in this list. This can be used to establish the starting record number for the next use of this function. The starting record for the next use should be this number plus one.

5

15

0

0

2

L

Req

Working list to contain details of the spool files retrieved. The calling RDML function must provide a working list with an aggregate entry length of exactly 160 bytes.

Each returned list entry is formatted as follows:

From - To   Description

1 - 10   A(10) Spool file Name

11 - 20   A(10) Job Name 

21 - 30   A(10) User

31 - 36   A(6) Job Number

37 - 40   A(4) Spool file Number

41 - 44   P(7,0) Total Pages

45 - 48   P(7,0) Current Page

49 - 52   P(7,0) Copies left to print

53 - 62   A(10) Output Queue name

63 - 72   A(10) Output Queue Library

73 - 82   A(10) User Data

83 - 92   A(10) Status

93 - 102   A(10) Form Type

103 - 104   A(2) Priority

105 - 136   A(32) Reserved

137 - 146   A(10) Device type

147 - 160   A(14) Reserved

160

160

 

 

3

A

Opt

Return code

OK = list returned partially or completely filled. No more spool files exists for the selection.

OV = list returned completely filled, and more spool files exist.

NR = list was returned empty.

ER = error encountered in retrieval of spool files. Starting record may be invalid.

2

2

 

 

 

 

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