Back to Summer Batch home page

Sort Tasklet

The Summer.Batch.Extra.Sort.SortTasklet tasklet can sort or merge files using the syntax of DFSORT. It is useful when modernizing batches from z/OS mainframes. Only supported features are described in this section, see the DFSORT documentation for more details on the legacy syntax.

Specifying input and output files.  The input files are specified using the Input property, which expects a list of resources, and the output file is specified using the Output property, which expect a resource. The encoding of the input files can be set using the Encoding property. If no encoding is specified, the default encoding is used. All the input files must have the same encoding, which will be preserved in the output. If the input files have a header, it must be specified using the HeaderSize property; this header will be reproduced in the output file.

Reading and writing records.  A record is a unit of information that can be sorted and the sort tasklet supports three types of records: (1) records separated by a character string (e.g., records separated by new line characters), (2) fixed-length records, and (3) records with a record descriptor word (RDW) specifying the size. For separated records, the separator must be set with the Separator property. For fixed-length records, the length must be set with the RecordLength property. If none of these properties have been set, the tasklet will assume that records have an RDW.

Sorting files.  To sort files, a sort card must be specified with the SortCard property. If it is set, a comparer will be generated to sort the records in the input files, otherwise the records will be kept in the same order as in the input files. The sort card should respect the DFSORT syntax (see section Supported DFSORT Features for more information).

Filtering records.  Records can be filtered using the Include and Omit. Each property uses the DFSORT syntax for records selection. Only records that are selected by Include and not selected by Omit will appear in the output.

Transforming records.  Records can be transformed using the Inrec and Outrec properties. Each property uses the DFSORT syntax for record transformation. Records are transformed before, respectively after, they are sorted or filtered using Inrec, respectively Outrec.

Managing duplicates.  By default, all records that are identical in the context of the sort card will appear in the output. The order among these identical elements in unspecified. If the SkipDuplicates property is set to true, only one of the identical records will be kept (the selection is also unspecified). It is also possible to sum the lines by setting the Sum property with a DFSORT sum card.

Supported DFSORT Features

Sort Card

The sort card can either be a list of fields or specify a default format using the following syntax:

[FORMAT=<format>,]FIELDS=<fields>[,FORMAT=<format>]

The fields should conform to the DFSORT syntax, but only the following format are supported:

As with sort cards, include and omit cards can either be a list of conditions or specify a default format:

[FORMAT=<format>,]COND=<conditions>[,FORMAT=<format>]

The conditions should conform to the DFSORT syntax and supports the following features:

The record formating in inrec and outrec cards only supports the standard DFSORT “BUILD” syntax with the following elements:

Back to Summer Batch home page