End Writer (ENDWTR)

The End Writer (ENDWTR) command ends the specified spooling writer and makes its associated output device available to the system. The writer can be ended immediately or in a controlled manner. If ended immediately, the writer stops writing the file and the file is made available again on the output queue. If ended in a controlled manner, the writer finishes writing the current file (or a copy of a file), or it finishes printing a page of the file, before it is ended.

Parameters

Keyword Description Choices Notes
WTR Writer Name, *ALL, *PRT, *RMT, *SYSVAL Required, Positional 1
OPTION When to end writer *CNTRLD, *IMMED, *PAGEEND Optional, Positional 2

Writer (WTR)

Specifies the spooling writer being ended. The writer's output device will then be available to the system.

This is a required parameter.

name
Specify the name of the writer to end.
*ALL
Specifies that all writers will be ended.
*PRT
Specifies that all printer writers are to be ended.
*RMT
Specifies that all remote writers are to be ended.
*SYSVAL
If a writer is started to the system default printer (the QPRTDEV system value) it will be ended.

When to end writer (OPTION)

Specifies when the writer should stop processing.

*CNTRLD
The spooling writer stops processing in a controlled manner. Output stops at the end of the spooled file (or copy of a file) currently being written to an output device.
*IMMED
The writer stops processing immediately. The spooled file that is currently printing remains on the output queue.
*PAGEEND
The writer is stopped after processing of the current buffer. This value is valid only if the spooling writer is a printer writer.

Examples

Example 1: End a specific writer

ENDWTR   WTR(PRINTER) OPTION(*CNTRLD)

This command stops the writer named PRINTER at the end of the spooled file whose output is being printed, and then releases the device to the system.

Example 2: End all the printer writers immediately

ENDWTR   WTR(*PRT) OPTION(*IMMED)

This command ends all the printer writers immediately. Remote writers are not affected.

Error messages

*ESCAPE Messages

CPF1317
No response from subsystem for job &3/&2/&1.
CPF1340
Job control function not performed.
CPF1352
Function not done. &3/&2/&1 in transition condition.
CPF1842
Cannot access system value &1.
CPF3313
Writer &1 not active nor on job queue.
CPF3330
Necessary resource not available.
CPF3331
Not authorized to control writer &3/&2/&1.
CPF3339
Previous end request to writer &3/&2/&1 pending.
CPF3438
*PAGEEND not valid for writer &3/&2/&1.