Difference between revisions of "Adding records (File architecture)"

From m204wiki
Jump to navigation Jump to search
m (Rob moved page Adding Records Manually to Adding Records (File Architecture): tie to Table B)
m
Line 30: Line 30:
 
</ul>
 
</ul>
 
<p>&nbsp;</p>
 
<p>&nbsp;</p>
[[Category:File manager]]
+
[[Category:File Architecture]]

Revision as of 22:27, 28 March 2013

Adding a record to a file

To add a record to a file:

Prerequisite:

All preallocated fields (fields that have an OCCURS clause) must be defined before any records are added to the file.

  1. Enter a User Language STORE RECORD statement with a list of name = value pairs, as in the following example.

STREC: STORE RECORD NAME=RASPUTIN SEX=MALE OCCUPATION=MONK END STORE

Alternatively, you can use the Host Language Interface IFBREC, IFPUT, and IFSTORE functions, which also require a list of name = value pairs.

All field names must previously have been defined, but not all field names need to have assigned values in every record. In fact, if you omit a field, the field is not stored in the record at all, thus saving space in the file.

For more information see the Rocket Model 204 User Language Manual or the Rocket Model 204 Host Language Interface Reference Manual.

After records are loaded, you can add a preallocated field definition only by reinitializing the file, defining all the fields-including the new preallocated field-and reloading the records. Non-preallocated field definitions can be added at any time.

How Model 204 adds records to a file

In the process of adding a new record to a file, Model 204:

  1. Converts all field names and the values of coded fields and some FRV fields into fixed-length codes from Table A.
  2. Creates a logical Model 204 record that contains field name = value pairs in Table B.
  3. Adds indexing information to Tables C and D for fields that have the KEY, NUMERIC RANGE, ORDERED, or FRV field description attributes.

Considerations when adding many records to a file

If you are adding a large number of records to a file, consider these alternatives for increased efficiency:

  • Deferred updates. Defer changes or additions that update Tables C and D, instead specifying that step 3 above be performed in separate phases. Deferred Update Feature describes how to use deferred updates.
  • File Load utility. If the raw data for the records to be stored in the Model 204 file already exists in a machine-readable format (magnetic tape, direct-access storage, cards), use the File Load utility to load that data directly into the Model 204 file quickly and economically. File Load Utility describes the File Load utility.