Variable-length records
You can define the following types of variable-length records in
EGL:
- Variable-length serial records for accessing sequential files
- Variable-length serial or indexed records for accessing VSAM files
- Variable-length MQ records
EGL finds the information it needs to determine the size of a variable-length
record by looking in a variable. The name of that variable is found
in a property of the record; for information about properties, see Properties. Either or both of the following
properties can be used to determine the length of the record:
- lengthItem
- Identifies a field in the current record, a field in another record visible to the program, or a variable. This field or variable is an integer that contains the total length of the record in bytes. For more information, see lengthItem.
- numElementsItem
- Identifies a field in the current record. Use this property with structured records where the last top-level structure field is an array. The field identified by the numElementsItem property is an integer that contains the number of elements from that final array that are actually to be written. For more information, see numElementsItem.
If both properties are present when EGL writes the record to the file, it uses the numElementsItem field to calculate the total length of the record, and then places that length in the variable specified by lengthItem before writing the record.