Record types and properties
Several EGL record types are available:
For details on what target systems support what record types, see Record and file-type cross-reference. For details on how record parts are initialized, see Data initialization.
basicRecord
A basic record has a structure but no properties. This type of record is used for internal processing and cannot access data storage.
Only a basic record part has the data declaration property redefines, which (if set) identifies a record whose memory is accessed by the basic record.
In a main program, the program property inputRecord identifies a basic record that is initialized automatically, as described in Data initialization.
indexedRecord
An indexed record lets you to work with a file that is accessed by a key value, which identifies the logical position of a record in the file. You can read the file by invoking a get, get next, or get previous statement. Also, you can write to the file by invoking an add or replace statement; and you can remove a record from the file by invoking a delete statement.
The properties of an indexed record include these:
- fileName is required. For details on the meaning of your input, see Resource associations (overview). For details on the valid characters, see Naming conventions.
- keyItem is required and can only be a structure item that is unique in the same record. You must use an unqualified reference to specify the key item; for example, use myItem rather than myRecord.myItem. (In an EGL statement, however, you can reference the key item as you would reference any item.)
See also Properties that support variable-length records.
mqRecord
An MQ record lets you access an MQSeries message queue. For details, see MQSeries support.
relativeRecord
A relative record lets you to work with a data set whose records have these properties:
- Are fixed length
- Can be accessed by an integer that represents the sequential position of the record in the file
The properties of a relative record are as follows:
- fileName is required. For details on the meaning of your input, see Resource associations (overview). For details on the valid characters, see Naming conventions.
- keyItem is required. The key item can be any of these areas of memory:
- A structure item in the same record
- A structure item in a record that is global to the program or is local to the function that accesses the record
- A data item that is global to the program or is local to the function that accesses the record
You must use an unqualified reference to specify the key item. For example, use myItem rather than myRecord.myItem. (In an EGL statement, you can reference the key item as you would reference any item.) The key item must be unique in the local scope of the function that accesses the record or must be absent from local scope and unique in global scope.
The key item has these characteristics:
- Has a primitive type of BIN, DECIMAL, INT, or NUM
- Contains no decimal places
- Allows for 9 digits at most
Only the get and add statements use the key item, but the key item must be available to any function that uses the record for file access.
serialRecord
A serial record lets you access a sequentially accessed file or data set. You can read from the file by invoking a get statement, and a series of get next statements reads the file records sequentially, from the first to the last. You can write to the file by invoking an add statement, which places a new record at the end of the file.
Serial record properties include fileName, which is required. For details on the meaning of your input for that property, see Resource associations (overview). For details on the valid characters, see Naming conventions.
See also Properties that support variable-length records.
sqlRecord
An SQL record provides special services when you access a relational database.
Each SQL record has the following properties:
- An entry in tableNames identifies an SQL table associated with the SQL record. You may reference multiple tables in a join, but restrictions ensure that you do not write to multiple tables with a single EGL statement. You may associate a given table name with a label, which is an optional, short name used to reference the table in an SQL statement.
- defaultSelectCondition is optional. The conditions become part of the WHERE clause in the default SQL statements. The WHERE clause is meaningful when an SQL record is used in an EGL open, get, or get next statement.
In most cases, the SQL default select condition supplements a second condition, which is based on an association between the key item values in the SQL record and the key columns of the SQL table.
- tableNameVariables is optional. You can specify one or more variables whose content at run time determines what database tables to access, as described in Dynamic SQL.
- keyItems is optional. Each key item can only be a structure item that is unique in the same record. You must use an unqualified reference to specify each of those items; for example, use myItem rather than myRecord.myItem. (In an EGL statement, however, you can reference a key item as you would reference any item.)
For details, see SQL support.
Related concepts
Dynamic SQL
MQSeries support
Record parts
Resource associations and file types
SQL support
Related reference
add
close
Data initialization
delete
execute
get
get next
get previous
MQ record properties
Naming conventions
open
prepare
Properties that support variable-length records
Record and file type cross-reference
replace
SQL item properties
sysVar.terminalID