Distributed Systems Network Management (DSNM) Subsystem Interface Development Guide
Scanning a List
3-26
109759—Distributed Systems Network Management (DSNM) Subsystem Interface
Development Guide
I Process Development Process
Scanning a List
The following examples illustrate methods of scanning lists:
•
This example scans a list forward:
@lm := _NULL;
WHILE _NOTNULL (@lm := _SUCCESSOR^LM (list,lm) DO
 BEGIN
 ...
 END;
•
In the next example, the user waits for a new last member to be added to the end of a 
list by keeping a previous member pointer. After finding a _NULL, @lm is returned 
to its previous setting. @lm can be used later in _SUCCESSOR^LM to retrieve a 
new later member, if one has been added, or another _NULL, if one has not been 
added.
@lm := @nextlm := _NULL;
WHILE _NOTNULL (@lm := _SUCCESSOR^LM (list,lm) DO
 BEGIN
 @nextlm := @lm;
 ....
 END;
@lm := @nextlm;
Processing a List
Normally, you process a list either by _PUT^LM plus _GET^LM or by _PUSH^LM 
plus _POP^LM, but not both. _PUT^LM is identical to _PUS^†HLM, providing 
different sets of primitives for first-in, first-out (FIFO) and last-in, first-out (LIFO) 
processing, respectively. Adding a list member (_PUT^LM or _PUSH^LM) allocates 
new memory for the member. 
Removing a member (_GET^LM or _POP^LM) does not deallocate memory 
immediately: the member's memory remains allocated and its contents usable until the 
next successive member is removed from the same end of the list, or a new member is 
added to the same end of the list. The removed member does not participate in list scans 
with _SUCCESSOR^LM or _PREDECESSOR^LM.
_UNPOP^LM and _UNGET^LM replace the last list member removed from a list with 
_POP^LM or _GET^LM, respectively.










