*---------*---------------*-----------------*----------------*---------------* | CODE | FACTOR 1 | FACTOR 2 | RESULT | INDICATORS | | | | | FIELD | | *---------*---------------*-----------------*----------------*---------------* | DELET | Search | File name | | NR ER _ | | | argument | | | | *---------*---------------*-----------------*----------------*---------------*
The DELET operation deletes a record from a database file. The file must be an update file (identified by a U in position 15. of the file description specifications) The deleted record can never be retrieved.
If factor 1 contains no entry, the DELET operation deletes the current record (the last record retrieved). The record must have been locked by a previous input operation (for example, CHAIN or READ).
Factor 1, the search argument, can contain a key or relative record number that identifies the record to be deleted. If access is by key, factor 1 can be a field name, a named constant, or a literal. In addition, a KLIST name can be specified in factor 1 for an externally described file. If duplicate records exist for the key, only the first of the duplicate records is deleted from the file. If access is by relative record number, factor 1 must contain an integer literal or a numeric field with zero decimal positions.
Factor 2 must contain the name of the update file or the name of a record format in the file from which a record is to be deleted. A record format name is valid only with an externally described file. If factor 1 is not specified, the record format name must be the name of the last record read from the file; otherwise, an error occurs.
If factor 1 has an entry, you must specify a resulting indicator in positions 54 and 55. If factor 1 does not have an entry, leave these positions blank. This indicator is set on if the record to be deleted is not found in the file. You can specify a resulting indicator in positions 56 and 57; it is set on if the DELET operation is not completed successfully. (For example, an unauthorized user tries to delete the record) Leave positions 58 and 59 blank.
Under the OS/400 operating system, if a read operation is done on the file specified in factor 2 after a successful DELET operation to that file, the next record after the deleted record is obtained.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.