get

The EGL get statement provides the fundamental "read" capability for the language.

Use the get statement to retrieve record data from a data source. This data source can be a file, a database, or a result set that you created with an EGL open statement. The data that you retrieve goes into the record variable that you specify in the statement, and the exact behavior of the statement depends on the way that you have stereotyped your record variable (see Stereotypes).

For specific considerations that apply to the get statement when you use various data source technologies (such as SQL), see the related reference at the end of this topic.

Syntax

Syntax diagram with generic fields
positionOption
Optional keyword that you can use to specify a relative position within the data source from which to retrieve the data. Keywords include absolute, next, and others; the availability of specific keywords depends on the data source you are reading from.
recordVariable
Name of the record variable into which EGL copies the data.
getOptions
Various options are available depending on the way you stereotyped your record variable, including a hold for update, single row access, or dynamic statement construction.
explicitCode
Using an option such as #sql{ }, you might be able to enter explicit code to communicate with a Database Management System (DBMS).
into field
One or more EGL variables where a DBMS places your data.

Example

The following example shows how to use a get statement to read a record:
  myCustomer CustomerRecord;          // create record variable
  myCustomer.customerNumber = 1001;   // set key in record variable

  try
    get myCustomer;
  onException(ex AnyException)
    myErrorHandler(ex);  // exits the program
  end

Feedback