The following sample CL program uses the WSPDUPSPL API command to duplicate a spool file:
PGM

/****************************************************************/
/* DEFINE SPOOL FILE INFORMATION VARIABLES                      */
/****************************************************************/
DCL VAR(&SPLFNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBUSER) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
DCL VAR(&SPLNBR) TYPE(*CHAR) LEN(4)

/****************************************************************/
/* PRINT AS/400 REPORT                                          */
/****************************************************************/
CALL PGM(RPT001)

/****************************************************************/
/* RETRIEVE ORIGINAL SPOOL INFORMATION FROM REPORT JUST CREATED */
/****************************************************************/
WSPLNUM SPLF(RPT001P) JOB(*) SPLNBR(*LAST) +
RTNSPLF(&SPLFNAME) RTNJOBNAME(&JOBNAME) +
RTNJOBUSER(&JOBUSER) RTNJOBNUM(&JOBNBR) +
RTNSPLNUM(&SPLNBR) 

/****************************************************************/
/* DUPLICATE THE REPORT USING THE WSPDUPSPL API COMMAND         */
/****************************************************************/
WSPDUPSPL FILE(&SPLFNAME) JOB(&JOBNBR/&JOBUSER/&JOBNAME) SPLNBR(&SPLNBR) OUTQ (FORMS)    

ENDPGM

Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: December 10, 2016