1 ALIGNED The ALIGNED field attribute clause aligns a field on a specified starting boundary relative to the start of the record. 2 Usage Notes o To satisfy hardware requirements, some languages and language processors have field alignment restrictions for data definitions. The ALIGNED clause enables you to control the starting boundaries of fields you define. o All fields, except BIT fields, begin by default on the first byte following the last field. BIT fields begin on the bit immediately following the last field. You can modify this starting position with the ALIGNED clause. o The ALIGNED clause aligns fields within a record relative to the start of the record, not relative to virtual memory locations. For example, if you specify LONGWORD alignment for a field, that field does not necessarily begin on a longword boundary in memory. Rather, the field begins some multiple of 32 bits beyond the start of the record. To correctly use the ALIGNED clause, you must know the memory alignment techniques of the language you use with the CDD. o You should not use the ALIGNED clause in template records. When CDDL stores the template record, the position of an aligned field is fixed within the record and is not changed when the record is copied into another record definition. Therefore, the newly created field may not align properly in the new record definition. 2 Example In the following example, a LONGWORD field (QUANTITY) follows a BYTE field. The PRODUCT_NO field spans 64 bits, the DATE_ORDERED field spans 64 bits, and the STATUS_CODE field spans 8 bits. The ALIGNED clause causes the three bytes following STATUS_CODE to remain empty and aligns QUANTITY exactly 160 bits beyond the start of the record. IN_STOCK STRUCTURE. PRODUCT_NO DATATYPE IS TEXT SIZE IS 8 CHARACTERS. DATE_ORDERED DATATYPE IS DATE. STATUS_CODE DATATYPE IS BYTE. QUANTITY DATATYPE IS LONGWORD ALIGNED ON LONGWORD. LOCATION ARRAY 1:4 DATATYPE IS TEXT SIZE IS 30 CHARACTERS. UNIT_PRICE DATATYPE IS LONGWORD SCALE -2. END IN_STOCK STRUCTURE.