Program Control Statements

The program control statements supported by MFJSORT are listed below. The rules for coding the statements are identical to the mainframe utility.

Note: MFJSORT emulates most major functions of IBM's DFSORT product; see DFSORT and ICETOOL Emulation for more information.

Program Control 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
Signed numeric with leading overpunched sign.
CTO
Signed numeric with trailing overpunched sign.
CSF
Signed numeric with optional leading floating sign.
CSL
Signed numeric with leading separate sign.
CST
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).
FS
Signed numeric with optional leading floating sign.
LS
Signed numeric with leading separate sign.
OL
Signed numeric with leading overpunched sign.
OT
Signed numeric with trailing overpunched sign.
PD
Packed decimal.
PD0
Packed decimal, with sign and first digit ignored.
TS
Signed numeric with trailing separate sign.
Y2B
Two-digit, one-byte binary year data.
Y2C
Two-digit, two-byte character or zoned decimal 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.
Y2Z
Two-digit, two-byte character or zoned decimal year data.
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. Also supports arithmetic operations on input fields, which can be further reformatted if needed.

Arithmetic operations can be done between two numeric fields using the operators ADD (addition), SUB (subtraction), MUL (multiplication), DIV (division). For example:

OUTREC FIELDS=(1,8,ZD,ADD,1,7,ZD,1X,2,5,PD,SUB,5,2,PD)

See note on Sort/Merge Operations (MFJSORT) for restrictions.

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:
AQ
Alternate collating sequence.
BI
Binary.
FI
Fixed integer.
FL
Floating point. Only 4-byte and 8-byte forms are supported. (COMP-1 and COMP-2).
FS
Signed numeric with optional leading floating sign.
PD
Packed decimal.
ZD
Zoned decimal.

OVFLO Parameter

The OVFLO parameter gives you control over the action (continue or terminate), type of message (informational or error), and return code (0 or 16) that can be set during summary overflow. For example:
OPTION OVFLO=-----RC0-----
                      -----RC16-----
  • RC0 - When summary fields overflow: issues overflow message, sets the return code to 0, and continues processing. RC0 is the default value for the OVFLO parameter.
  • RC16 - When summary fields overflow: issues overflow message, terminates processing, and gives a return code of 16.