Field value pairs (File architecture): Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
Line 3: Line 3:
== Overview ==
== Overview ==


<p>The basic unit of storage inside a Model 204 record is the field value pair (or, more literally, "field = value pair"). Records and field groups are predominently a series of these strung out inside the entity.</p>


<p>They vary slightly by data type:</p>




Line 20: Line 22:
== Binary Fields ==
== Binary Fields ==


<p>[[BINARY attribute|Binary]] fields are stored (and work) differently depending on whether the file has the Optimized Field Extraction ([[FILEORG parameter|FILEORG]] x'80') bit set.</p>  
<p>[[#Field Design (File Management)#BINARY attribute|Binary]] fields are stored (and work) differently depending on whether the file has the Optimized Field Extraction ([[FILEORG parameter|FILEORG]] x'80') bit set.</p>  


<p>For non Enhanced Record Scan Files the field value pair contains two parts:</p>
<p>For non Optimized Field Extraction Files the field value pair contains two parts:</p>


* the field code from [[Table A (File Architecture)|Table A]]. This is 2 bytes. (Enhanced Data Handling Files ([[FILEORG parameter|FILEORG]] x'100' files automatically also turn on x'80'.)  
* the field code from [[Table A (File Architecture)|Table A]]. This is 2 bytes. (Enhanced Data Handling Files ([[FILEORG parameter|FILEORG]] x'100' files automatically also turn on x'80'.)  
Line 30: Line 32:
<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>


* the field code from [[Table A (File Architecture)|Table A]]. This is 3 bytes for Enhanced Data Handling Files ([[FILEORG parameter|FILEORG]] x'100' files) and 2 bytes for all others.  
* the field code from [[Table A (File Architecture)|Table A]]. This is 3 bytes for Optimized Field Extraction Files ([[FILEORG parameter|FILEORG]] x'100' files) and 2 bytes for all others.  
* one byte containing the length of the value (1 to 4 bytes).
* one byte containing the length of the value (1 to 4 bytes).
* the value. Its length is as above.  
* the value. Its length is as above.  
Line 38: Line 40:
== Float Fields ==
== Float Fields ==


<p>[[FLOAT attribute|Float]] fields consist of two parts:</p>  
<p>[[#Field Design (File Management)#FLOAT attribute|Float]] fields consist of two parts:</p>  


* the field code from [[Table A (File Architecture)|Table A]]. This is 3 bytes for Enhanced Data Handling Files ([[FILEORG parameter|FILEORG]] x'100' files) and 2 bytes for all others.   
* the field code from [[Table A (File Architecture)|Table A]]. This is 3 bytes for Enhanced Data Handling Files ([[FILEORG parameter|FILEORG]] x'100' files) and 2 bytes for all others.   
* the value which is '''always''' the [[LENGTH attribute|LENgth]] from the field definition (4, 8 or 16 bytes).  
* the value which is '''always''' the [[#Field Design (File Management)#LENGTH attribute|LENgth]] from the field definition (4, 8 or 16 bytes).  





Revision as of 22:17, 29 April 2013


Overview

The basic unit of storage inside a Model 204 record is the field value pair (or, more literally, "field = value pair"). Records and field groups are predominently a series of these strung out inside the entity.

They vary slightly by data type:


String Fields

The field value pair for string fields contains three parts:

  • the field code from Table A. This is 3 bytes for Enhanced Data Handling Files (FILEORG x'100' files) and 2 bytes for all others.
  • 1 byte containing the length of the value for this pair (0 to 255).
  • the value. Held in the number of bytes above.

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.


Binary Fields

Binary fields are stored (and work) differently depending on whether the file has the Optimized Field Extraction (FILEORG x'80') bit set.

For non Optimized Field Extraction Files the field value pair contains two parts:

  • the field code from Table A. This is 2 bytes. (Enhanced Data Handling Files (FILEORG x'100' files automatically also turn on x'80'.)
  • the value which is always held as 4 bytes.


For Optimized Field Extraction Files the field value pair contains three parts:

  • the field code from Table A. This is 3 bytes for Optimized Field Extraction Files (FILEORG x'100' files) and 2 bytes for all others.
  • one byte containing the length of the value (1 to 4 bytes).
  • the value. Its length is as above.

This effectively makes the BINARY field storage similar to string fields, and improves the speed with which the data in the record can be read. The possible tradeoff on performance versus space is discussed in File Design.

Float Fields

Float fields consist of two parts:

  • the field code from Table A. This is 3 bytes for Enhanced Data Handling Files (FILEORG x'100' files) and 2 bytes for all others.
  • the value which is always the LENgth from the field definition (4, 8 or 16 bytes).