Technical data

Compiler Directives
2-39
Creating Records
Use the %assign directive to create new records. For example, if you have a
record called
Rec1 that contains a record called Rec2, and you want to add an
additional
Rec2 to it, use:
%assign tempVar = Rec2 { Name "Name1"; Type "t1" }
%assign Rec1 = Rec1 + Rec2
The first statement creates the new Rec2 and the second statement adds the
new
Rec2 to the existing Rec2. In the first statement, the left-hand side is the
reference to the record and the right-hand side is the new record. Figure 2-1
shows the result of adding the record to the existing one:
Figure 2-1: Creating a New Record
If you want to access the new record, you can use:
%assign myname = tempVar.Name
or
%assign myname = Rec1.Rec2[1].Name
In this same example, if you want to add two records to the existing record, use:
%assign tempVar = Rec2 { Name "Name1"; Type "t1" }
%assign Rec1 = Rec1 + Rec2[0]
%assign tempVar = Rec2 { Name "Name2"; Type "t2" }
%assign Rec1 = Rec1 + Rec2[1]
Rec1 {
Rec2 {
Name "Name0"
Type "t0"
}
Rec2 {
Name "Name1"
Type "t1"
}
.
.
}
New Record
Existing Record