Generation data groups
A generation data group (GDG) is a chronological collection of related files. GDGs simplify the processing of multiple versions of related data.
Each file within a GDG is called a generation data set (GDS) or generation. (In this information, generation data sets are referred to as generation files. The term file on the workstation is equivalent to the term data set on the host.)
Within a GDG, the generations can have like or unlike attributes
including ORGANIZATION
, record format, and record
length. If all generations in a group have consistent attributes and
sequential organization, you can retrieve the generations together
as a single file.
- The files in the group can be referred to by a common name.
- The files in the group are kept in generation order.
- The outdated files can be automatically discarded.
The generations within a GDG have sequentially ordered relative and absolute names that represent their age.
hlq.PAY
: hlq.PAY(0)
refers to the most current generation.hlq.PAY(-1)
refers to the previous generation.hlq.PAY(+1)
specifies a new generation to be added.
hlq.PAY
: hlq.PAY.g0005v00
refers to generation file 5, version 0.hlq.PAY.g0006v00
refers to generation file 6, version 0.
For more information about forming absolute and relative names, see the Related tasks.
Generation order is typically but not necessarily the same as the order in which files were added to a group. Depending on how you add generation files using absolute and relative names, you might insert a generation into an unexpected position in a group. For details, see the related reference about insertion and wrapping of generation files.
GDGs are supported in all of the COBOL for Linux® file systems except MONGO.
For information about creating and initializing generation data groups, see the appropriate related task.
To delete, rebuild, clean up, modify, or list generation
groups, or add or delete generations within a group, use the gdgmgr
utility. To see
a summary of gdgmgr
functions, issue the following command: gdgmgr
-h
. For further details about the gdgmgr
utility, see its
man
page via the following command: gdgmgr
-man
.
Use case
- A maximum of 7 days a week
- A maximum of 31 days in a month
- A maximum of 3 months in a quarter
- A maximum of 4 quarters in a year
Example
- Export the filesystem name.
- Compile and link your program as usual. To learn more, see Compiling, linking, and running programs.
- Create a GDG base
gdg_test
and list the contents using this command:gdgmgr -e -s -L 2 -c gdg_test -l
.The output is as follows:GDG: gdg_test Catalogue = ./gdg_test.catalogue Limit = 2 Days = 0 NoEmpty Scratch Entries = 0
- Execute the program.
- Create different GDG versions and list the contents using this command:
gdgmgr -l gdg_test
.
cbl compile,pgmname(mixed)
ID DIVISION.
PROGRAM-ID. 'ins_gdg'.
ENVIRONMENT DIVISION.
INPUT-OUTPUT Section.
FILE-CONTROL.
SELECT GDS_File
ASSIGN using gds_filename
ORGANIZATION is sequential.
DATA DIVISION.
FILE SECTION.
FD GDS_File
Record contains 80 characters
RECORDING MODE is F.
01 GDS_File-record pic x(80).
Working-Storage Section.
01 record-in pic x(80) value spaces.
01 record-out pic x(80) value spaces.
01 gds_filename pic x(64) value spaces.
Linkage Section.
Procedure Division.
move 0 to return-code.
display " Start ..."
move 'gdg_test.g0001v00' to gds_filename.
move ' Initial GDS 0001 [gdg_test.g0001v00]'
to record-out.
open output GDS_File
write GDS_File-record from record-out
close GDS_File
move 'gdg_test(+1)' to gds_filename.
move ' Increment of +1 (1) [gdg_test.g0002v00]'
to record-out.
open output GDS_File
write GDS_File-record from record-out
close GDS_File
move 'gdg_test(+1)' to gds_filename.
move ' Increment of +1 (2) [gdg_test.g0003v00]'
to record-out.
open output GDS_File
write GDS_File-record from record-out
close GDS_File
display " End ..."
goback.
END PROGRAM 'ins_gdg'.