System i release 6.1 added the option of customizing various spooled file panels with your own list actions. This new facility allows you to perform commands and actions in an exit program against one or more spooled files shown in the list panels displayed when running any of the following system commands:
- Work with Printer Output (WRKSPLF ASTLVL(*BASIC))
- Work with Spooled Files (WRKSPLF ASTLVL(*INTERMED))
- Work with Job Spooled Files (WRKJOB OPTION(*SPLF))
- Work with Output Queue (WRKOUTQ Output queue name)
- Work with Spooled File Status (WRKSPLF DSPFMT(*S36FMT))
You add a customized option by registering an exit program performing the list action in question using the registration facility for exit point QIBM_QSP_SPLF_LSTACT. You specify your exit program and the option you’d like to add in the range of A to Z as input to the exit program registration. You can only register one exit program for each option.
Once registered, your exit program is called whenever the specified option is entered for one or more spooled files in the list panels servicing the above array of system commands. When the system calls the exit program all spooled files attributes uniquely identifying the selected spooled file is passed in a data structure as a parameter to the exit program, thereby providing the means for you to perform various actions against the spooled file in the exit program.
The exit point is fully documented here, at the IBM Information Center, including the parameters used when calling a spooled file list action exit program.
Here’s how you’d register a list action ‘C’ to be performed in the Work with spooled file system panels:
AddExitPgm ExitPnt( QIBM_QSP_SPLF_LSTACT )
Format( LASP0100 )
PgmNbr( *LOW )
Pgm( QGPL/CBX801XC )
Text( 'Spooled file list action ''C''' )
PgmDta( *JOB 1 'C' )
Following the execution of the above command program CBX801XC in library QGPL is called when option ‘C’ is specified for a spooled file in one of the list panels mentioned. It then relies on the CBX801XC program to perform whatever action is required for option ‘C’. I have included an CBX801XC exit program example with this article that will run the Convert Spooled File to Stream File (CVTSPLSTMF) command published in the System iNews magazine by Peter Clifford some years ago.
You can find Peter’s article as well as a download link to the CVTSPLSTMF utility here.
At the point that the CVTSPLSTMF command was published, only 4 digit (1-9999) spooled file numbers were supported on the System i. This has changed to 6 digits now (1-999999). I have updated the command definition and the command processing program to support 6 digits and included the two revised source members with this article, in case you want to take advantage of the 6 digit support when running the CVTSPLSTMF command. To further ease the use of spooled file list actions I have also created three commands enabling you to easily register, deregister as well as work with spooled file list actions.
The Add Spooled File Action (ADDSPLFACT) command prompt has the following appearance:
Add Spooled File Action (ADDSPLFACT)
Type choices, press Enter.
Spooled file action . . . . . . A-Z
Exit program . . . . . . . . . . Name
Library . . . . . . . . . . . Name, *CURLIB
Program number . . . . . . . . . *LOW 1-2147483647, *LOW, *HIGH
Text 'description' . . . . . . . *BLANK
Threadsafe . . . . . . . . . . . *UNKNOWN *UNKNOWN, *NO, *YES
Multithreaded job action . . . . *SYSVAL *SYSVAL, *RUN, *MSG, *NORUN
Additional Parameters
Replace existing entry . . . . . *NO *YES, *NO
You specify the spooled file action as well as the exit program to support it and for the rest of the parameters you will normally get away with leaving the default values in place. The Remove Spooled File Action (RMVSPLFACT) command prompt is a little bit simpler:
Remove Spooled File Action (RMVSPLFACT)
Type choices, press Enter.
Program number . . . . . . . . . 1-2147483647, *LOW, *HIGH
Here you simply specify the exit program number. Since this command will normally be used from the Work with Spooled File Action list panel, you will have no problems identifying the actual spooled file action being removed. To display the aforementioned list panel, you execute the WRKSPLFACT command:
Work with Spooled File Action (WRKSPLFACT)
Type choices, press Enter.
Spooled file action . . . . . . *ALL A-Z, *ALL
+ for more values
Select:
Exit program . . . . . . . . . *ANY Name, *ANY
Library . . . . . . . . . . *ANY Name, *ANY
Leaving the command defaults in place leads to all currently registered spooled file actions being listed, but you also have the option of subsetting the list by spooled file action(s) as well as exit program and/or exit program library. Registering the spooled file list action C mentioned earlier causes the list panel below to be displayed:
Work with Spooled File Actions WYNDHAMW
09/12/10 06:55:10
Spooled file action . : QIBM_QSP_SPLF_LSTACT
Text . . . . . . . . . : User-defined spooled file list actions
Type options, press Enter.
2=Replace 4=Remove 5=Work with program
Exit
Opt Action Text Format
C Spooled File List Action 'C' LASP0100
Bottom
Parameters or command
===>
F3=Exit F6=Add spooled file action F11=View 2 F12=Cancel
F16=Work with registration information F21=Print list F24=More keys
The above panel allows you to replace, remove and add spooled file actions plus working with the registered exit programs and using various function keys to perform relevant tasks. Function key F11 toggles the list view to include more information about each spooled file list action. All columns and panel areas are explained in more detail using the cursor sensitive help text. Simply point the cursor to the column or area of interest and press function key F1.
Download all the source code here.
To help you build the commands and associate objects, I have supplied the CL program CBX801M. Call the program supplying the name of the library where you have placed the source code, as in CALL CBX801M PARM(UTILITIES). You must first place the source code into the standard source files(QCMDSRC, QRPGLESRC, QPNLSRC and QCLSRC).
The following sources are involved in creating the WRKSPLFACT command:
CBX801 -- RPGLE -- Work with Spooled File Actions
CBX801E -- RPGLE -- Work with Spooled File Actions - UIM General Exit
CBX801H -- PNLGRP -- Work with Spooled File Actions - Help
CBX801P -- PNLGRP -- Work with Spooled File Actions - Panel Group
CBX801X -- CMD -- Work with Spooled File Actions
CBX8012 -- RPGLE -- Add Spooled File Action - CPP
CBX8012H -- PNLGRP -- Add Spooled File Action - Help
CBX8012V -- RPGLE -- Add Spooled File Action - VCP
CBX8012X -- CMD -- Add Spooled File Action
CBX8013 -- RPGLE -- Remove Spooled File Action - CPP
CBX8013H -- PNLGRP -- Remove Spooled File Action - Help
CBX8013X -- CMD -- Remove Spooled File Action
CBX801M -- CLP -- Spooled File Actions - Build commands
CBX801XC -- CLP -- UIM Spooled File List Action 'C' Exit Program
CVTSPLSTMF -- CMD -- Convert Spool to Stream File
CVTSPLSTMC -- CLLE -- Convert Spool to Stream File - CPP