Back to Summer Batch home page

Generation Data Groups (GDG)

Summer Batch allows the emulation of main frames' generation data groups (GDG) using a specific resource loader, Summer.​Batch.​Extra.​IO.​GdgResourceLoader. The resource loader is in charge of creating instances of IResource when required and is used by ResourceInjectionValue when injecting resources (see section New Injection Parameter Values). To use GDG, the Unity loader must register the GDG resource loader in the container:

Example 7.18. Registration of the GDG Resource Loader

protected override void LoadConfiguration(IUnityContainer container)
    container.SingletonRegistration<ResourceLoader, GdgResourceLoader>().Register();

A generation data group is a group of output files. Files in the group are identified by a reference number: the file generated by the current execution of the batch is 1, the file generated by the previous execution is 0, and so on. A file in a GDG is referenced using the “gdg://” protocol as follows:


Where “<path>” is the path to the file without the extension or the generation number, “<number>” is the reference number of the file, and “<extension>” is the extension of the file (which is optional). The final file name will be computed by concatenating the path with the generation number and the extension if there is one. For instance, if the generation number of the GDG for the previous execution was 23, the reference “gdg://data/output(1).txt” would result in the file name “data/outputG0024V00.txt”.

Groups can be configured using a specific application setting (in “App.setting”) named “gdg-options”. It should contain a character string with options for the groups used in the batch. Each group is identified by its path concatenated with “(*)” and its extension (e.g., “gdg://data/output(*).txt”). The grammar for the options is the following:

<gdg-options> ::= <gdg-option> | <gdg-option> "," <gdg-options>
<gdg-option>  ::= <group> | <group> "," <options>
<group>       ::= <path> "(*)" | <path> "(*)." <extension>
<options>     ::= <option> | <option> "," <options>
<option>      ::= <limit> | <mode>
<limit>       ::= "limit=" <integer>
<mode>        ::= "mode=empty" | "mode=notempty"

The “limit” option sets the number of file that should be kept in the group and the “mode” options specify how files are managed once the limit has been reached: in the “empty” all files existing before the current execution are deleted while in the “notempty” the oldest files are deleted so that the final number of files is the limit. The default mode is “notempty”.

Example 7.19. GDG Configuration

Assuming the working directory contains the following files:


that the “gdg-options” setting contains “data/customer/report(*).txt,limit=3,data/commands/summary(*).txt,limit=3,mode=empty” and that the current batch execution will write to “gdg://data/customer/report(1).txt” and “gdg://data/commands/summary(1).txt”, at the end of the batch execution the working directory will contain the following files:


Referencing all files in a group.  It is possible to reference all existing files in a generation data group by using the “*” wildcard instead of a reference number (e.g., “gdg://data/customer/report(*).txt”).

Back to Summer Batch home page