Previous Table of Contents Next


7.2 Organization of the Record Package

   The Record package depends on the following packages: • org.omg::CWM::ObjectModel::Core • org.omg::CWM::ObjectModel::Instance

   Because of the antiquity of many record-based models, individual system implementations employing record models may have unusual features (such as occurs-depending arrays, various COBOL rename/remapping semantics, etc.) that are not shared with other implementations. When such features are limited to single implementations or languages, they have been purposefully left out of the Record metamodel. Rather, unusual features of this sort should be placed into extension packages designed to meet the needs of those implementations or languages. For example, record structuring features endemic to the COBOL language have been placed in the COBOLData metamodel in the CWMX package described in Volume 2 and do not appear here. In this way, COBOL-only features do not burden other record oriented implementations unnecessarily.

   The Record metamodel appears in Figure 7-1 .


   Figure 7-1 Record Package

   The instance diagram in Figure 7-2 shows how a record description is represented in this model. The record contains three fields, one of which is a group item that itself has embedded fields. The main RecordDef is named Customer. It contains three Fields: account, custName, and custAddress.

   Customer :RecordDef

   account : StructuralFeatureType long :

   Field DataType

   




   state : Field length = 3 : Integer StructuralFeatureType

   custAddress : StructuralFeatureType Address : StructuralFeatureType Field Group

   ClassifierFeature

   custName :Field length = 50 :Integer




   address1 : Field length = 80 : Integer

   char :

   address2 : Field DataType

   middleNam

   e : Field

   length = 30 : Integer

   postcode : Field length = 11 : Integer

   country :

   Field length = 20 : Integer

   Figure 7-2 Record metamodel instance example

   The account is a numeric field with a type of long, which is an instance of DataType. Size information about the field -- its length, precision, and scale -- are not relevant for the long data type.

   The field custName has a type of char, which is another instance of DataType. The field is 50 characters in length but needs no precision or scale information.

   Field custAddress is a single field; its internal structure is determined from its type Address, an instance of Group containing six fields.

   The following text shows how the example RecordDef would be described in three widely used programming languages.

   C Programming Language

   typedef struct Address { char address1[80]; char address2[80]; char city[30]; char state[3]; char postcode[11]; char country[20];

   } Address;

   typedef struct Customer { long account; char custName[50]; Address custAddress;

   } Customer; Customer cust;

   COBOL Programming Language

   01 Customer. 05 account PIC 999999

   USAGE BINARY. 05 custName PIC X(50). 05 custAddress.

    10 address1 PIC X(80). 10 address2 PIC X(80). 10 city PIC X(30). 10 state PIC X(3). 10 postcode PIC X(11). 10 country PIC X(20).

   PL/1 Programming Language

   DECLARE

   1 CUSTOMER , 2 ACCOUNT FIXED BIN(31,0), 2 CUSTNAME CHAR(50), 2 CUSTADDRESS,

    3 ADDRESS1 CHAR(80), 3 ADDRESS2 CHAR(80), 3 CITY CHAR(30), 3 STATE CHAR(3), 3 POSTCODE CHAR(11), 3 COUNTRY CHAR(20);