Chapter Contents

Previous

Next
DELLIST

DELLIST



Deletes a list and optionally deletes all of its sublists

Category: List


Syntax
Details
See Also

Syntax

rc=DELLIST(list-id<,recursively>);

rc
contains the return code for the operation:
0 successful
[ne]0 not successful

Type: Numeric

list-id
is the identifier of the list to be deleted. An invalid list-id produces an error condition.

Type: Numeric or List

recursively
specifies whether to recursively delete all the list's sublists and all sublists of its sublists.
'N' Sublists are not deleted. (This is the default.)
'Y' Sublists are deleted.

Type: Character


Details

A list's contents cannot be retrieved after the list is deleted.

If recursively is 'Y', DELLIST recursively deletes all sublists that do not have the NODELETE attribute. For sublists that have the NODELETE attribute, the sublist identifiers are removed from the deleted list, but the sublist is not deleted. Thus, you should store list identifiers for sublists either in another list or in an SCL variable so that you can access the lists later. All local lists that are not explicitly deleted are deleted when the application ends, at the same time that SCL closes open tables and files.

CAUTION:
Be careful when deleting lists recursively because you may inadvertently delete lists that are needed by other parts of the SCL program. Recursively deleting a list deletes all of its sublists even if they are referenced in other SCL lists or by other SCL variables. If you do not want a list to be deleted when it is a sublist item in a deleted list, use SETLATTR to assign the NODELETE attribute to the sublist. See SETLATTR for a discussion of the NODELETE attribute.  [cautionend]

To conserve memory, delete lists when they are no longer needed. Typically, a DELLIST statement is placed in the termination section (TERM or FSETERM) of the program. Although the program that creates a list is most often responsible for deleting the lists that it creates, it does not have to delete them unless that is the appropriate action for the application; it may return the list that it created to its caller.

The list is not deleted, and a non-zero value is returned to rc, if

To check attributes, use HASATTR. To change attributes, use SETLATTR.

If DELLIST fails because of a condition listed above, the list and/or sublists may be partially cleared, and no further items or sublists are cleared.

See Also

CLEARLIST

DELITEM

DELNITEM

SETLATTR


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.