| **Navigation:**  [[introduction.htm|Language Reference]] > 4 - Entity Declarations > File Structures >====== RECORD (declare record structure) ====== | [[blob declare a variable length field .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[null data processing.htm|{{btn_next_n.gif|Next page}}]] | | || | [label] | **RECORD** [,**PRE( )**] [,**NAME( )**] | | | //fields// | | | **END** | {{blk2blue.jpg|blk2blue.jpg}} | **RECORD** | Declares the beginning of the data structure within the FILE declaration. | | //fields// | Multiple variable declarations. | | **PRE** | Specify a label prefix for the structure. | | **NAME** | Specifies an external name for the RECORD structure. | The **RECORD** statement declares the beginning of the data structure within the FILE declaration. A RECORD structure is required in a FILE declaration. Each //field// is an element of the RECORD structure. The length of a RECORD structure is the sum of the length of its fields. When the label of a RECORD structure is used in an assignment statement, expression, or parameter list, it is treated as a GROUP data type. At run time, static memory is allocated as a data buffer for the RECORD structure. The //fields// in the record buffer are available whether the file is open or closed. If the //fields// contain variable declarations with initial values, that initial value is only used to determine the size of the variable, the record buffer is not initialized to the value. For example, a STRING('abc') field declaration creates a three-byte string, but it's value is not automatically initialized to 'abc' unless the program's executable code assigns it that value. Records from the data file on disk are read into the data buffer with the NEXT, PREVIOUS, GET, or REGET statements. Data in the //fields// are processed, then written to the data file as a single RECORD unit by the ADD, APPEND, PUT, or DELETE statements. The WHAT and WHERE procedures allow access to the //fields// by their relative position within the RECORD structure. **Example:** Names FILE,DRIVER('Clarion') !Declare a file structure Record RECORD ! begin record declaration Name STRING(20) ! declare name field Number SHORT ! declare number field END END !End file, end record declaration **See Also:** [[file declare a data file structure .htm|FILE]] [[next read next record in sequence .htm|NEXT]] [[previous read previous view record in sequence .htm|PREVIOUS]] [[get read a record or entry .htm|GET]] [[reget re get record .htm|REGET]] [[add add an entry .htm|ADD]] [[append add a new file record .htm|APPEND]] [[put re write record .htm|PUT]] [[delete delete a record .htm|DELETE]] [[what return field from group .htm|WHAT]] [[where return field position in group .htm|WHERE]]