.2 Sort/Merge Operations (MFJSORT

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

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:
y y y y

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:
y y

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

You can define up to 32 control fields. two-byte packed decimal year data INREC MERGE . Supports substring comparison and bit logic (bit operator and bit comparison) tests. You can include a COPY request in the MERGE statement. Defines a merge operation. Program Control Statements ALTSEQ END INCLUDE Description Specifies an alternate collating sequence for AQ control fields. The rules for coding the statements are identical to the mainframe utility. Note that INREC may change the location of the control fields used by SORT.The program control statements supported by MFJSORT are listed below. one-byte binary year data Y2C or Two-digit. You can specify up to 16 conditional expressions. 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. with sign and first digit ignored Y2B Two-digit. Indicates the end of the program control statements. You can select portions of the input data sets for merging. together with any restrictions. If omitted. MFJSORT reads to end of file. OUTFIL. one-byte decimal year data Y2P Two-digit. MERGE. Rearranges input records before sorting or merging. but the total length of the control fields must not exceed 1.024 bytes. Includes records from the input data set based on comparison testing of one or more fields in the input record. OUTREC and SUM statements. (COMP-1 and COMP-2) PD Packed decimal PD0 Packed decimal. Only 4-byte and 8-byte forms are supported. two-byte character or zoned decimal Y2Z year data Y2D Two-digit.

the EDIT. . Use the SPLIT operand to distribute the records evenly among the output data sets. The OUTREC operand provides editing and control of the way numeric fields are presented with respect to length. Other exits are not supported. HEADER2. Only the first value of this statement. It can also insert literal variables into the output record. TRAILER1. TRAILER2. with special indicators ZD Zoned decimal Specifies the names of the E15 and E35 exit programs. maximums.MODS OMIT OUTFIL Two-digit. for example. for example. leading or suppressed zeros. y Y2S y y y y Use the INCLUDE. together with OUTREC. totals. Supports substring comparison and bit logic (bit operator and bit comparison) tests. is used. You can specify up to 16 conditional expressions. The INCLUDE and OMIT operands provide all of the capabilities of the INCLUDE and OMIT statements. Specifies record length information. Excludes records from the input data set based on comparison testing of one or more fields in the input record. Writes multiple output files. and user-defined masks can be created using. OUTREC RECORD Rearranges output records after sorting or merging. HEADER1. Use the CHANGE option to select a character or hexadecimal string for output from a lookup table. SECTIONS and NODETAIL. OMIT and SAVE operands to select the records to be included in each output data set. symbols. two-byte character or zoned decimal year data. Use the STARTREC and ENDREC operands to select a range of records to be included in each output data set. OUTFIL allows for extensions. to create complex reports including. The logical record length of the input data set overrides any value specified by the RECORD statement. Use the operands LINES. Twenty six pre-defined editing masks (M0 to M25) are available. and so on. Supports reformatting of records as well as the creation of formatted reports. minimums and averages for numeric input fields. which specifies the maximum record length. all other values are ignored. hexadecimal or bit string as input. SIGNS and LENGTH options. based on a character. while SAVE can be used to select the records that are not selected for any other subset.

024 bytes. Optionally. You can define up to 32 control fields. You can request ascending or descending sequences for the same control field types as described for the MERGE statement.SORT SUM Defines a sort operation. numeric fields in the duplicate records can be summed in the output record. You can include a COPY request in the SORT statement. Produces only one output record for records with duplicate sort fields. 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 . but the total length of the control fields must not exceed 1.