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
- Requires *OBJEXIST and *OBJOPR authority on the file, and *EXECUTE authority on the library.
- A physical file must not be deleted while a logical file uses its data. Delete the logical file first.
- A physical file or SQL view in the select-list of an SQL materialized query table cannot be deleted. Delete the materialized query table first.
- When debugging with UPDPROD(*NO) on STRDBG or CHGDBG, a physical file that contains data and is in a production library cannot be deleted.
- Conditionally threadsafe. In multithreaded jobs it is not threadsafe for distributed files, which fail for distributed files that use *SNA relational databases. It also fails for *SNA DDM files when SYSTEM(*RMT) or SYSTEM(*FILETYPE) is specified.
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.
*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
Library
Library
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.
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.
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.
Generated from os/cl/catalog/DLTF.json and os/cl/help/DLTF.json.