Command reference / file

DLTF

Delete File

Deletes one or more files. Deleting a database file (physical or logical) also deletes all of its members. A physical file can be deleted only if no logical files are based on it. Deleting an ICF file also deletes its program device entries. A file that is open is not deleted. A generic-name delete removes every eligible file and sends a diagnostic message for each file it cannot delete. Logical files must be deleted before the physical files they are based on, and SQL views before the files, tables or views they are based on.

Allowed environments: *ALL. Positional parameters: 1.

Restrictions

Parameters

FILE File

Specifies the file or files to delete, by specific or generic name. This parameter is required. Parent and dependent files of a referential constraint can be deleted. Deleting a dependent file also removes its constraint relationships and foreign keys.

Type
*QUAL
Required
Yes
Case
Uppercase
*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the job is searched. If there is no current library in the library list, QGPL is searched.
*USRLIBL
If a current library entry exists, the current library and the user portion of the library list are searched. Otherwise only the user portion is searched.
*ALL
All libraries in the system, including QSYS, are searched. For a specific name, the first object found is deleted.
*ALLUSR
All user libraries are searched. These are libraries whose names do not begin with Q, plus certain IBM Q-libraries that hold frequently changing user data.
Qualified parts (object, then library; write LIBRARY/OBJECT)

File File

Type
*GENERIC
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB, *USRLIBL, *ALL, *ALLUSR

SYSTEM System

Specifies whether the file is deleted from the local system or from a remote system.

Type
*CHAR
Required
No
Default
*LCL
Length
5
Case
Uppercase

Allowed values: *LCL, *RMT, *FILETYPE

*LCL
The file is deleted from the local system.
*RMT
The file is deleted from a remote system. A DDM file must be specified for FILE, and it identifies both the file and the remote system.
*FILETYPE
If FILE is not a DDM file, the file is deleted locally. If it is a DDM file, the remote file identified in it is deleted.

RMVCST Remove constraint

Specifies how much of the constraint relationships in dependent files is removed when a parent file of a referential constraint is deleted.

Type
*CHAR
Required
No
Default
*RESTRICT
Length
9
Case
Uppercase

Allowed values: *RESTRICT, *REMOVE, *KEEP

*RESTRICT
The parent file is not deleted, and the constraint is not removed, if a relationship exists with a dependent file. The foreign key access path and foreign key are kept.
*REMOVE
The constraint relationship is removed, along with the corresponding foreign key access path (if it exists and is not shared) and the dependent file's foreign key.
*KEEP
The constraint relationship is no longer established, but its definition is kept. The foreign key access path and foreign key are not removed.

Examples

DLTF FILE(BILLING/ORDERS)

Deletes file ORDERS in library BILLING. Only the BILLING library is searched for the file.

DLTF FILE(BILLING/QUERIES) RMVCST(*KEEP)

Deletes file QUERIES in library BILLING, which is a parent file of a referential constraint. The constraint relationship is removed, but its definition is kept.

IBM command documentation

Generated from os/cl/catalog/DLTF.json and os/cl/help/DLTF.json.