Check out the latest COZTOOLS. A free runtime version of the Full COZTOOLS Software Product.
I just realized that my end-users are typically wanting to see their current job's SPOOL output, not everything they've ever printed. They really don't enjoy doing (for example) WRKSPLF and then press F18 and F11 to figure out which SPOOL files are from "today"
Of course there are these native IBM i CL commands:
The issue with WRKSPLF is as I just mentioned--too much data.
The issue with WRKOUTQ is that they could have multiple SPOOL files in different output queues, and again from different jobs.
The issue with WRKJOB is they can start playing with options other than option 4.
So i thought, why not go back to our roots, i.e., the S/38 CPF days when we'd write a helper CL command to do just about everything. What they really want is to use the WRKJOB command as follows:
Now its problematic to get end-users to type in a goofy parameter name (such as "OPTION") and get the syntax right every time.
So I thought, how about "WRKJOBSPLF" as a command name? But I really don't want to have a command definition and a CL program just to create a helper command. So I went back to the old issues of Q38 Technical Journal and saw the "CONSTANT" parameter I wrote about nearly 27 years go and got what I wanted quickly.
Here's the Command Definition Source for WRKJOBSPLF.
WRKJOBSPLF: CMD PROMPT('COZZI - Work Job SPOOL Files') PARM KWD(CMD) TYPE(*CMDSTR) LEN(32) + CONSTANT('WRKJOB OPTION(*SPLF)') PARM KWD(CMDLENGTH) TYPE(*DEC) LEN(15 5) + CONSTANT(32)
To create the command, use the CRTCMD command (yes, this is the "Create Command" command) and specify QCMDEXC as the Command Processing Program for the PGM parameter as follows:
CRTCMD CMD(WRKJOBSPLF) PGM(QCMDEXC) ALWLMTUSR(*YES)
When you type in WRKJOBSPLF you'll be sent directly to option 4 of the WRKJOB menu. This means they will bypass the menu itself just as if your user had typed in the full WRKJOB OPTION(*SPLF) command.
The command processing program is called whenever a user-written command is entered into the command line, or run from within a CL program. The Command itself is just a template for building the parameter list that is sent to the program.
By specifying QCMDEXC as the program to call, we know that QCMDEXC accepts a command string and command string length as its first two parameters. I simply force those values by specifying (in this case) 'WRKJOB OPTION(*SPLF)' as the CMD parameter and then hard-coded the length as the 2nd parameter, while defining it as Packed(15,5) which is required by QCMDEXC.
You can mimic this command and write your own short-cut command for anything you want. There is a limit on the CONSTANT parameter length, but I don't recall what it is right now--again this is for short-cuts now "macros".
Have a nice day!