Field value pairs (File architecture): Difference between revisions
Line 24: | Line 24: | ||
<p>For files that are <i>not</i> Optimized Field Extraction Files (X'80), the field value pair contains two parts:</p> | <p>For files that are <i>not</i> Optimized Field Extraction Files (X'80), the field value pair contains two parts:</p> | ||
<ul> | <ul> | ||
<li>The field code from | <li>The field code from Table A: 2 bytes. | ||
<li>The value: '''always''' held as 4 bytes. | <li>The value: '''always''' held as 4 bytes. | ||
</ul> | </ul> |
Revision as of 00:26, 23 January 2014
Overview
The basic unit of storage inside a Model 204 record is the field value pair (or, more literally, "field = value pair"). A record or a field group contains a series of field groups and field value pairs.
A record can contain multiple field value pairs for fields with the OCCURS attribute.
A record or a field group can contain non-OCCURS field value pairs, whose physical structure is described below, for each storage data type.
STRING fields
The field value pair for STRING fields contains three parts:
- The field code from Table A: 3 bytes for FILEORG X'100' files, or 2 bytes for all others.
- The length of the value for this pair (0 to 255): 1 byte.
- The value: variable length, 0-255 bytes.
For example, a NAME field containing 'SMITH' is held in either 8 or 9 bytes (depending on the FILEORG), while a NAME of 'FRANKENSTEIN' is held in either 15 or 16 bytes.
BINARY or CODED fields
The storage of BINARY and CODED fields depends on whether the file has the Optimized Field Extraction (FILEORG X'80') bit set. Note that FILEORG X'100' files automatically also turn on x'80'.
For files that are not Optimized Field Extraction Files (X'80), the field value pair contains two parts:
- The field code from Table A: 2 bytes.
- The value: always held as 4 bytes.
For Optimized Field Extraction Files, the field value pair contains three parts:
- The field code from Table A: 3 bytes for FILEORG X'100' files, or 2 bytes for all others.
- The length of the value for this pair (1 to 4): 1 byte.
- The value: variable length, 1-4 bytes.
By storing a length with all field occurrences, data in records can be read much faster. The possible trade-off on performance versus space is discussed in X'80' - Optimized Field Extraction files.
FLOAT fields
The storage of FLOAT fields depends on whether the file has the Optimized Field Extraction (FILEORG x'80') bit set.
Note: FILEORG X'100' files automatically also turn on x'80'.
For files that are not Optimized Field Extraction files, the field value pair contains two parts:
- The field code from Table A: 2 bytes.
- The value: always held as 4, 8, or 16 bytes, depending on the LENGTH attribute.
For Optimized Field Extraction files, the field value pair contains three parts:
- The field code from Table A: 3 bytes for FILEORG X'100' files, or 2 bytes for all others.
- The length of the value for this pair (1 to 4): 1 byte.
- The value: always held as 4, 8, or 16 bytes, depending on the LENGTH attribute.
By storing a length with all field occurrences, data in records can be read much faster. The possible trade-off on performance versus space is discussed in X'80' - Optimized Field Extraction files.