set

The EGL set statement is used to establish characteristics of a record or field. The statement is supported only in services and libraries, not in Rich UI handlers.

This topic presents the core information on the set statement; for additional details, see the references at the end of this topic.

Core syntax

Core syntax for set statement
target
A record variable or record field
value
The value the set statement assigns to the target

set with record variable as target

When performing data access, the target of the set statement is a record variable. Some or all of the following values might be available:
empty
This variant of the set statement works recursively through any record variables contained within the record, or, in the case of a structured record, works down to the lowest level of the structure. Individual fields are set to their default values according to their types and the null flag is turned on. For more information about default values, see Data initialization. For more information about the null flag, see isSQLNullable.
initial
A record variable can specify an initial value for each of its fields. The initial modifier resets the values of those fields to the values specified in the record definition. If the record definition does not specify any initial values, the effect of the initial modifier is the same as that of the empty modifier.
position
For record variables with certain stereotypes (such as Indexed Record), you can use the set statement to set the file pointer within the file before a get next or get previous statement. The set statement effectively positions the file pointer to match the key field in the specified record variable. For details, see the related reference section at the end of this topic for set considerations for the appropriate data access technologies.

You can specify multiple records and multiple values, separated by commas. For a given record, the options take effect in the order in which they appear in the set statement.

set with field as target

When the target of the set statement is a field, the following values are available for any field (on a form or in a record):
empty
This variant of the set statement clears the specified field; if the field is structured, the statement also clears all subordinate fields. For the values assigned, see Data initialization.
initial
This variant of the set statement resets the value of the field to the value specified in the record definition. If the record definition does not specify any initial values, the effect of the initial modifier is the same as that of the empty modifier.
To explicitly set a nullable field or variable to a null value, do not use a set statement. Use an assignment statement like the following example:
myNullableVar = null;

Compatibility

Table 1. Compatibility considerations for set
Platform Issue
Rich UI set is not supported.

Feedback