Managing file groups: Difference between revisions
m (Admin moved page Managing File Groups to Managing file groups without leaving a redirect) |
m (→Procedure groups in APSYs: link repair) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
== Overview == | ==Overview== | ||
<p> | <p> | ||
A file group is a set of files which process as if they were one file.</p> | |||
<p>There are three types:</p> | <p>There are three types of file groups:</p> | ||
<ul> | |||
<li>Permanent </li> | |||
<li>Temporary </li> | |||
<li>Ad hoc </li> | |||
</ul> | |||
== Permanent, | ==Permanent, temporary, and ad hoc groups== | ||
===CREATE GROUP command and the types of groups === | ===CREATE GROUP command and the types of groups=== | ||
<p>Permanent and | <p> | ||
Permanent and temporary file groups are created using the <var>CREATE PERM GROUP</var> and <var>CREATE TEMP GROUP</var> commands. Ad hoc groups exist only for a particular <var>IN</var> clause (and any label references that refer to the statement). The following table explains how they are created: </p> | |||
<table> | <table> | ||
<tr class="head"> | <tr class="head"> | ||
Line 16: | Line 20: | ||
<th>Created...</th> | <th>Created...</th> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Permanent </td> | <td>Permanent </td> | ||
<td | <td>By the system manager using the <var>CREATE</var> command. | ||
<p> | |||
<p>User access is determined by the privileges defined for the file group.</p> | User access is determined by the privileges defined for the file group.</p> | ||
<p>Use the following syntax to create a permanent group: </p> | <p> | ||
<p class=" | Use the following syntax to create a permanent group: </p> | ||
<p class="syntax">CREATE PERM GROUP <span class="term">groupname</span> | |||
FROM {filename [AT location] [(OPTIONAL) | (MANDATORY)]} | FROM {<span class="term">filename</span> [AT <span class="term">location</span>] [(OPTIONAL) | (MANDATORY)]} ,... | ||
[PARAMETER <span class="term">parameter</span>[=<span class="term">value</span>] | |||
[PARAMETER <span class="term">parameter</span>[=<span class="term">value</span>]]... | |||
. | . | ||
. | . | ||
Line 30: | Line 37: | ||
END | END | ||
</p> | </p> | ||
<p>For information about creating permanent groups, see [[CREATE command: Permanent group|CREATE PERM GROUP]]</p> | <p> | ||
For information about creating permanent groups, see <var>[[CREATE command: Permanent group|CREATE PERM GROUP]]</var>.</p> | |||
</td> | </td> | ||
</tr> | </tr> | ||
<tr><td>Temporary</td> | <tr><td>Temporary</td> | ||
<td | <td>By an individual user with the <var>CREATE</var> command, and can be referenced only by that user. | ||
<p> | |||
<p>Use the following syntax to create a temporary group:</p> | 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. </p> | ||
<p class=" | <p> | ||
Use the following syntax to create a temporary group:</p> | |||
<p class="syntax">CREATE [TEMP] GROUP <span class="term">groupname</span> FROM <span class="term">filename</span> [,<span class="term">filename</span> ...] | |||
[PARAMETER <span class="term">parameter_list</span>] | |||
. | . | ||
. | . | ||
Line 45: | Line 55: | ||
END | END | ||
</p> | </p> | ||
<p>The parameters available for temporary file groups are | <p> | ||
The parameters available for temporary file groups are described in <var>[[CREATE command: Temporary group|CREATE TEMP GROUP]]</var>.</p> | |||
</td> | </td> | ||
</tr> | </tr> | ||
Line 51: | Line 62: | ||
<tr> | <tr> | ||
<td>Ad hoc</td> | <td>Ad hoc</td> | ||
<td | <td>Within a SOUL request by prefacing a statement with the clause: | ||
<p class=" | <p class="syntax">IN <span class="term">file1</span>, <span class="term">file2</span> [,<span class="term">file3</span> ...] | ||
</p> | </p> | ||
<p>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 | <p> | ||
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 <var>IN</var> clause, all of the files in an ad hoc group must be opened before the group is mentioned. For more information, see [[Files, groups, and reference context#Ad hoc groups|Ad hoc groups]].</p></td></tr> | |||
</table> | </table> | ||
== Using | ==Using groups== | ||
<p> | <p> | ||
This section describes a number of reasons why a file manager might set up file groups.</p> | |||
<p> | ===Files with large numbers of records=== | ||
<p> | |||
A single Model 204 file may only contain 16.7 million record slots. As applications grow, this limit may not be enough.</p> | |||
<p> | |||
Defining a permanent file group enables support of much larger sets of data: a file group can have as many as 256 files.<!--Tested: GROUP001.DME.QA--></p> | |||
<p> | |||
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. </p> | |||
<p> | ===Partitioning for performance=== | ||
<p> | |||
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.</p> | |||
<p> | |||
See [[Files, groups, and reference context#IN GROUP MEMBER clause|IN GROUP MEMBER clause]] for more information.</p> | |||
=== | ===Procedure groups in APSYs=== | ||
<p | <p> | ||
When creating [[Application Subsystem development|Application Subsystems]] (APSYs) you may (and are encouraged to) specify that the procedure file is actually a group.</p> | |||
<p> | |||
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. </p> | |||
<p> | |||
See [[System requirements for Application Subsystems]] for more information about APSYs.</p> | |||
===Using a group to postpone a file reorganization=== | |||
<p class="note">'''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.</p> | |||
The following sequence describes a technique for postponing the reorganization of file <code>X</code>, which is almost full: | |||
<ol> | |||
<li>Define file <code>Y</code>, which looks like file <code>X</code> (same field names).</li> | |||
<p>Example:</p> | <li>Define file <code>Y</code> to have whatever table sizes it needs.</li> | ||
<li>Group file <code>X</code> and file <code>Y</code> together, with file <code>Y</code> as the specified <var>UPDTFILE</var> (<var>CREATE GROUP</var> command parameter).</li> | |||
<li>Run your application against grouped files <code>X</code> and <code>Y</code>.</li> | |||
</ol> | |||
<p> | |||
Example:</p> | |||
<p class="code">CREATE PERM GROUP X FROM X, Y | <p class="code">CREATE PERM GROUP X FROM X, Y | ||
PARAMETER UPDTFILE = Y | PARAMETER UPDTFILE = Y | ||
Line 94: | Line 111: | ||
</p> | </p> | ||
[[Category: | [[Category:Model 204 files]] |
Latest revision as of 22:20, 18 September 2017
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 System requirements for Application Subsystems 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:
- Define file
Y
, which looks like fileX
(same field names). - Define file
Y
to have whatever table sizes it needs. - Group file
X
and fileY
together, with fileY
as the specified UPDTFILE (CREATE GROUP command parameter). - Run your application against grouped files
X
andY
.
Example:
CREATE PERM GROUP X FROM X, Y PARAMETER UPDTFILE = Y END