Attributes [ HP System Dictionary XL Gen. Ref. Vol. 1 ] MPE/iX 5.0 Documentation
HP System Dictionary XL Gen. Ref. Vol. 1
Attributes
An attribute is a characteristic, property, or description of an entity
or relationship. In System Dictionary, attributes are dictionary
structures that allow attribute values to be assigned to entities and
relationships. System Dictionary has a core set of attributes that are
built into every dictionary. You can also create an extended set of
attributes if desired.
An attribute definition has four parts:
* The attribute name.
* The attribute type (alias, Boolean, character, floating, integer, or
variable).
* The attribute length--a value, dependent on the attribute type, that
specifies the maximum length allowed for values of the attribute.
* An optional list of edits that specify the default and allowable
values for attributes of type Boolean, character, floating, and
integer.
You can associate attributes of type Boolean, character, floating, or
integer with an entity type or relationship type. Attributes of type
alias and variable are "free-floating" in that they are never associated
with an entity type or relationship type but you can assign them to any
entity or relationship. In either case, attributes serve as templates
for defining the attribute values of entities and relationships.
Attribute values do not exist independently. They are always
associated with a specific entity or relationship. When you delete an
entity-type-attribute association, System Dictionary must remove the
corresponding attribute value from each entity of the affected type.
Since attributes are part of the dictionary structure and are available
to you, you should avoid obscure or redundant attribute names. This is
especially true for alias and variable attributes, because you can assign
them to any entity or relationship.
Specifying Attribute Type and Length
System Dictionary supports six attribute types: alias, Boolean,
character, floating, integer, and variable.
Boolean attributes are used to store true-or-false values. Internally,
Boolean values are stored in a single byte, but their values are
typically displayed as TRUE or FALSE. An example of a Boolean attribute
in the core set is the BLANK attribute. BLANK is an attribute of all
entities of type ELEMENT, and it specifies whether zero values should be
displayed as blanks or zeros.
For example, suppose a COBOL program contains a variable named
YEAR-TERMINATED that displays the year in which an employee leaves the
company. If an individual is currently employed, the value of this field
is zero but is displayed as blanks. To document this variable in the
dictionary, you would need to name an entity named YEAR-TERMINATED of
type ELEMENT. The attribute list of the ELEMENT entity type (shown in
Table 3-2) includes the BLANK attribute. For the YEAR-TERMINATED entity,
you would need to set this attribute to TRUE.
Integer and floating attributes store numeric values. Integer attributes
can have a length of 2 bytes (16 bits) or 4 bytes (32 bits). A floating
attribute can have a length of 4 bytes or 8 bytes.
Attributes of type character store fixed-length alphanumeric values. A
character attribute can have a length between 1 and 255 bytes inclusive.
Specifying Attribute Edits
An attribute of type Boolean, character, floating, or integer can have a
list of edits that specify the default and allowable values of the
attribute. The first value in the edit list indicates the default value.
Other values indicate allowable values. To specify a default value while
allowing any other value, you must supply an edit list with only one edit
(the default value).
Variable-Length Attributes
A variable-length attribute is an attribute of type character whose
length is unrestricted. Variable-length attributes are "free-floating"
in that they never appear in the attribute list of an entity type or
relationship type but you can assign them to any entity or relationship.
Variable-length attributes typically contain descriptions, defaults, edit
masks, picture clauses, or other free-format values. Since not every
entity or relationship needs these values, and since the values can be
quite large, System Dictionary reserves storage space for variable-length
attribute values only if you explicitly assign them to an entity or
relationship. When you delete a variable-length attribute value, System
Dictionary releases the storage space.
DESCRIPTION, for example, is a variable-length attribute in the System
Dictionary core set. Table 3-4 shows some sample entities and their
DESCRIPTION attribute values. In the first and second columns are the
entity and entity type names. The third column contains the description.
As the table suggests, if a DESCRIPTION attribute value exists, it is
linked to a specific entity of a specific type. Unlike the sample
attributes in Table 3-1 and Table 3-3, the DESCRIPTION attribute is not
associated with any entity type or relationship type.
Table 3-4. DESCRIPTION Attribute Values
-----------------------------------------------------------------------------------------------
| | | |
| Entity | Entity Type | DESCRIPTION |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| CUSTOMERS | FORM | Customer info for Admin group |
| ORDERS | IMAGE-DATABASE | Order-tracking data base |
| LAST_NAME | ELEMENT | Last name is upshifted |
| DATE | RECORD | Divided into month/day/year elements |
| | | |
-----------------------------------------------------------------------------------------------
You can assign a DESCRIPTION attribute to the entity LAST-NAME of type
ELEMENT. It is up to you whether other entities of type ELEMENT also have
DESCRIPTION attribute values.
When you request a variable-length attribute value of an entity or
relationship you specify, two outcomes are possible. The first outcome
is that the entity or relationship you specify has a value for the
attribute you specify (DESCRIPTION, for instance), and the value is
returned. The second possibility is that the value you requested was
never assigned to the entity or relationship you specified, and this is
reported as an error.
Alias Attributes
An alias is an alternate entity name that reflects the entity's usage in
a particular subsystem. In System Dictionary, an alias is a
fixed-length, 32-character attribute that you can assign to any entity or
relationship. Alias attributes never appear in the attribute list of an
entity type or relationship type. Since not every entity or relationship
needs aliases, storage space for alias attributes is assigned as needed.
Table 3-5 shows a list of entities that have IMAGE-ALIAS attribute
values. IMAGE-ALIAS, for example, is an alias attribute that you can use
to document an alternate name used in an IMAGE data base. In the first
column are the entity names, with their entity types in the second
column. The entity CUSTOMER-LAST-NAME of type ELEMENT has an IMAGE-ALIAS
value of CUST-LAST-NAME. This alternate name was chosen because
IMAGE item names must be 16 characters or less. For the entity
ORDERS-MIS-DATABASE, the IMAGE alias is ORDERS, because IMAGE data base
names must be 6 characters or less. The IMAGE alias of the BURGER_NAME
entity is BURGER-NAME, because IMAGE does not allow underscores in item
names.
Table 3-5. IMAGE-ALIAS Attribute Values
-----------------------------------------------------------------------------------------------
| | | |
| Entity | Entity Type | IMAGE-ALIAS |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| CUSTOMER-LAST-NAME | ELEMENT | CUST-LAST-NAME |
| ORDERS-MIS-DATABASE | IMAGE-DATABASE | ORDERS |
| BURGER_NAME | ELEMENT | BURGER-NAME |
| | | |
-----------------------------------------------------------------------------------------------
When you retrieve an alias attribute value of an entity or relationship,
a value is always returned. If the alias exists, a 32-byte value
containing the alias name is returned. If the alias does not exist, a
blank value is returned. You can delete an alias attribute value by
replacing it with all blanks. When you delete an alias attribute value,
its storage space is released.
Special Attributes
Every entity type and relationship type has a set of special attributes
automatically associated with it as part of the process by which it is
created. The set of attributes is not the same for entity types and
relationship types. Most of these attributes have values automatically
inserted when you create an occurrence. A typical example of this is the
attribute date-created. This attribute is automatically associated with
every entity type and relationship type as it is created, and whenever an
entity or a relationship is created, the current date is assigned as the
value for that attribute. The following attributes are designated
special attributes:
Special Attributes Special Attributes
for Entity Types for Relationship Types
---------------------------------------------------------------------------------------
scope-owner scope-owner
date-created date-created
date-changed date-changed
scope-changed scope-changed
sensitivity sensitivity
id-number relationship-position
Some characteristics that make these attributes "special" are:
* They are built into every core set entity type and relationship type.
* If you extend the dictionary by creating new entity types and
relationship types, System Dictionary automatically assigns these
attributes to them, and they cannot be removed later.
* You cannot add the id-number attribute to a relationship type, and
you cannot add the relationship-position attribute to an entity type.
* When you create or modify an entity or relationship, you cannot
assign values to scope-changed, date-created, and date-changed,
because these attributes are managed exclusively by System
Dictionary. Also, you cannot assign a value to the scope-owner
attribute when you create an entity or relationship; System
Dictionary sets this attribute. You can, however, assign an existing
entity or relationship to a new scope-owner by modifying its
scope-owner attribute.
MPE/iX 5.0 Documentation