Delete STATEMENT

PURPOSE:  The DELETE statement sets the last record retrieved by a GET statement to the deleted state in the auxiliary DS.  The execution of this statement cause @AUX to be set to "yes" if it was successful.

SYNTAX

DELETE /FROM/ designator [HUSH] [IF; UNLESS clause]

designator

is the designator specified in a prior GET statement.

Example

GET PRIOR FROM AUX5 HUSH
.
.
.
DELETE FROM AUX5 HUSH IF QUANTITY = 0

NOTES:  Any DS that is accessed by a DELETE statement must be related in the RELATE statement with the option UPDATE.

DELETE cannot be used without a prior GET.

Deletion of a record leaves an empty space in the DS.

The value in the system field @AUX reflects the results of the last operation attempted on an auxiliary DS.  @AUX will be set to yes if the operation was successful.

@AUX  =

close if the data set was not open when the statement was executed.

@AUX  =

NODEL if the record has been altered by any PM statement if an index is related. The key field could have been altered and ACCENT R would delete the wrong record from the DI.

@AUX  =

LOCK if attempting to delete a record in a data set related with the allowing clause and the record was no LOCKED.

@AUX  =

MISSI if no record has been read by a GET statement yet.

@AUX  =

NODEL if the data set schema has the specification “DISALLOW INPLACE DELETES”.

@AUX  =

DELETE if the record has already been deleted.

Transaction and master records can be deleted using the SETUP statement.