Utility Functions : Examples of Utility Functions : Utility Functions Example 3

Utility Functions Example 3

The following example shows how to find the software modules in a list of modules:

VARIABLE
MODULE md_id;
LIST OF STRING imp_type;
INTEGER status;
.
.
imp_type := stm_r_md_attr_val (md_id, ’IMPLEMENTATION’,
status);
IF stm_list_contains_string (imp_type, ’SOFTWARE’,
status)
THEN
.
.

First, the code finds all the values for the IMPLEMENTATION attribute for the module, md_id. Among these values, the code searches for the value SOFTWARE. (Multiple values can exist for a given attribute.) If it is found, the statements following THEN are executed.