DISCARD FILE

Remove a FILE definition.

Syntax

Warning: System commands are powerful as they provide information about the state of the system and allow changes to be made to it. System commands should be used only by authorized applications and users.

Activate security checks on commands by specifying the XCMD system initialization parameter and by ensuring that command security checking is active for the transaction (either by specifying CMDSEC(YES) on the TRANSACTION resource definition or by specifying ALWAYS on the CMDSEC system initialization parameter).

DISCARD FILE

Read syntax diagramSkip visual syntax diagramDISCARD FILE( data-value)

Conditions: FILENOTFOUND, INVREQ, NOTAUTH

NOHANDLE, RESP, and RESP2 are common options that can be added to all EXEC CICS commands to process error conditions. They are not explicitly included in the command syntax diagram and option descriptions. For information about these common options and EXEC CICS command syntax, see EXEC CICS command format and programming considerations.

Description

The DISCARD FILE command removes the definition of a file from the local CICS® system, so that the system no longer has access to the file; that is, it revokes the earlier installation of a FILE resource definition of the same name.

A file must be closed and disabled for its definition to be discarded. In addition, if the file is recoverable, it cannot be discarded until all retained locks on it are released. A lock is retained when a failure causes a unit of work which has modified the file to be shunted (held for later disposition, because recovery action is required before disposition can be completed).

You cannot discard a FILE resource that is created by a BUNDLE resource. To discard the file, you must disable and discard the BUNDLE resource.

See Discarding resource definitions for general information about discards.

Options

FILE(data-value)
specifies the 8-character name of the file that is to be removed.

You cannot remove the definition of a file whose name begins with the letters DFH, because such files are reserved for CICS.

Conditions

FILENOTFOUND
RESP2 values:
18
The file cannot be found.
INVREQ
RESP2 values:
2
The file is not closed.
3
The file is not disabled.
25
The FILE definition is currently in use.
26
The file cannot be discarded because its name begins with DFH.
43
The file cannot be discarded because it has deferred work outstanding, for which there are retained locks.
300
The resource cannot be discarded because it was installed by a BUNDLE resource.
NOTAUTH
RESP2 values:
100
The user associated with the issuing task is not authorized to use this command.
101
The user associated with the issuing task is not authorized to access this particular resource in the way required by this command.