DEL Statement

Deletes an attribute, value or subvalue from a dynamic array.

Note

Use of the DEL statement makes the DELETE function obsolete.

Syntax

DEL dyn-array<attr#{,value#{,subval#}}>

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 dyn-array.

If you specify a nonzero value for attr# and value# and a zero for subval#, 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.

Operation

Whether an attribute, value or subvalue is deleted depends on the value of the value# and subval#, if present.

In deletions, values other than positive integers are illogical dynamic array indices. Positional expressions (attr#, value#, and subval#) are evaluated as follows:

Non-numeric expressions print a warning message and default to zero.

Noninteger expressions truncate the decimal value. For example, 1.7 and 1.2 become 1.

All trailing zero-valued positional expressions (except attr#) are ignored.

Any remaining zero-valued positional expressions are treated as ones.

Negative values cause the statement to have no effect.

If the positional expressions specify a nonexistent position or the dynamic array is initially null, the statement has no effect.

If you try to delete the first attribute (value or subvalue) of an item that has no attribute marks, the item is made null instead. The trailing delimiter, if any, is removed.

Example 1

DEL ITEM<3>

Deletes the third attribute in the dynamic array ITEM.

Example 2

DEL A<X,Y>

Deletes the Y'th value in the X'th attribute in dynamic array A.

Example 3

DEL ORDER<I,J,3>

Deletes the third subvalue in the value specified by J in attribute indicated by I.

Note

In the following examples:

S = "1\2\3]11\22]333^XXX^A\B\C]AA"

Example 4

DEL S<1,2.4>

2.4 is truncated to 2 and the result is 1\2\3]333^XXX^A\B\C]AA

Example 5

DEL S<1,2,5>

Specifies a nonexistent position, so the statement is ignored and S remains unchanged.

Example 6

DEL S<2,1>

Because attribute 2 (XXX) has no value or subvalue marks, attribute 2 is made null, and the result is 1\2\3]11\22]333^^A\B\C]AA.

Example 7

DEL S<3,0,0>

The trailing zeroes are ignored. The third attribute is deleted, and the result is 1\2\3]11\22]333^XXX.