get_keys_struct_map
The function get_keys_struct_map retrieves the index values of all elements in MAP and stores them in an array. The index values are stored in the array in random order.
get_keys_struct_map ( input_map;result_array)
This function returns NUMBER, which is the number of elements stored in the array.
This function has two parameters:
- input_map is MAP of type FIELDSET. The MAP with the index values.
- result_array is an array of type TEXT. The array with index values to be stored.
An example is provided below.
DATASTRUCTURE EL
BEGIN
TEXT Field
END
DATASTRUCTURE DS
BEGIN
MAP EL Input_map
END
DECLARE struct DEFINED_AS DS
ASSIGN struct.Input_map ["first"].Field := "This is the first value"
ASSIGN struct.Input_map ["second"].Field := "This is the second value"
ASSIGN struct.Input_map ["third"].Field := "This is the third value"
ASSIGN struct.Input_map ["fourth"].Field := "This is the fourth value"
ASSIGN struct.Input_map ["fifth"].Field := "This is the fifth value"
ARRAY TEXT result_array[1]
NUMBER number_of_elements
ASSIGN number_of_elements := get_keys_struct_map (struct.Input_map;result_array)
NUMBER counter
FOR counter
FROM 1
UPTO number_of_elements
DO
#
The key @(result_array[counter]) contains @(struct.Input_map[result_array[counter]].Field) in the map.
#
OD