PURGE

Purge a channel

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
PURGE channel

channel

The channel to purge. (n)

The PURGE statement completes any pending I/O, terminates the association of a channel with a file, and deletes the file if it was opened in output mode.

When a channel is purged, all locks on the specified channel are released and the channel is available for future use. After a channel is purged, an I/O statement cannot reference that channel until an OPEN statement reactivates it.

If channel is a serial or terminal device, the runtime flushes the input and output buffers (thus canceling any pending output) and resumes any suspended output.

Tip

To guarantee that all data written to the device is transmitted, use the CLOSE statement.

If channel is opened in output mode, the PURGE statement deletes the output file. If channel is not opened in output mode, PURGE performs the same function as a CLOSE statement.

Note

If you specify the TEMPFILE qualifier when opening a file in output mode, and a file with the same name already exists, the existing file is still present after a PURGE is executed. However, if you open an existing file in output mode without the TEMPFILE qualifier specified, the existing file is deleted on the OPEN.

TEMPFILE qualifier

See CLOSE for an example of the PURGE statement.