File Organization


APPX supports three types of file organization: one-record, consecutive, and indexed. The type of file organization you select affects performance, space requirements, and the procedures you can perform with regard to a file.

If a file is used as a process control file (PCF), this specification affects the operation of a related process. If a file is one-record, APPX completes one process cycle during process execution; in other words, APPX sequentially executes the frames for a process once and then ends. If the file is other than one-record, the process continues to execute until the application user chooses to end it. Refer to Chapter 3-1: Overview of APPX Processes for additional information on PCFs and process cycles.

File organization is the only specification that affects record formats that are not stored in a file. If an unstored record is used as a PCF, the value you enter determines whether or not a process executes a single process cycle.

The following material is intended to help you choose the best type of organization for each file. The attributes of each type of organization are summarized in Table 2-1-4.

Attribute

One-Record

Consecutive

Indexed

Can Delete Records?

No

No

Yes

Retrieval Method

Not Applicable

Position in File

Key Path

Relative Performance

Faster

Faster

Slower

Process Control File

One Process Cycle

Multiple Cycles

Multiple Cycles

Table 2-1-4. A Comparison of File Organization

·    A one-record file is stored sequentially and therefore is subject to all the restrictions that apply to consecutive files. Unlike other consecutive files, however, a one-record file communicates a significant piece of information to an APPX input process; a process can expect at most one record. Based upon this information, the process simplifies development and maintenance requirements. APPX automatically checks for the existence of a record in the file. If there is no record, APPX places the user in add mode. If there is a record in the file, APPX places the user in change mode.

A parameters file is an example of a one-record file. Use of a one-record file to hold specifications that are referenced by more than one process in an application avoids unnecessary duplication, and simplifies design and maintenance.

·    Consecutive files organize records according to the sequence in which they are added to a file; each new record is added to the end of a file. The system retrieves records based upon their relative position in a sequence, or record number. A consecutive file does not contain keys, so its records cannot be retrieved by key path. To select a record based upon field value, APPX must process all records, ignoring those that do not satisfy selection requirements.

Because file processing is generally based on the value contained in a specific field (such as the last name of a customer or the number assigned to a vendor), APPX must use a query process to resequence consecutive records by the order they should be processed in. A query maintains the generated sequence in a pointer file. For example, the pointer file for an Orders file that is sorted alphabetically by customer includes the following record sequence for the customers (Anderson’s record is number 8, Jones’ is 4, Smith’s is 1, and Williams’ record is 22). To print an alphabetically sorted list of outstanding orders, the system consults the pointer file, and the records are processed in the following order: 8 (Anderson), 4 (Jones), 1 (Smith), and 22 (Williams). Refer to the Query Files section of Chapter 3-2, Chapter 3-9: Query Processes, and the Child Use Query Option section of Chapter 3-13 for more information about pointer files in a query process.

On most systems, APPX retrieves records from consecutive files faster than from indexed files.

A consecutive file can contain an unlimited number of records, subject only to operating system limitations and available storage space. You cannot, however, delete specific records in this type of file. To eliminate specific records, you must first transfer all records that you want retained to another file, and then scratch the original file.

·    For an indexed file, the system retrieves records based on the content of specified fields, or primary and alternate keys. APPX requires one primary key field for each file, and permits up to 16 alternate keys. These key fields are identified in the field specifications screens in the data dictionary.

Key fields, when used by the system to retrieve records, are referred to as key paths. This method of record retrieval is inherently slower than the method employed for consecutive files, but is more flexible and allows you to perform complicated operations more efficiently. Performance is enhanced when records are retrieved by primary (as opposed to alternate) key paths, although indexed file retrieval is still slower than consecutive file retrieval.

An indexed file can contain an unlimited number of records, subject only to the operating system’s limitations, the restrictions that are imposed by the length of a key field, and the available storage space. Unlike records in a consecutive or one-record file, records in indexed files can be deleted.