Defining a new type
The definition of a user-defined type consists of a list of names together with their type. It describes the fields of a record. The form is:
. . .
END TYPE type_name
END TYPE ADDRESS
Unlike an array, the components of a user-defined type need not have the same type.
A field type can be a user-defined type.
A field can be an array.
Declaring a type does not allocate storage for a variable of that type.
Once a type has been defined, a declaration takes the form:
AddressBook is an array with index from 1 to 200.
A double colon (::) is required if type attributes are included.
Referencing a field
In contrast to an array where a component is identified by its index, a component of a record is identified by its name. The percent sign (%) is used in this context. For example:
The fields of record can be given a value by simple assignment:
or by using a constructor that takes the form of a function whose name is that of the type and whose arguments are the initial values for the fields.
MyAddress=ADDRESS("John Smith",12,"Main St","Salford","M6 4NZ")