Managing file groups

From m204wiki
Jump to navigation Jump to search

Overview

A file group is a set of files which process as if they were one file.

There are three types of file groups:

  • Permanent
  • Temporary
  • Ad hoc

Permanent, temporary, and ad hoc groups

CREATE GROUP command and the types of groups

Permanent and temporary file groups are created using the CREATE PERM GROUP and CREATE TEMP GROUP commands. Ad hoc groups exist only for a particular IN clause (and any label references that refer to the statement). The following table explains how they are created:

Type of group Created...
Permanent By the system manager using the CREATE command.

User access is determined by the privileges defined for the file group.

Use the following syntax to create a permanent group:

CREATE PERM GROUP groupname FROM {filename [AT location] [(OPTIONAL) | (MANDATORY)]} ,... [PARAMETER parameter[=value] [PARAMETER parameter[=value]]... . . . END

For information about creating permanent groups, see CREATE PERM GROUP.

Temporary By an individual user with the CREATE command, and can be referenced only by that user.

Temporary group names exist only during the current login session and are deleted automatically when you log out, unless you delete them during the session.

Use the following syntax to create a temporary group:

CREATE [TEMP] GROUP groupname FROM filename [,filename ...] [PARAMETER parameter_list] . . . END

The parameters available for temporary file groups are described in CREATE TEMP GROUP.

Ad hoc Within a SOUL request by prefacing a statement with the clause:

IN file1, file2 [,file3 ...]

Ad hoc groups have no name and exist only for the current request. They allow record retrieval from many files at once without defining a group in advance. As in any IN clause, all of the files in an ad hoc group must be opened before the group is mentioned. For more information, see Ad hoc groups.

Using groups

This section describes a number of reasons why a file manager might set up file groups.

Files with large numbers of records

A single Model 204 file may only contain 16.7 million record slots. As applications grow, this limit may not be enough.

Defining a permanent file group enables support of much larger sets of data: a file group can have as many as 256 files.

Normally, if you take this approach, you do not randomly place the records anywhere in the group, but rather you partition the files based on some attribute. For example, you might use the Social Security number to decide in which file in a group to place a particular record.

Partitioning for performance

Even files with a record limit you do not expect to hit might benefit from partitioning. For example, say you most commonly read data for a particular year. You would probably find that placing each year's records in a different file would perform better than putting all of the records in a single file, then indexing the year for easy access.

See IN GROUP MEMBER clause for more information.

Procedure groups in APSYs

When creating Application Subsystems (APSYs) you may (and are encouraged to) specify that the procedure file is actually a group.

In your application design, you may have large amounts of code that is identical in multiple APSYs, but you may require different global settings between the APSYs. Since at compile time, procedure files are searched in the order they appear in the group, you can set different "first" procedure files, each followed by the same code base.

See "Overview of the Subsystem Management facility" in the Rocket Model 204 System Managers Guide for more information about APSYs.

Using a group to postpone a file reorganization

Note: The following technique cannot be used if there are references in your code to Internal Record Numbers (IRNs). IRNs (without also specifying a group member) cannot be used against group files.

The following sequence describes a technique for postponing the reorganization of file X, which is almost full:

  1. Define file Y, which looks like file X (same field names).
  2. Define file Y to have whatever table sizes it needs.
  3. Group file X and file Y together, with file Y as the specified UPDTFILE (CREATE GROUP command parameter).
  4. Run your application against grouped files X and Y.

Example:

CREATE PERM GROUP X FROM X, Y PARAMETER UPDTFILE = Y END