.2 Sort/Merge Operations (MFJSORT) : 3.2.1 JCL Statements

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

.

2 Sort/Merge Operations (MFJSORT)


MFJSORT emulates the DFSORT and SORT mainframe utilities. It provides the
following sort/merge operations for sequential data sets:

 Sorting data sets by ascending or descending keys


 Merging data sets by ascending or descending keys
 Copying data sets
 Selecting the records to be processed
 Rearranging the fields in the records
 Correctly processing two-digit year fields
 Transforming two-digit year fields to four-digit fields
 Summing numeric fields in records with duplicate keys
 Creating multiple output data sets
 Using an alternate collating sequence
 Executing E15 and E35 exit programs.

3.2.1 JCL Statements


This section describes the JCL statements used with the MFJSORT utility.

3.2.1.1 EXEC Statement

In the EXEC statement you need to specify the program named MFJSORT or its alias
DFSORT or SORT. For example:

//STEPEXEC PGM=DFSORT,......

3.2.1.2 DD Statements

The following DD statements are required for all uses of MFJSORT:

 SYSIN, for the data set that contains the program control statements. It can be
an in-stream data set
 SYSPRINT, for the output listing data set. It must have an LRECL value of at
least 132
 SORTIN, for the input data sets. You can concatenate up to 16 data sets for
SORTIN
 SORTOUT, for the output data set. It is not required if you use SORTOFnn.

The following DD statements are optional:

 SORTINnn, for multiple input data sets. nn begins with 01 and increases by 1 up
to a maximum of 16. SORTINnn and SORTIN are mutually exclusive.
 SORTOFnn, for multiple output data sets. nn begins with 01 and increases by 1
up to a maximum of 16. SORTOFnn is used by the OUTFIL statement.

3.2.2 Program Control Statements


The program control statements supported by MFJSORT are listed below, together with
any restrictions. The rules for coding the statements are identical to the mainframe
utility.

Program Control
Description
Statements

ALTSEQ Specifies an alternate collating sequence for AQ control


fields.
END Indicates the end of the program control statements. If
omitted, MFJSORT reads to end of file.
INCLUDE Includes records from the input data set based on comparison
testing of one or more fields in the input record. Supports
substring comparison and bit logic (bit operator and bit
comparison) tests. You can specify up to 16 conditional
expressions.
INREC Rearranges input records before sorting or merging. Note that
INREC may change the location of the control fields used by
SORT, MERGE, OUTFIL, OUTREC and SUM statements.
MERGE Defines a merge operation. You can include a COPY request
in the MERGE statement. You can select portions of the input
data sets for merging. You can define up to 32 control fields,
but the total length of the control fields must not exceed
1,024 bytes. You can request ascending or descending
sequences for the following control field types:
AQ Alternate collating sequence
BI Binary
CH Character
CLO or Signed numeric with leading overpunched sign
OL
CTO or Signed numeric with trailing overpunched sign
OT
CSF or FS Signed numeric with optional leading floating
sign
CSL or LS Signed numeric with leading separate sign
CST or TS Signed numeric with trailing separate sign
FI Fixed integer
FL Floating point. Only 4-byte and 8-byte forms are
supported. (COMP-1 and COMP-2)
PD Packed decimal
PD0 Packed decimal, with sign and first digit ignored
Y2B Two-digit, one-byte binary year data
Y2C or Two-digit, two-byte character or zoned decimal
Y2Z year data
Y2D Two-digit, one-byte decimal year data
Y2P Two-digit, two-byte packed decimal year data
Y2S Two-digit, two-byte character or zoned decimal
year data, with special indicators
ZD Zoned decimal
MODS Specifies the names of the E15 and E35 exit programs. Other
exits are not supported.
OMIT Excludes records from the input data set based on comparison
testing of one or more fields in the input record. Supports
substring comparison and bit logic (bit operator and bit
comparison) tests. You can specify up to 16 conditional
expressions.
OUTFIL Writes multiple output files. OUTFIL allows for extensions.

 Use the INCLUDE, OMIT and SAVE operands to


select the records to be included in each output data
set. The INCLUDE and OMIT operands provide all of
the capabilities of the INCLUDE and OMIT
statements, while SAVE can be used to select the
records that are not selected for any other subset.
 The OUTREC operand provides editing and control of
the way numeric fields are presented with respect to
length, leading or suppressed zeros, symbols, and so
on. Twenty six pre-defined editing masks (M0 to
M25) are available, and user-defined masks can be
created using, for example, the EDIT, SIGNS and
LENGTH options. Use the CHANGE option to select
a character or hexadecimal string for output from a
lookup table, based on a character, hexadecimal or bit
string as input.
 Use the STARTREC and ENDREC operands to select
a range of records to be included in each output data
set.
 Use the SPLIT operand to distribute the records
evenly among the output data sets.
 Use the operands LINES, HEADER1, TRAILER1,
HEADER2, TRAILER2, SECTIONS and
NODETAIL, together with OUTREC, to create
complex reports including, for example, totals,
maximums, minimums and averages for numeric
input fields.

OUTREC Rearranges output records after sorting or merging. It can


also insert literal variables into the output record. Supports
reformatting of records as well as the creation of formatted
reports.
RECORD Specifies record length information. Only the first value of
this statement, which specifies the maximum record length, is
used; all other values are ignored. The logical record length
of the input data set overrides any value specified by the
RECORD statement.
SORT Defines a sort operation. You can include a COPY request in
the SORT statement. You can define up to 32 control fields,
but the total length of the control fields must not exceed
1,024 bytes. You can request ascending or descending
sequences for the same control field types as described for the
MERGE statement.
SUM Produces only one output record for records with duplicate
sort fields. Optionally, numeric fields in the duplicate records
can be summed in the output record. The sum operation can
be done for the following control field types:
BI Binary
FI Fixed integer
FL Floating point
PD Packed decimal
ZD Zoned decimal

You might also like