References to variables in EGL

For details on the distinction between two kinds of memory access, see Dynamic and static access.

Regardless of which kind of access is in effect, the EGL dotted syntax is usually sufficient. Consider the following part definitions, for example:
  Record myRecordPart01 type basicRecord
    myString      STRING;
    myRecordVar02 myRecordPart02; 
   end

  Record myRecordPart02 type basicRecord
    myString02    STRING;
    myRecordVar03 myRecordPart03;
    myDictionary  Dictionary 
    {
      empnum=0005,
      lastName="Twain",
      firstName="Mark",
      birthday="021460"
    };
  end

  Record myRecordPart03 type basicRecord
    myInt INT;
    myDictionary  Dictionary 
    {
      customerNum=0005,
      lastName="Clemens"
    };
  end

Assume that a function uses the record part myRecordPart01 as the type when declaring a variable named myRecordVar01.

To refer to the field myInt, list the following symbols in order:
The presence of an array causes a straightforward extension of the same syntax. If myRecordVar03 were declared as an array of three records, for example, you could use the following symbols to access the field myInt in the third element of that array:
  myRecordVar01.myRecordVar02.myRecordVar03[3].myInt
The dotted syntax also works when you reference a dictionary field in this example. To access the value "Twain", specify the following characters on the right-hand side of an assignment statement:
  myRecordVar01.myRecordVar02.myDictionary.lastName

The presence of a field named myDictionary in two different record parts does not pose a problem because each same-named field is referenced in relation to its own, enclosing record.

You also can use dotted syntax to refer to a constant (such as myConst) in a library (such as myLib):
  myLib.myConstant
Two other syntaxes are available:

Related concepts
Abbreviated syntax for referencing fixed structures
Bracket syntax for dynamic access
Dynamic and static access
Enumerations in EGL
Function part
Parts
Program part
References to parts
Scoping rules and "this" in EGL
Fixed structure
Typedef

Related tasks
Declaring variables and constants in EGL

Related reference
Arrays
Function invocations
Function part in EGL source format
Primitive types
Use declaration

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.