Field value pairs (File architecture): Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Overview==
<p>
The basic unit of storage inside a Model 204 [[Record (File architecture)|record]] is the field value pair (or, more literally, "field name = value pair," specifying the field's name and value). A record or a [[Field group design|field group]] contains a series of field groups and field value pairs.</p>


A record can contain multiple field value pairs for fields with the [[Field design#OCCURS_attribute|OCCURS attribute]].


== Overview ==
A record or a field group can contain non-<var>OCCURS</var> field value pairs, whose physical structure is described below, for each storage data type.
 
<p>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 fieldgroup contains a series of fieldgroups and field value pairs.</p>
 
A record can contain field value pairs for fields with the [[Field Design (File Management)#OCCURS_attribute|OCCURS attribute]].
 
A record or a fieldgroup can contain non-<var>OCCURS</var> field value pairs, whose physical structure is described below, for each storage data type.
 
== STRING fields ==


==STRING fields==
<p>The field value pair for <var>STRING</var> fields contains three parts: </p>  
<p>The field value pair for <var>STRING</var> fields contains three parts: </p>  
<ul>
<li>The field code from [[Table A (File architecture)|Table A]]: 3 bytes for <var>[[FILEORG parameter|FILEORG]]</var> X'100' files, or 2 bytes for all others. </li>


* the field code from [[Table A (File Architecture)|Table A]]; 3 bytes for [[FILEORG parameter|FILEORG]] X'100' files or 2 bytes for all others.
<li>The length of the value for this pair (0 to 255): 1 byte.</li>
* the length of the value for this pair (0 to 255); 1 byte.
* the value; variable length 0-255 bytes.
 
<p>So, if you have a NAME field containing 'SMITH' it will be held in either 8 or 9 bytes (depending on the FILEORG), while a NAME of 'FRANKENSTEIN' will be held as either 15 or 16.</p>
 
== BINARY or CODED fields ==
 
<p><var>[[Field Design (File Management)#BINARY attribute|BINARY]]</var> and <var>[[Field Design (File Management)#CODED attribute|CODED]]</var> fields are stored differently depending on whether the file has the Optimized Field Extraction ([[FILEORG parameter|FILEORG]] x'80') bit set.  Note that [[FILEORG parameter|FILEORG]] X'100' files automatically also turn on x'80'. </p>


<p>For non Optimized Field Extraction Files (x'80) the field value pair contains two parts:</p>
<li>The value: variable length, 0-255 bytes.</li>
</ul>


* the field code from [[Table A (File Architecture)|Table A]]; 2 bytes.
<p>For example, a <code>NAME</code> field containing <code>'SMITH'</code> occupies 8 or 9 bytes (depending on the <var>FILEORG</var> value), while a <code>NAME</code> of <code>'FRANKENSTEIN'</code> occupies 15 or 16 bytes.</p>
* the value which is '''always''' held as 4 bytes.  


<p>For Optimized Field Extraction Files the field value pair contains three parts:</p>
==BINARY or CODED fields==
<p>
The storage of <var>[[Field design#BINARY attribute|BINARY]]</var> and <var>[[Field design#CODED attribute|CODED]]</var> fields depends on whether the file has the Optimized Field Extraction (<var>FILEORG</var> X'80') bit set. </p>
<p class="note"><b>Note:</b> <var>FILEORG</var> X'100' files automatically also turn on x'80'. </p>


* the field code from [[Table A (File Architecture)|Table A]]; 3 bytes for [[FILEORG parameter|FILEORG]] X'100' files or 2 byte for all others.
<p>For files that are <i>not</i> Optimized Field Extraction files (X'80), the field value pair contains two parts:</p>
* the length of the value for this pair (1 to 4); 1 byte.
<ul>
* the value (variable length, 1-4 bytes).
<li>The field code from Table A: 2 bytes.
<li>The value: ''always'' held as 4 bytes.  
</ul>


<p>By storing a length with <b>all</b> field occurrences, data in records can be read much faster. The possible tradeoff on performance versus space is discussed in [[File_Design_(File_Management)#x.2780.27_-_Optimized_Field_Extraction_Files|File Design]].</p>
<p>For Optimized Field Extraction files, the field value pair contains three parts:</p>
<ul>
<li>The field code from Table A: 3 bytes for <var>FILEORG</var> X'100' files, or 2 bytes for all others.


== FLOAT fields ==
<li>The length of the value for this pair (1 to 4): 1 byte.


<p><var>[[Field Design (File Management)#FLOAT attribute|FLOAT]]</var> fields are stored differently depending on whether the file has the Optimized Field Extraction ([[FILEORG parameter|FILEORG]] x'80') bit set.  Note that [[FILEORG parameter|FILEORG]] X'100' files automatically also turn on x'80'. </p>
<li>The value: variable length, 1-4 bytes.
</ul>
<p>
By storing a length with <b>all</b> field occurrences, data in records can be read much faster. The possible trade-off on performance versus space is discussed in [[File design#X'80' - Optimized Field Extraction files|X'80' - Optimized Field Extraction files]]. </p>


<p>For non Optimized Field Extraction Files the field value pair contains two parts:</p>
==FLOAT fields==
<p>
The storage of <var>[[Field design#FLOAT attribute|FLOAT]]</var> fields depends on whether the file has the Optimized Field Extraction (<var>FILEORG</var> x'80') bit set. </p>
<p class="note"><b>Note:</b> <var>FILEORG</var> X'100' files automatically also turn on x'80'. </p>


* the field code from [[Table A (File Architecture)|Table A]]; 2 bytes.
<p>For files that are <i>not</i> Optimized Field Extraction files, the field value pair contains two parts:</p>
* the value which is '''always''' held as 4, 8, or 16 bytes, depending on the <var>LENGTH</var> attribute.
<ul>
<li>The field code from Table A: 2 bytes.
<li>The value: ''always'' held as 4, 8, or 16 bytes, depending on the <var>LENGTH</var> attribute.
</ul>


<p>For Optimized Field Extraction Files the field value pair contains three parts:</p>
<p>For Optimized Field Extraction files, the field value pair contains three parts:</p>
<ul>
<li>The field code from Table A: 3 bytes for <var>FILEORG</var> X'100' files, or 2 bytes for all others.


* the field code from [[Table A (File Architecture)|Table A]]; 3 bytes for [[FILEORG parameter|FILEORG]] X'100' files or 2 byte for all others.
<li>The length of the value for this pair (1 to 4): 1 byte.
* the length of the value for this pair (1 to 4); 1 byte.
* the value which is '''always''' held as 4, 8, or 16 bytes, depending on the <var>LENGTH</var> attribute.


<p>By storing a length with <b>all</b> field occurrences, data in records can be read much faster. The possible tradeoff on performance versus space is discussed in [[File_Design_(File_Management)#x.2780.27_-_Optimized_Field_Extraction_Files|File Design]].</p>
<li>The value: ''always'' held as 4, 8, or 16 bytes, depending on the <var>LENGTH</var> attribute.
</ul>
<p>
By storing a length with <i>all</i> field occurrences, data in records can be read much faster. The possible trade-off on performance versus space is discussed in [[File design#X'80' - Optimized Field Extraction files|X'80' - Optimized Field Extraction files]].</p>


[[Category:File architecture]]
[[Category:File architecture]]

Latest revision as of 04:35, 10 May 2014

Overview

The basic unit of storage inside a Model 204 record is the field value pair (or, more literally, "field name = value pair," specifying the field's name and value). 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' occupies 8 or 9 bytes (depending on the FILEORG value), while a NAME of 'FRANKENSTEIN' occupies 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: 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.