Strovent SystemsSign in
Reference

Delete spooled files and clear an output queue on IBM i

How to find, delete and clear spooled files with WRKSPLF, DLTSPLF and CLROUTQ, and which authority you need to remove someone else's output.

On IBM i, printed output waits in an output queue as spooled files until it is printed or removed. This page covers three commands and the authority rules.

Find them

WRKSPLF

shows your spooled files. To see someone else's, name the user in the first element of SELECT:

WRKSPLF SELECT(CASMITH *ALL *ALL *ALL *ALL *ALL)

SELECT takes, in order: user, print device, form type, user data, ASP and spooled file name. *CURRENT means your own files and *ALL means every user's. On the list panel the options include delete (option 4).

Delete one spooled file: DLTSPLF

DLTSPLF FILE(WEEKLY) JOB(000146/SMITH/PAYROLL5)

FILE is the spooled file name. JOB is the job that made it, as number/user/name. This removes only that file.

  • If the job made more than one file with that name, nothing is deleted, because SPLNBR(*ONLY) is assumed. Give the number with SPLNBR(n), or use *LAST.
  • If the file is being printed at that moment, printing stops at once and the file is removed. Data that has not been printed is lost.
  • FILE(*SELECT) deletes every spooled file that matches SELECT. This cannot be combined with JOB, SPLNBR, JOBSYSNAME or CRTDATE:
DLTSPLF FILE(*SELECT) SELECT(*CURRENT *ALL *ALL *ALL)

Check the selection with WRKSPLF first, with the same values.

Clear a whole output queue: CLROUTQ

CLROUTQ OUTQ(QPRINT)

CLROUTQ removes every spooled file that is waiting to be printed, including held files, from that queue. Files that are being printed at that moment, and files still receiving data from running programs, stay. If some entries could not be removed, the message CPF3417 reports how many were deleted and how many were not.

Authority

You can always control the spooled files you created. For other people's files, one of these must apply:

  • Your profile has spool control authority (SPCAUT(*SPLCTL)). This gives control of every spooled file in the output queues of libraries you can reach.
  • Your profile has job control authority (*JOBCTL), the output queue is operator-controlled (OPRCTL(*YES)), and you have *EXECUTE authority to its library.
  • The output queue's AUTCHK value gives you rights. *OWNER means only the queue's owner controls all its files. *DTAAUT means users with *CHANGE authority to the queue do.
  • A spooled file security exit program allows it.

Without these, DLTSPLF ends with CPF3492 (not authorized to spooled file), and CLROUTQ can end with CPF2207 (not authorized to the object). Ask the administrator, with the output queue name, the spooled file and your user ID.

Sources

Spotted a mistake? Email [email protected].