Managing file groups

From m204wiki
Revision as of 20:44, 2 January 2014 by JAL (talk | contribs)
Jump to navigation Jump to search

Overview

File groups are sets of files which process as if they were one.

There are three types:

  • Permanent groups
  • Temporary groups, and
  • Ad-hoc groups

Permanent, Temporary and Ad-hoc Groups

CREATE GROUP command and the types of groups

Permanent and Temporary file groups are created using the CREATE GROUP command. Ad-hoc groups exist only for a particular 'ín' clause (and any label references which refer to the statement). The following chart 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 detailed in CREATE TEMP GROUP.

Ad hoc

Within a User Language 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 the description of Ad hoc groups in the Rocket Model 204 User Language Manual.

Using Groups

There are a number of reasons why a file manager might set up file groups:

Files with large numbers of record

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 can support much larger sets of data: there can be up to 254 files in a file group.

Normally, if you take this approach, you would not randomly place the records anywhere in the group, but rather you would partition the files based on some attribute. For example, you may use the Social Security Number to decide which file in a group to place a particular record in. Hint: because some identifiers have hidden meanings (the high order digits of the Social Security Numbers used to identify the region where the application was made, for example), often the low order digits make a better randomizer.

Partitioning for performance

But even files where you do not expect to hit the record limit might benefit from partitioning. If you were, for example, to most commonly read data for a particular year, you would probably find that placing all the records for a year in different files would perform better than putting all of the records in a single file and 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.

You may, in your application design, have large amounts of code identical in multiple APSYs, but you may require different global setting between the APSYs. Because, at compile time, procedure files are searched in the order they appear in the group. you can put different 'first' procedure files, each followed by the same code base.

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

Postponing reorganizations with Groups

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.

  • File X is almost full
  • Define File Y, which looks like File X (same field names)
  • File Y can be defined to have whatever table sizes it needs
  • Group File X and Y together, with File Y as the specified UPDTFILE
  • Run your application against grouped files X and Y

Example:

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