Insertion and wrapping of generation files

A new generation in a GDG is typically inserted after the current generation and thus becomes the new current generation.

If the sum of the increment and the current generation number is greater than 9999, wrapping (subtraction of 9999) occurs, and the new generation number will be less than the current generation number. In this case the new generation might be inserted before the current generation, becoming a previous (less current) generation in the group.

Consider the following initial group:

0: base.g0001v00 

The number before the colon, called an epoch number, is used to cause insertion to occur predictably and enforces limits on generation numbers.

Typically a new generation is inserted into the group in the position indicated by the new generation number after any wrapping has occurred, and the epoch numbers within the GDG are not changed.

In each of the following examples, the least current generation is listed first, and the most current generation is listed last. Italics indicates a new generation that has been added to the group.

Consider the example initial group shown above. If base(+1) is specified, the current generation number (0001) is incremented by 1. The group as a result will contain the new generation 0002 as shown:

0: base.g0001v00 
0: base.g0002v00

If base(+4) is then specified, the current generation number (0002) is incremented by 4. The group as a result will contain the new generation (0006) as shown:

0: base.g0001v00
0: base.g0002v00
0: base.g0006v00

If base(+9997) is then specified, the current generation number (0006) is incremented by 9997. The resulting generation number (10003) is greater than 9999 and is therefore wrapped to become 0004. In the resulting group this new generation (0004) will be inserted before the current generation (0006) as shown:

0: base.g0001v00 
0: base.g0002v00
0: base.g0004v00 
0: base.g0006v00

After this last insertion, it is not an error to open base(+9997) for input, because the reference to base(+9997) denotes the existing file base.g0004v00 and does not cause any change to the structure of the group.

Typically, the epoch number of a new generation is the same as the epoch number of the current generation. There are however two cases in which epoch numbers are adjusted, and the insertion position of the new generation is less obvious:

related concepts  
Generation data groups

related tasks  
Using generation data groups

related references  
Name format of generation files  
File specification