Model Templates : Properties

Properties

This template uses database extraction functions to generate properties. It produces the property report for a list of data-items whose names match the specified pattern.

Each entry includes the name of the data-item, a short description, synonym, type (real, integer, and so on), and attributes and their values. In addition, it includes specific information extracted from each data-item’s long description.

The template is as follows:

TEMPLATE di_dict;
-- this template produces information for each
-- data-item in a list no text formatter is used.
-- Formatting is done in WRITE statements.

PARAMETER
STRING di_pattern; -- the pattern that
-- determines the data-item list

VARIABLE
INTEGER st; -- return status code
LIST OF DATA_ITEM di_ids; -- list of
-- data-items for which the report
-- is produced

BEGIN
di_ids:= stm_r_di_name_of_di (di_pattern, st);
END;

SEGMENT report;

VARIABLE
DATA_ITEM di;
STRING di_name, di_synonym;
STRING di_sdesc;
INTEGER di_type;
STRING di_desc_file;
LIST OF STRING attr_list, attr_val_list;
STRING attr, attr_val;

BEGIN

-- write report heading
WRITE (’\n\n’,’ ’:20, ’DATA-ITEM PROPERTY’);

FOR di IN di_ids LOOP

di_name := stm_r_di_name (di, st);

-- write entry heading
WRITE (’\n\n\n DATA-ITEM: ’, di_name);
-- get short description and print it out
di_sdesc:= stm_r_di_description (di, st);
WRITE (’\n\n’, di_sdesc);
-- get synonym and print it out
di_synonym := stm_r_di_synonym (di, st);
WRITE (’\n\n SYNONYM: ’, di_synonym,’\n’ );
-- get structure\type and print it out
di_type := stm_r_di_data_type (di, st);

SELECT
WHEN di_type = stm_di_alias =>
WRITE (’\n TYPE: ALIAS \n’ );
WHEN di_type = stm_di_constant =>
WRITE (’\n TYPE: CONSTANT \n’ );
WHEN di_type = stm_di_primitive =>
WRITE (’\n TYPE: PRIMITIVE \n’ );
WHEN di_type = stm_di_reference =>
WRITE (’\n TYPE: REFERENCE \n’ );
WHEN di_type = stm_di_compound =>
WRITE (’\n TYPE: COMPOUND \n’ );

END SELECT;

--
-- retrieve the attributes for the
-- data-item of interest
--
attr_list := stm_r_di_attr_name (di, st);
--
-- write out the attribute names and values

FOR attr IN attr_list LOOP
attr_val_list:= stm_r_di_attr_val (di, attr,st);
FOR attr_val IN attr_val_list LOOP
WRITE (’/n’, attr + ’:’:20, attr_val);
END LOOP;
END LOOP;
--
--
-- write out various parts of the data-item’s
-- long description
--
di_desc_file := stm_r_di_keyword (di, ’!PURPOSE’,
’!END PURPOSE’, ’’, st);
WRITE (’\n\nPURPOSE: \n’);

IF st = stm_success
THEN
INCLUDE (di_desc_file);
ELSE
IF st = stm_starting_keyword_not_found
THEN
WRITE(’ not available \n’);
END IF;

END IF;

di_desc_file := stm_r_di_keyword (di, ’!TIMING’,
’!END TIMING’, ’’, st);
WRITE (’\n\nTIMING: \n’);

IF st = stm_success
THEN
INCLUDE (di_desc_file);
ELSE
IF st = stm_starting_keyword_not_found
THEN
WRITE(’ not available \n’);
END IF;
END IF;

di_desc_file:=
stm_r_di_keyword (di, ’!REPRESENTATION’,
’ !END REPRESENTATION’, ’ ’, st);
WRITE (’\n\nREPRESENTATION: \n’);

IF st = stm_success
THEN
INCLUDE (di_desc_file);
ELSE
IF st = stm_starting_keyword_not_found
THEN
WRITE (’ not available \n’);
END IF;
END IF;
END LOOP;
END;