Function type:
ELEMENT
Returns the previous element in the specified list. This function can be applied to a list of any DGL data type.Note that “previous” refers to the item physically located before the current item in the list. The “current” item is determined using the utility functionstm_list_last_element
.
Items in the input list can be of any element type except string. For strings, see stm_str_list_previous_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 stateS4
by callingstm_list_last_element
.S4
becomes the “current” item. To find the previous element in the list, use the following statements:VARIABLE
LIST OF STATE state_list;
STATE state_id;
INTEGER status;
.
.
state_id := stm_list_last_element (state_list, status);
state_id := stm_list_previous_element (state_list,
status);
WRITE (’\n State of interest is: ’,
stm_r_st_name (state_id, status));
.
.