Using generation data groups

To use generation data groups, you must understand how to refer to them and how to form absolute and relative names of the generation files within a group.

About this task

Refer to an entire group by using the group name optionally followed by an asterisk in parentheses, for example: abc.SALES(*). Either form denotes all the files in the group concatenated in generation order, the most current generation first. To refer to a specific generation and add it to a group, use the group name followed by either an absolute or relative reference.

Absolute names:

To name a specific generation of a group using an absolute reference, use the group name followed by an absolute generation number and version number. For example, if the name of a group is abc.SALES:

  • abc.SALES.g0001v00 refers to generation file 1, version 0.
  • abc.SALES.g0002v00 refers to generation file 2, version 0.

Relative names:

To name a specific generation of a group using a relative reference, use the group name followed by an integer in parentheses. For example, if the name of a group is abc.SALES:

  • abc.SALES(0) refers to the most current generation.
  • abc.SALES(-1) refers to the previous generation.
  • abc.SALES(+1) specifies a new generation to be added.

For further details about absolute and relative names, see the related reference about name format of generation files.

If an absolute or relative reference is syntactically valid, the run time determines whether an intended generation data reference refers to a generation data group or generation file by checking for the existence of an appropriately named generation data group catalog. If the catalog is not found, the reference is treated as a normal file identifier rather than as the name of a generation data group or generation file.

An unsigned or negative relative reference resolves to the equivalent absolute file identifier; the catalog is consulted to determine the equivalent. If there is no absolute name in the catalog that corresponds with the resolved relative reference, the reference is treated as a normal file identifier.

A signed positive relative reference typically represents a new generation to be added to the group. The increment is added to the generation number of the current (zeroth) generation to form the number of a new generation. A signed positive relative reference is an alternative means of specifying the equivalent absolute name.

Generation wrapping:

If the sum of the increment and the current generation number is greater than 9999, the new generation number is formed by wrapping (subtraction of 9999). For examples, see the related reference about insertion and wrapping of generation files.

If a group does not include a generation that has the new number, and either of the following conditions is true, a new generation is added to the group in the appropriate ordinal position:

  • The file is not OPTIONAL and the open mode is OUTPUT.
  • The file is OPTIONAL and the open mode is I-O or EXTEND.

If a group already contains a generation that has the new number, the existing generation is reused and might be overwritten if the open mode is not INPUT.

Related concepts  
Generation data groups

Related tasks  
Creating generation data groups