Adding records (File architecture)

From m204wiki
Revision as of 03:47, 21 March 2013 by Alex (talk | contribs) (Automatically generated page update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.