Hold WRKACTJOB Print
Q: I have a CL program that runs the Work with Active Jobs (WRKACTJOB) command, the Copy Spool File (CPY-SPLF) command and then a program and finally deletes the spool file and the database file I created. The problem is that when it runs from the console, it goes to the printer and prints. I can use the Hold Writer (HLDWTR) command at the start of the CL program and the Release Writer (RLSWTR) command at the end. But is this the best way to do it? I do not want to stop any prints in the middle.
- Willie Moore
A: Each OS/400 command that prints something uses a special (usually different) printer file. All you need to do is override the printer file with HOLD(*YES) before running the command; this way, the printout will come out already on hold. You don't have to hold (or end) the writer.
To find out which printer file you have to override, run the command you're interested in and use the Work with Spool Files (WRKSPLF) command to see the file name (it's the left-hand column). Therefore, your CL program would look like this:
OVRPRTF FILE(QPDSPAJB) HOLD(*YES) WRKACTJOB OUTPUT(*PRINT) CRTPF FILE(QTEMP/ACTJOBRPT) + RCDLEN(132) MONMSG MSGID(CPF0000) CPYSPLF FILE(QPDSPAJB) + TOFILE(QTEMP/ACTJOBRPT) + SPLNBR(*LAST) DLTSPLF FILE(QPDSPAJB) + SPLNBR(*LAST) DLTOVR FILE(QPDSPAJB)
WRKACTJOB uses printer file QPDSPAJB. I just found that out by using the method I mentioned. Other commands use different printer files-Display Object Description (DSPOBJD), for instance, uses QPRTOBJD.
Editor's note: For a generic solution to obtaining output to a database file for those commands that don't have outfile support, see the Convert Print to Physical File command in the "Using OUTPUT(*PRINT)" TechTalk of the March 1992 issue of MC.
- Ernie Malaga
LATEST COMMENTS
MC Press Online