6. Embedded QUEL for BASIC : BASIC Variables and Data Types : Variable Usage : Record Components
 
Share this page                  
Record Components
The syntax EQUEL uses to refer to a record component is the same as in BASIC:
record::component{::component}
Syntax Notes:
1. The last record component denoted by the above reference must be a scalar value (integer, floating-point or character string). There can be any combination of arrays and records, but the last object referenced must be a scalar value. Thus, all the following references are legal:
! Assume correct declarations for "employee", "person"
! and other records.
    employee::sal                ! Component of a record
    person(3)::pname             ! Component of an element of an array
    rec1::mem1::mem2::age        ! Deeply nested componentAll record components must be fully qualified when referenced. Elliptical references, such as references that omit group names, are not allowed.
The example below uses the array of records "emprec" to load values into the tablefield "emptable" in form "empform."
##     record Employee_Rec
##                    string      ename = 20
##                    word     eage
##                    integer      eidno
##                    string      ehired = 25
##                    string      edept = 10
##                       real      esalary
##     end record

##     declare Employee_Rec emprec(100)
     declare integer i

     . . .

     for i = 1 to 100
##               loadtable empform emptable
##          (ename = emprec(i)::ename, 
##           eage = emprec(i)::eage, eidno = emprec(i)::eidno,
##           ehired = emprec(i)::ehired,
##           edept = emprec(i)::edept, 
##           esalary = emprec(i)::esalary)
     next i