Function type:
ELEMENT
Returns the next item in the specified list. This function can be applied to a list of any DGL data type.Note that “next” refers to the item physically located after the current item in the list. The “current” item is determined using the utility functionstm_list_first_element
.
Items in the input list can be of any element type except string. For strings, see the functionstm_str_list_next_element
. Assume you have a list of states in the orderS1
,S2
,S3
andS4
. The list is assigned to the variablestate_list
. You locate the stateS1
by callingstm_list_first_element
.S1
becomes the “current’ item. To find the next element in the list, use the following statements:VARIABLE
LIST OF STATE state_list;
STATE state_id;
INTEGER status;
.
.
state_id := stm_list_first_element (state_list, status);
WRITE (’\n The first state in the list is: ’,
stm_r_st_name (state_id, status));
state_id := stm_list_next_element (state_list, status);
WRITE (’\n The second state in the list is: ’,
stm_r_st_name (state_id, status));
.
.