One of the first commands we all learn with IBM i is the Work with Spool Files command, WRKSPLF. With IBM i releases 7.5 and 7.4 TR6 comes a new SQL Table Function that is the equivalent of WRKSPLF.
The new Table Function, SPOOLED_FILE_INFO is found in library QSYS2, has parameters that match those of the WRKSPLF command. The syntax for the Table Function is:
SELECT * FROM TABLE(QSYS2.SPOOLED_FILE_INFO( USER_NAME => '*CURRENT', STARTING_TIMESTAMP => CURRENT_TIMESTAMP - 6 MONTHS, ENDING_TIMESTAMP => CURRENT_TIMESTAMP - 2 DAYS, STATUS => '*READY *HELD', JOB_NAME => '*', OUTPUT_QUEUE => '*LIBL/MYOUTQ', USER_DATA => 'SQL', FORM_TYPE => '*STD', SYSTEM_NAME => 'DEV750')) |
These parameters and their WRKSPLF equivalents are: