COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-46
DELETE
Usage Considerations:
I-O Status Codes
If the file being closed has an associated file-status data item, the DELETE
statement assigns it an appropriate I-O status code. The possible I-O status codes
and their meanings are:
When the deletion is successful or the invalid-key condition occurs, these items are
not affected:
°
Record area
°
Data item specified in the DEPENDING phrase of the RECORD clause,
specifying the length of the record
°
Key of reference
°
File position indicator
Record Deleted When File Access Mode is Sequential
If the file’s access mode is sequential and the last operation performed on the file
was a successful READ statement, then DELETE logically removes from the file
the record that the READ statement retrieved. If the last operation performed on
the file was not a successful READ statement, DELETE terminates with I-O status
code “43.”
In a Pathway environment under the NonStop Transaction Management Facility
(TMF), the last operation on the file must have been a successful execution of a
READ LOCK statement (rather than a READ statement). For information on coding
servers, see the Pathway/TS SCREEN COBOL Reference Manual for your
system.
The record retrieved by the READ statement is deleted.
I-O Status Code Meaning
“00” The delete operation was successful.
“23” The designated record does not exist.
“30” The delete operation failed due to causes outside of COBOL. The
specified record might or might not have been deleted. The file
position indicator might be undefined.
“43” The delete operation failed because the last input-output
statement executed for the file (which is in the sequential access
mode) was not a successfully executed READ statement.
“49” The file was not open in the I-O mode or was not opened by an
HP COBOL program.