5.1.3 Record Type Declaration


A record type is a resticted form of the structure type in that it has a fixed binary layout. It is used for raw and direct access input and output and is also useful when calling procedures in foreign languages (e.g. C/C++). It enables portable external data sharing and is recommended for application program interfaces (API), libraries, remote procedure calls, messaging between processes, and sharing data files.

The binary record is layed out in the order the fields are defined. Each field is aligned to the size of the type and padding is used between fields as needed. No padding is applied at the end. The record alignment is the width of the largest field and no other alignement can be specified.

Enumerated types are not packed in a record whereas a structure may use bitwise packing of enumerations. A record puts each enumeration in its own Byte or if over 255 items, a Parcel. Consequently you can use pointers to reference enumerations in a record. If they are in a structure where they are packed they might not align on a byte boundary and you will get a compilation error is you reference an Enumeration with a pointer.

Within a program the byte order is the native byte order of the process. If you are calling a procedure in a foreign language it will have the native ordering. When perfoming raw or direct input an output the byte order can be designated on the Open command. Padding is not written nor read when performing raw input and output???

Record fields consist soley of numeric and enumerated types. Fixed length arrays of these types are also allowed. Records are flat in that fields cannot be other records or structures??? Pointers are not allowed in records as well. Micros and macros may be included.


Strings are not permitted, but text can be stored in a fixed length array. Fixed point real numbers can be stored in integers. With the integer form function you can include a decimal point in the format pattern. This also avoids unintended rounding that can happen using floating point numbers in applications such as finance.


Unless a record is always processed on machines with the same architecture, floating point numbers should be serialized as text. For the best accuracy they can use the real Form function with hexadecimal format patterns??? It is also risky to pass Nans (not a number).

Structure Type Declaration

Generic Class Declaration