delete() function

The delete() function removes a specific attribute, value, or subvalue from a dimensioned or dynamic array.

Syntax

delete(dyn.array.exp, ac.exp)
delete(dyn.array.exp, ac.exp, vc.exp)
delete(dyn.array.exp, ac.exp, vc.exp, sc.exp)

Parameter(s)

dyn.array.exp Dynamic array from which the specified attribute, value, or subvalue will be deleted.
ac.exp Attribute to delete.
vc.exp Value to delete.
sc.exp Subvalue to delete.

Description

The delete() function returns a copy of the dynamic array without the deleted element. It does not change the original string unless specifically designated in an assignment statement.

CAUTION:
Attempting to delete attribute 0 is undefined and should be avoided.

Example(s)

This example deletes the value red from the dynamic array names. The reference to attribute 1 is required. The absence of attribute marks in colors requires it be treated as a single attribute.

equ vm to char(253)
colors = "blue":vm:"green":vm:"red":vm:"yellow"
names = delete(colors,1,3)

read cust.item from cust.file,item-ID else cust.item = ""
locate(date(),cust.item,date.flds;vx) then
write delete(cust.item,date.flds,vx) on cust.file,item-ID
end