DELETE Function

Deletes an attribute, value or subvalue from a dynamic array and returns the modified array.

Syntax

DELETE(dyn-array,attr#{,value#{,subval#}})

Note

The DELETE function has been replaced by DEL statement, but has been retained for compatibility.

Syntax Elements

dyn-array is the name of the dynamic array.

attr# is the number of the attribute within the dynamic array. If you specify a nonzero value for attr# and a zero for both value# and subval#, the entire attribute is deleted.

value# is the value number within the attribute. If you specify a nonzero value for both attr# and value# and a zero for the subval#, then the specified value is deleted.

subval# is the subvalue number within the value. If you specify nonzero values for attr#, value# and subval#, then the specified subvalue is deleted.

Examples

OPEN '','INVENTORY' ELSE STOP
READ VALUE FROM 'ITEM2' ELSE STOP
VALUE = DELETE(VALUE,1,2,3)
WRITE VALUE ON 'ITEM2'

Deletes the third subvalue, and associated delimiter, of the second value of the first attribute in item ITEM2 in the INVENTORY file.

OPEN 'TEST' ELSE STOP
READ X FROM 'NAME' ELSE STOP
WRITE DELETE(X,2,0,0) ON 'NAME'

Deletes the second attribute and its associated delimiter in item NAME in file TEST.

X = "ABC]123^DEF]456^GHI]789"
A = "1";
B = "0"
PRINT DELETE(X,A,A-B,B)

Deletes value 1 of attribute 1 in dynamic array X and prints the result.