All variables of a given composite type are the same size. This is important, because locating composite variables within disk files is enormously simpler with fixed-size records.
Composite variables are declared in type declaration statements, just like other variables, with the composite type name replacing the built-in type name. For example:
SHARED DOUBLE xx, yy, zz
' declare conventional variables
SHARED VICTIM last, current, all ' declare composite variables
DCOMPLEX nn, oo, jj ' declare composite variables
STATIC VICTIM first, last, sorted ' declare composite variables
Components of composite variables are accessed by appending component names, which always begins with ., to the composite variable name, as in employee.phone where employee is a composite variable and .phone is the name of a component. Dots are not valid characters in other symbols, so component names are easy to distinguish from normal symbols.
SCOMPLEX and DCOMPLEX
Two complex number composite types are predefined for all programs, SCOMPLEX and DCOMPLEX. SCOMPLEX has two SINGLE components, while DCOMPLEX has two DOUBLE components. For both complex types, the component names are .R and .I , and contain the real and imaginary parts.
The + , - , * , and / operators can operate on complex variables, so expressions like:
xx = (xx * yy) + (yy / zz)
are valid (where xx , yy , zz are all SCOMPLEX or DCOMPLEX). The components of complex numbers are accessed like any composite variable, as in:
xx.R = j#
k# = xx.I
yy.I = zz.I
Functions can take composite variables arguments, and/or return composite results. Dozens of SCOMPLEX and DCOMPLEX functions are provided in the complex number function library.