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 (respectively, output files) are specified using the Input (respectively, Output) property, which expects a list of resources. 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.

Multiple output files.  The sort tasklet support multiple output files similarly as the OUTFIL command in DFSORT. This is done in two steps: 1) specify a list of output files in the Output property, then 2) specify the outfil configurations as a string in the Outfils property. The Outfils property takes a list of configurations separated by semi-colons (see section Outfils card for more information). If only one output file is specified, the Outfils property is ignored and the Outrec property is used to format the records. If there are more than one output file, the Outrec property is ignored and the Outfils property must contain the same number of configurations.

Supported DFSORT Features

Sort Card

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


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

  • String (CH)
  • Zoned (ZD)
  • Packed (PD)
  • Signed binary (FI) and unsigned binary (BI)

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


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

Comparable elements
  • Fields
  • Decimal constants
  • Character string constants
Field formats
  • String (CH) and sub-string (SS)
  • Zoned (ZD)
  • Packed (PD)
  • Signed binary (FI) and unsigned binary (BI)
Comparison operators
  • Equals (EQ)
  • Different (NE)
  • Greater (GT)
  • Greater or equals (GE)
  • Lower (LT)
  • Lower or equals (LE)

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

  • Fields copy (with the same supported formats as for sort cards).
  • Character string constants (“C'…'”).
  • Hexadecimal constants (“X'…'”).
  • Space constants (“X”).
  • Numeric editing patterns, including predefined masks (“M0” to “M26”). Signs (“SIGN=”) and length (“LENGTH=”) statements are supported.

The outfils card must contain one configuration per output file. Configurations are separated by semi-colons and contains different commands separated by commas. Commands are specified using the following syntax: "<COMMAND>=(<PARAMETERS>)", where COMMAND is the name of the command and PARAMETERS its parameters.

The outfils card support three commands: INCLUDE and OMIT to filter records, and OUTREC to format them. Each command support the same syntax as their card counter-part, as specified previously.

Back to Summer Batch home page