Sort MFX
Sort MFX
(EADLINE GOES HERE
PROGRAMMER’S GUIDE
3YNCSORT -&8 FOR Z/3
2ELEASE
SI-4301-102813
SYNCSORTCOM |
NOTICE
This document contains proprietary and confidential material, and is only for use by licensees of the
MFX proprietary software system. This publication may not be reproduced in whole or in part, in
any form, except with written permission from Syncsort Incorporated.
Table of Contents
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.1
Note: Release level 1.4.2.0 (TPF2) contains some feature enhancements. Revision bars (|)
to the left of the documentation denote these changes.
Since we do not want this change to have any impact on any of your jobs or operations,
there are no changes to program or library names. No JCL changes are required. The
header and messages in the SYSOUT data set have not been changed.
Performance Improvements
MFX performance has been improved by the following.
• MFX’s exploitation of the System z Integrated Information Processor (zIIP) has been
extended to include more sort processing. Offloading sort processing to a zIIP lowers
the billable CPU time associated with sorting. These savings may reduce software
licensing costs and delay costly upgrades.
• MFX’s DB2 Query facility has been enhanced to exploit the multiple-row fetch feature
of DB2. MFX will automatically fetch 100 rows at a time, unless this number has been
overridden with the new MULTIFETCH PARM. Fetching multiple rows at a time
improves performance.
• INCLUDE/OMIT processing has been improved to lower CPU time and elapsed time.
The new OUTPUT parameter of the OUTFIL control statement provides the ability to cre-
ate an output file in a PDF, HTML or RTF format. Any of these files can be e-mailed as an
attachment to one or more recipients.
The new DATEADD parameter of the INREC, OUTREC and OUTFIL OUTREC control
statements allows you to add or subtract units of days to or from an input record field date
and create an output record date field in the same format with the same length.
The new DATEDIFF parameter of the INREC, OUTREC and OUTFIL OUTREC control
statements allows you to compute the interval between two date values.
Additional capabilities are provided with the following new subparameters: ADDDAYS,
ADDMONS, ADDYEARS, SUBDAYS, SUBMONS, SUBYEARS, NEXTDday, PREVDday,
LASTDAYW, LASTDAYM, LASTDAYQ, LASTDAYY.
The new parameters ALLDUPS, FIRSTDUP, LASTDUP and NODUPS of the DUPKEYS
control statement provide more control over which records are retained.
Substring processing with the INCLUDE/OMIT control statement has been enhanced to
allow searching for a pattern constant (wildcard) within a field in a record.
Other Enhancements
• The new DATE5 subparameter generates a date that includes microseconds in the
form 'yyyy-mm-dd-hh.mm.ss.nnnnnn'.
• The new TOJUL and TOGREG subparameters can be used to convert any Y2x/Y4x
input format to any other Julian or Gregorian Y2x/Y4x format.
• The new WEEKDAY subparameter can be used to convert any Y2x/Y4x input field
to day-of-the-week output.
• Additional Y2x fields are now supported with the DT/DTNS subparameters.
• The following new keywords have been added to the TRAN subparameter to
provide additional translation capabilities: ATOE for ASCII to EBCDIC, ETOA for
EBCDIC to ASCII, HEX for hexadecimal translation, UNHEX for hexadecimal to
binary, BIT for bit translation, UNBIT for bit to binary.
• Formats of CH, AQ, FI, PD and ZD are now supported in addition to BI.
• DD names other than SORTJNF1 and SORTJNF2 can now be specified with the
new F1 and F2 parameters.
• The new NOSEQCK parameter can be used when the SORTED parameter is
specified to bypass the sequence check on the sorted input file.
• The new TASKID parameter can be used to change the first two bytes of the DD
names for the dynamically allocated SORTWORK data sets used to sort the
JOINKEYS input file.
• The new NOTMTOFL parameter can be used to specify the action to be taken when
any non-SORTOUT OUTFIL data set contains at least one record.
• The new IFTRAIL parameter can be used to identify an existing trailer record in
the input data for an OUTFIL group and update any count or total fields in the
record.
• The new ACCEPT=n parameter can be used to limit the number of records
processed for the OUTFIL group.
• The new ? symbol can be used to place a one-byte indicator in the reformatted
record that indicates whether the reformatted record is a paired or an unpaired
joined record.
• PARM Options
• The new NOTMTOUT PARM can be used to specify the action to be taken when
SORTOUT in a sort, merge or copy application contains at least one data record.
• The new MULTIIN facility allows you to provide multiple VSAM and non-VSAM
files as input to a sort or copy application by using multiple SORTMInn DD
statements. (The operating system does not support the concatenation of VSAM
data sets, so this facility offers a method of addressing this need.) The new
&MULTIINDD parameter of the INREC control statement can be used to insert the
two-byte character string identifying the input record’s origin into the record
produced by the INREC statement. The new &MULTIINDD parameter of the
INCLUDE control statement can be used in a comparison to determine the input
record’s origin.
• The decimal floating point data format (FD) is now supported on the SORT,
MERGE, DUPKEYS and SUM control statements. It is also supported for the NUM
option of the INCLUDE/OMIT control statements. You can convert numeric data to
an output format of FD with the INREC, OUTREC and OUTFIL control
statements.
• Use of the decimal floating point data format requires a z9 or later processor with
the PFPO instruction.
• MFX allows you to specify symbolic dictionary names (symbols) for fields, constants
and output columns and use these dictionary names in MFX control statements.
This facility has existed in MFX for many releases. It is now documented in chapter
13 of the Programmer’s Guide.
• The following words have been added to the Reserved Words list for
dictionary_names: ADDDAYS, ADDMONS, ADDYEARS, DATEDIFF, DATE5,
LASTDAYx, NEXTDxxx, PREVDxxx, SUBDAYS, SUBMONS, SUBYEARS, and
Y4x.
Processing Changes
In previous releases, the PAD and TRUNC PARMs (and their corresponding installation
parameters SOPAD and SOTRN) were not honored for a non-OUTFIL SORTOUT in an
OUTFIL application, contrary to the specification documented in the Programmer’s Guide.
Effective with Release 1.4, these parameters will be honored for non-OUTFIL SORTOUT
data sets in applications with an OUTFIL statement. A non-OUTFIL SORTOUT data set
in an application with an OUTFIL statement is a SORTOUT file that is not referred to in
the FILES or FNAMES subparameter of the OUTFIL statement.
Variable-length OUTFIL headers and trailers will no longer be padded with blanks out to
the full LRECL. This can shrink the size of the OUTFIL data set, in some cases substan-
tially.
Messages
The following messages are new.
• WER073I displays the input DD data set name for non-merge applications. For
concatenated DDs, only the first data set name will be displayed and the number of
concatenations will be displayed. For MULTIIN input, the WER073I message will be
displayed for only the first input ddname that is read.
• WER074I displays the output DD data set name. This message will be provided for
each output file specified.
• WER277A indicates that there is an invalid use of the VL subparameter of JFY or SQZ.
• WER434I indicates that the key format on the JOINKEYS control statement was
specified in both the FIELDS and FORMAT parameters. The FIELDS format will be
used.
• WER465A indicates that an error occurred during the OPEN for the SYMNAMES data
set. (This is an old message but it was not documented.)
• WER466A indicates that errors were found in the symbols definitions in the
SYMNAMES data set.
• WER495A indicates that a SORTOUT or OUTFIL data set has at least one record and
NOTMTOUT or NOTMTOFL is in effect.
• WER495I indicates that a SORTOUT or OUTFIL data set has at least one record and
NOTMTOUT or NOTMTOFL is in effect.
• WER496A indicates that the MULTIIN parameter cannot be used with MERGE or
JOIN.
• WER498A indicates that the Decimal Floating Point facility is required in order to
specify decimal floating point fields.
• WER499A indicates that the PFPO instruction is required to support conversion from
FL to FD fields.
• WER502A indicates that one or more Java classes could not be found or loaded.
• WER503A indicates that the OUTFIL OUTPUT parameter is being used, but some
Java exceptions were detected.
• WER504A indicates that the dynamic allocation of the STDENV data set failed.
• WER506I indicates that some PDF or RTF output lines were wrapped.
• WER507A indicates that HFS files are required for PDF, RTF or HTML output.
• WER508A indicates that the level of the SSOUTPUT.JAR file does not match the MFX
level.
• WER510A indicates that there is a processing conflict with the OUTFIL OUTPUT
parameter.
• WER511A indicates that a problem occurred in the Java environment during the
processing of the OUTFIL OUTPUT feature.
• WER523A indicates that MFX installation options for the Java environment must be
set up in order to use the OUTFIL OUTPUT feature.
• WER524A indicates that module JVMLDM was not found and the Java JZOS
environment is not available.
• WER526A indicates that the JAVA environment requires the SVC module to be in
effect.
• WER527A indicates that certain control statements in the xxxxCNTL DD file are not
permitted in a join application because these statements are inappropriate for the
subtask that reads a JOINKEYS input file.
• WER551I indicates ZPCopy could not be used because the library or a module is not
APF-authorized.
• WER552I indicates that use of the ZPCopy product will benefit this application.
• WER170A could indicate a problem with multiple input or concatenated data sets. Only
concatenated data sets were indicated previously.
• WER171A could indicate a problem with multiple input or concatenated data sets. Only
concatenated data sets were indicated previously.
• WER250A was modified to provide information about when to consult the VLTESTI
PARM for alternate methods of handling a compare field that extends beyond the end
of the input record.
• WER473A text was changed from ‘BOTH JOINKEYS STATEMENTS MUST HAVE
CORRESPONDING KEY FIELDS OF EQUAL LENGTH’ to ‘INVALID JOINKEYS
STATEMENT FIELD LENGTH’.
• WER490I was modified to include the Y2x or Y4x full date format or a
DATEADD/DATEDIFF date field.
MFX can be initiated through job control language or invoked from a program written in
COBOL, PL/1, or Assembler language. A JCL-initiated sort is more efficient because MFX
totally controls the sort execution, including I/O management and main storage manage-
ment. Exit routines may be written in COBOL, C, FORTRAN, REXX, or Assembler lan-
guage to give a JCL sort additional programming flexibility. Exits may also be in PL/1
when MFX is invoked by a PL/1 program.
• Merging - combining up to 100 pre-sequenced data sets into one data set which has the
same sequence.
• Copying - reproducing a data set without going through the sorting process.
A sort rearranges the records in a data set to produce a specific sequence, e.g., chronological
or alphabetic order. MFX provides the following sorting techniques:
• Disk Sort, the standard sorting technique. Information in the Programmer’s Guide
refers to the Disk Sort unless otherwise indicated.
• PARASORT, a sorting technique that significantly reduces elapsed time for sorts whose
input is a multi-volume tape data set and/or concatenated tape data sets. PARASORT
improves performance by using multiple tape drives in parallel. PARASORT is
described in the PARASORT chapter of this guide.
A sort logically consists of four phases that perform the following functions:
• The control statements and JCL information are read and analyzed and the
operational parameters for the sort are established.
• The sorting process completes and the sorted data is written to the specified output
device(s).
Merging
A merge combines up to 100 pre-sequenced data sets into one data set which has the same
sequence. A merge has two phases that perform these functions:
• The control statements and JCL information are read and analyzed and the
operational parameters for the merge are established.
• The files are merged and the merged data is written to the specified output device(s).
Copying
A copy reproduces a file, completely bypassing the sorting process. A copy has two phases
that perform these functions:
• The control statements and JCL information are read and analyzed and the
operational parameters for the copy are established.
MFX’s Data Utility features include a join facility, a multiple output facility, a full range of
report writing capabilities, and a facility to create a PDF, RTF or HTML output file and e-
mail it to one or more recipients. There are also many record selection and record reformat-
ting facilities. These options allow the user to design sort/merge/copy applications that can
accomplish a host of related tasks.
Join Processing
The join facility, controlled by the JOINKEYS, JOIN, and REFORMAT control statements,
joins records from two source files. When you join the records from two files, each record
from the first file (the left side) with a given value in a specified field (the join key) is joined
to each record from the second file (the right side) with the identical value in a specified
field in that record. Thus, if m records from the left side have a given join key value, and n
from the right side have the same join key value, the join results in m*n records with that
join key value.
• Specification of the placement of the data fields within the record created by the join
operation is provided through the REFORMAT control statement. This allows you to
specify which fields from the two records are to be placed in the joined record. Partially
or completely missing fields will be filled into the resulting joined record by the use of a
specified pad byte.
• Specification of whether the join input data is already sorted per the JOINKEYS
control fields is controlled by the SORTED parameter on the JOINKEYS control
statement. If the join input data set is already sequenced according to the specified
JOINKEYS fields, the overall performance of the application improves.
• Inner join, left outer join, right outer join, and full outer join are all supported through
the use of the JOIN control statement.
The multiple output facility (OUTFIL) allows multiple output files to be generated with
just one pass of the sort. Each of these files can have unique specifications that determine
which records are to be included, how the records are to be formatted, and which report
capabilities are to be used. Moreover, all these files can be written to the same output
device, or each can be written to a different device.
Creating Reports
MFX’s SortWriter feature (OUTFIL) allows the user to design comprehensive reports easily
and efficiently. SortWriter options allow output data to be flexibly formatted with headers
and trailers, which can include data fields. Various kinds of numeric results can be pro-
duced at report, page, and section levels. These include totals, subtotals, minimums, sub-
minimums, maximums, submaximums, averages, subaverages, record counts, and
subcounts. Output record fields can be realigned; the records can be padded with blanks,
characters, and binary zeros; and numeric data can be converted and edited. Automatic
pagination, page numbering, and dating are also provided.
The OUTFIL OUTPUT feature can be used to create an output file in PDF, RTF or HTML
format. Any of these files can be e-mailed as an attachment to one or more recipients.
Record selection, record reformatting, and summing are other important MFX Data Utility
features. Record selection via the INCLUDE/OMIT feature permits certain records to be
included or omitted from an input data set based on comparisons between two data fields or
between a data field and a constant. Date data formats work with the CENTWIN option to
ensure that century evaluation is applied to INCLUDE/OMIT comparisons involving 2-
digit year data.
Record reformatting after input and/or before output, provided by the INREC/OUTREC
capability, allows the user to delete or repeat portions of records; insert spaces, characters,
binary zeros, date constants and sequence numbers; realign fields; convert numeric data to
its printable format; and convert data to its printable hexadecimal format. The CENTWIN
option and date data formats enable conversion of 2-digit year fields to printable or packed
decimal 4-digit years of the appropriate century. The ability to delete irrelevant fields
before sorting via INREC can provide important performance benefits. Additionally, a
variable-length record format input file can be converted into a fixed-length format output
file or a fixed-length record format input file can be converted into a variable-length format
output file.
The SUM feature allows records with equal sort control fields to be deleted and optionally
sums numeric fields on those records. The deleted records can optionally be written to a
separate data set.
The report below illustrates the versatility of MFX’s Data Utility and SortWriter features.
First, irrelevant records are omitted from the input file and the input record is reformatted
to eliminate unnecessary data fields. Then the file is sorted by invoice status and invoice
date. The output record is reformatted for readability and the numeric fields are converted
and edited. The report itself is divided into sections and subsections based on control field
breaks. Headers and trailers identify the data fields, provide record counts and section and
cumulative totals, and include the date and page number.
PAGE: 3
ACCOUNTS RECEIVABLE AGING REPORT FOR 01/30/92 DATE:04/22/92
*********************************************
INVOICE STATUS:O
*****************
BALTIC AVENUE CORP CLE OH 0636 86022207 2/15/91 650.00 29.25 650.00 29.25
FASTEROOT EQUIP BAL MD 4980 86022205 2/15/91 1,700.00 76.50 1,700.00 76.50
FEDERAL FABRICS SHV LA 5143 86022204 2/15/91 1,750.00 70.00 1,750.00 70.00
PATIO PRODUCTS MRY CA 3029 86022203 2/15/91 850.00 51.00 850.00 51.00
TURENIUS FOR. EXCH. DTT MI 8325 86022201 2/15/91 1,600.00 64.00 1,600.00 64.00
WINES ASSOCIATES SMF CA 1794 86022209 2/15/91 750.00 45.00 750.00 45.00
DESIGN TECHNOLOGIES LAX CA 2520 85124017 12/15/91 360.00 21.60 360.00 21.60
POLL DATA CORP LAX CA 0846 85124019 12/15/91 600.00 36.00 600.00 36.00
MFX can also interact with exits and invoking programs such as VS COBOL II, COBOL/
370, C370 V2R1 with V2R2 C370 library, SAA AD/Cycle C370 Release 2, and IBM C/C++
V3R2 programs.
MFX’s PARMEXIT feature permits the dynamic modification of PARM values based on the
conditions at execution time. This feature facilitates the passing of additional parameters
to specific jobs.
Other operational features include resident, reentrant code, interactive and streamlined
installation and maintenance procedures; automatic release or secondary allocation of
direct access intermediate storage (SORTWK) and output (SORTOUT) space without JCL
specification; dynamic allocation of SORTWK space under z/OS (DYNALLOC); and auto-
matic incore sorting.
MFX PipeSort enables MFX to run multiple sorts simultaneously on the same input data.
For large input files, MFX PipeSort significantly reduces total elapsed time compared to
running separate sort jobs.
For more detailed information regarding each of these products, see “Chapter 16. Value-
Added Products”.
MFX Control Statements describes how to specify and use the ALTSEQ, DUPKEYS,
END, INCLUDE/OMIT, INREC/OUTREC, JOIN, JOINKEYS, MODS, OUTFIL, RECORD,
REFORMAT, SORT/MERGE, and SUM statements. The discussion of a particular control
statement includes these topics: the statement’s syntax format, the versatility provided by
the various parameters (many of which are unique to MFX), and the interaction between
the control statement and other statements.
How to Use MFX’s Data Utility Features explains and illustrates the Data Utility and
SortWriter features through a series of sample applications. Each application is self-con-
tained and provides instructions for specifying both the required JCL and the appropriate
control statements.
JCL and Sample JCL/Control Statement Streams analyzes MFX’s job control require-
ments and describes the MFX DD statements, each of which is illustrated with an example.
JCL and control statement streams for MAXSORT and PARASORT are also described.
Numerous examples are provided.
PARM Options describes the operational parameters of MFX and identifies the delivered
defaults. This chapter explains how to specify such features as dynamic allocation of
SORTWK space under z/OS, automatic secondary allocation and release of SORTWK space,
the ability to skip a certain number of records or stop after sorting a certain number of
records, and message routing.
Invoking MFX from a Program describes MFX invocation through assembler programs
using 24-bit and 31-bit parameter lists. Numerous examples are provided.
The Coding and Use of Exit Programs indicates at which points during sort processing
user-written exit routines can be executed. Each exit point is fully documented together
with the appropriate tasks. Examples of COBOL E15 and E35 exit routines for fixed and
variable-length records are included.
The Flow of the Sort provides a skeletal view of the flow of control in the standard Disk
Sort (including the incore sort), merge and copy. This chapter indicates the order in which
the control statements and exit routines are processed, information which is particularly
useful at the design stage of an application.
MAXSORT explains when MAXSORT should be used, describes its JCL requirements,
control statements and PARM options, and provide examples. The chapter also examines
MAXSORT’s restart capability and its operator interface.
MFX DB2 Query Support explains how MFX can improve performance by allowing DB2
data to be passed directly into a SORT or COPY operation without the use of setup steps or
user-written E15 exits.
Multiple Input Files explains how to specify multiple VSAM and non-VSAM data sets as
input to MFX with the MULTIIN facility. The MULTIIN facility can be used for a SORT or
COPY application.
The Dictionary Feature describes how to create symbolic dictionary names for fields, con-
stants and output columns, and use those dictionary names in MFX control statements.
The HISTOGRM Utility Program describes how to use the HISTOGRM program to
report on the composition of variable-length files. This program indicates the average
record length, byte total, record total, block count and record count. Job control require-
ments, control statements and messages are outlined. Sample job streams illustrate how to
run HISTOGRM as a separate job and as an E15 exit during a variable-length sort.
Value-Added Products describes PROC MFX – An Accelerator for SAS® Sorting and MFX
PipeSort. This chapter also provides detailed information regarding their functions and
special features.
Messages documents all of the WERnnnx messages generated by the MFX program.
Installation Guide
This manual explains how to install and maintain MFX and defines the default options.
This two-part user’s guide demonstrates how MFX’s versatile Data Utility features provide
an efficient, one-step alternative to writing, testing and debugging programs. Five compre-
hensive sample applications illustrate how the control statements work together to produce
formatted reports.
This user’s guide explains how to use the special MAXSORT feature of MFX to sort very
large amounts of data with only a limited amount of disk space. MAXSORT’s unique restart
capability is described and sample job control streams and tuning information are included.
This booklet demonstrates through several examples various approaches for creating appli-
cations with the join facility. Each example contains a statement of the problem, a sample
of the inputs, MFX control statements used to produce the output, and a sample of the out-
put.
The control statements tell MFX how to process files. There are 16 control statements:
DUPKEYS Deletes records with equal SORT or MERGE fields; optionally cal-
culates the sum, minimum, maximum, or average values of
numeric fields with equal SORT or MERGE fields.
INCLUDE Specifies the criteria which determine whether or not records are
included in an application.
JOINKEYS Enables join feature processing and identifies the fields used to
select records for join processing.
OMIT Specifies the criteria which determine whether or not records are
omitted from an application.
OUTFIL Describes the output file(s) and specifies SortWriter and processing
options.
SORT Defines a sort or copy application and specifies sort control fields.
SUM Deletes records with equal SORT or MERGE fields and sums
numeric fields on those records.
XDUP
END
JOIN F1
F2
ONLY
FILE = F1
F2
F1= ddname
F2= ddname
TASKID=xx
CKPT No checkpoint
CHKPT
EQUALS NOEQUALS
NOEQUALS
FILES=n
MODS No exits
,N
,S
,C
exit-name 1 =(r 1 ,b 1 [,d 1 ] ),...,exit-name 16 =(...)
,E
,X
,T
OUTFIL ACCEPT=n
BLKCCH1
BLKCCH2
BLKCCT1
Record format
FTOV
unchanged
IFTRAIL=(subparms)
60 (if report-writing
n
LINES= ANSI parameters)
(ANSI,n)
OUTPUT = subparm
FIELDS
PARSE=(subparm), =(fields) ,CONVERT
BUILD ,VTOF
PARSE=(subparm), OVERLAY=(fields)
FINDREP=(subparm)
F
TYPE=
V
REFORMAT ,FILL=f
CKPT No checkpoint
CHKPT
d
nn,mm
DYNALLOC = (d,n (,RETRY= OFF ,SC=s )
OFF
EQUALS NOEQUALS
NOEQUALS
n
FILSZ =
En
n
SIZE =
En
XSUM
SORT Required for sort or copy Required for sort; copy not supported
Table 2. Control Statement Usage for Disk Sort, MAXSORT, and PARASORT
When specifying record fields on any of these MFX control statements or parameters, refer
to the record as it appears at that stage of MFX processing. For example, when specifying
Join Processing
JOIN, JOINKEYS, REFORMAT
Control Statements
Record Selection
Conventional SORTIN INCLUDE/OMIT
SORTJNF1, SORTJNF2
Sort Processing Control Statement
Join Processing
Field Selection
INREC
Control Statement
Record Arrangement
SORT
Control Statement
Combining/Eliminating Duplicate
Records
SUM or DUPKEYS
Control Statement
• Control statements can be in any order, except for the END control statement which, if
specified, must be last.
• Each control statement, except for JOINKEYS and OUTFIL, can be specified only once
for a particular application.
• The control statement can begin in column 2 through column 69. If labels are used, the
control statement must be separated from the label by at least one blank.
• The control statement name must be the first field (or the first field after a label) of the
first card image of the control statement. It cannot be continued on a continuation card
image.
• The last operand of each control statement must be followed by at least one blank.
Specifying Parameters
• Parameter
• Parameter=value
Parameter=(value)
Parameter(value)
• Parameter=(value1,value2,...,valuen)
Parameter(value1,value2,...,valuen)
• The parameter(s) must be preceded and followed by at least one blank. A blank
separates the parameter(s) from the control statement name and also indicates the end
of the control statement.
• If the parameter(s) end in column 71, column 72 must contain a blank to signal the end
of the control statement.
• With the exception of literal strings and constants, a parameter value cannot exceed 28
alphanumeric characters. Parameter values cannot include commas, equal signs, or
parentheses.
• With the exception of literal strings specified as parameter values, blanks are not
permitted within parameters.
• The first byte of every fixed-length record is position 1, the second byte position 2, and
so on.
• Bytes 1 through 4 of variable-length records are reserved for the Record Descriptor
Word (RDW). For these records, the first byte of the data portion is position 5.
• Some control statements support bit-level processing. This means a binary control field
can begin and end on any bit of any byte. The 8 bits in each byte are numbered 0
through 7. For example, a position value of 7.4 designates a field beginning on the fifth
bit of the seventh byte. A length value of 7.4 designates a field 7 bytes, 4 bits long.
• Make sure the position value takes into account any record reformatting and data
conversion that may have resulted from MFX data utility processing or exit programs.
Refer to Figure 2 (“Data Utility Processing Sequence”) on page 2.11 and “Chapter 8.
The Flow of the Sort”.
• When proper processing depends on data format, the format of the field must be
specified.
• The format of the field must be appropriate to the task. For example, only numeric
fields can be SUMmed.
• When all the fields have the same format, the format value can be specified just once
through the FORMAT=f subparameter. The FORMAT=f subparameter cannot be used
when the INCLUDE/OMIT parameter is specified on the OUTFIL control statement.
• Identify a comment card image by placing an asterisk (*) in column 1. Comments can
extend through column 80.
• To add a comment to a control statement card image, leave one or more blanks after the
last parameter or comma on the image and follow with the comment, which can extend
through column 71.
• Comment lines can be inserted between a control statement and its continuation by
coding an asterisk (*) in column one.
Control statements cannot extend beyond column 71, but they can be continued. To con-
tinue a control statement:
--or--
• When the control statement extends through column 71 and cannot be broken at a
parameter-comma or parameter-colon combination:
• If the control statement does not contain a literal string that would extend beyond
column 71, place a continuation character in column 72 and continue the control
statement on the next card image anywhere between columns 2 and 71.
• If the control statement does contain a literal string that would extend beyond
column 71, place a continuation character in column 72 and begin the continuation
of the literal string in column 16 of the next card image.
COL. 72
SORT FIELDS=(1,10,A,20,5,A,45,7,A),FORMAT=CH,STOPAFT=100,
EQUALS
COL. 16 COL.72
OUTFIL OUTREC=(1:10,8,30:40,10),HEADER2=(1:'CUSTOMER NUMBX
ER',30:'ITEM NUMBER')
In this example, a continuation character is necessary because the literal string in the
HEADER2 specification would extend beyond column 71. The 'X' in column 72 is the contin-
uation character. The literal string is continued in column 16 of the next card image.
Specifying Labels
MFX supports labels. If labels are used, the following rules apply:
• Labels are permitted on all SYSIN control statements, including continuation card
images, but not on the control statements passed by an invoking program or the
$ORTPARM DD statement.
• Labels can be any length, provided the other rules which apply to control statements
are followed.
• At least one blank must separate the label from the control statement name or
parameter that follows it.
• Braces { } indicate that a choice must be made from the alternatives listed.
• Brackets [ ] indicate an optional item. Two or more vertically listed items in brackets
are mutually exclusive options; only one can be chosen for a particular application.
• Upper-case letters, numbers, commas, equal signs, and parentheses ( ) must be entered
exactly as indicated. Lower-case letters represent variables which must be replaced by
actual values.
For example, a1,a2,...,a5 is equivalent to a1,a2,a3,a4,a5 and represents five a items (vari-
ables which will be replaced with actual values).
ALTSEQ CODE=(F0B7,F1B8,F2B9,F3BA,F4BB,F5BC,F6BD,F7BE,F8BF,F9C0)
If an alternate collating sequence has been provided by installation default, AQ fields col-
late against this sequence, modified by the ALTSEQ control statement. If a default alter-
nate sequence has not been provided, AQ fields collate against the standard EBCDIC
sequence, modified by the ALTSEQ control statement. AQ can be specified for one or more
control fields so that those control fields all use the same alternate collating sequence.
The ALTSEQ control statement also constructs an alternate collating sequence for all con-
trol fields processed by the TRAN parameter of the INREC and OUTREC control state-
ments, as well as the TRAN subparameter of the OUTREC parameter on the OUTFIL
control statement.
ALTSEQ CODE=(ccpp1[,ccpp2]...)
The CODE parameter specifies how the characters of the current collating sequence are to
be reordered to create the alternate collating sequence.
The CODE parameter can contain from 1 to 256 entries, each consisting of four hexadeci-
mal digits. These entries must be separated by commas and enclosed in parentheses.
The character represented by the cc value does not replace the character represented by the
pp value. If both characters occur as sort control fields, they will be considered equal in the
collating process.
Each character (cc entry) can be moved only one time. However, more than one cc entry can
be mapped to the same pp value.
ALTSEQ CODE=(F0B7,F1B8,F2B9,F3BA,F4BB,F5BC,F6BD,F7BE,F8BF,F9C0)
This sample ALTSEQ control statement shows that the numbers 0 through 9 are to collate
before the uppercase alphabet.
ALTSEQ CODE=(F040)
This sample ALTSEQ control statement specifies that the number 0 is to collate as equal to
a blank (X'40').
• Sum specified numeric fields, place the sum in one record and delete the other
records with the same key (SUM)
• Compute the average of specified numeric fields, place the average in one record
and delete the other records with the same key (AVG)
• Determine the minimum or maximum value of specified numeric fields, place this
value in one record and delete the other records with the same key (MIN,MAX)
• Delete all but one of the records with equal keys (FIELDS=NONE)
• Retain only records with keys that occur more than once (ALLDUPS)
• Retain only the first record of those with keys that occur more than once
(FIRSTDUP)
• Retain only the last record of those with keys that occur more than once
(LASTDUP)
• Retain only the records with keys that occur only once (NODUPS)
The DUPKEYS control statement cannot be used with a SUM control statement, nor when
FIELDS=COPY is specified on the SORT or MERGE control statement.
If you need to add other DUPKEYS functionality to an application with a SUM control
statement, you must move the SUM specification to the DUPKEYS statement and remove
the SUM statement. If XSUM was used, then XDUP should be specified and the JCL
changed from using a SORTXSUM DD to a SORTXDUP DD.
function ,function ... ,FORMAT=f
FIELDS=NONE
ALLDUPS
DUPKEYS ,XDUP
FIRSTDUP [,NODUPS]
LASTDUP [,NODUPS]
NODUPS
AVG
MAX
= p 1 ,l 1 ,f 1 ,p 2 ,l 2 ,f 2 ...
MIN
SUM
Each field specified in the AVG, MAX, MIN, and SUM parameters is identified by its posi-
tion p, length l, and format f, described as follows:
p The position value indicates the first byte of the field relative to
the beginning of the input record after INREC and/or E15 pro-
cessing, if specified, have completed. The field must begin on a
byte boundary.
l The length value indicates the length of the field. The length
must be an integral number of bytes. Refer to Table 3 on page
2.21 for the permissible lengths.
f The optional format value indicates the data format. The for-
mats that can be specified are in Table 3 on page 2.21. If all the
defined fields have the same format, you can specify the format
value once by using the FORMAT=f subparameter. If you spec-
ify both the individual f values and the FORMAT subparameter,
the individual f values will be used for fields where they are
specified.
Use the AVG parameter to specify numeric fields to contain the average value calculated
from all records with the same control fields. Multiple fields separated by commas may be
specified in the same parameter. The results of the AVG parameter will be truncated for all
data formats except FL.
If overflow or underflow occurs during AVG calculations, the duplicate-keyed records will
not be deleted and none of the AVG, MAX, MIN, or SUM functions will be performed.
Adding AVG to an existing MAXSORT application could cause the generation of additional
intermediate output files (SORTOU00 or SORTOUnn). This occurs because AVG delays
DUPKEYS processing until the final MAXSORT merge pass.
Use the MAX parameter to specify numeric fields to retain the maximum value among all
records with the same control fields. Multiple fields separated by commas may be specified
in the same parameter. Equally-keyed records are processed pair by pair. For the MAX
parameter, the data in the MAX fields are compared, the record with the higher value is
retained, and the other record is deleted. The sorted data will be reduced to one record per
sort key value.
Use the MIN parameter to specify numeric fields to retain the minimum value among all
records with the same control fields. Multiple fields separated by commas may be specified
in the same parameter. Equally-keyed records are processed pair by pair. For the MIN
parameter, the data in the MIN fields are compared, the record with the lower value is
retained, and the other record is deleted. The sorted data will be reduced to one record per
sort key value.
Use the SUM parameter to specify numeric fields to contain the summed value for all
records with the same control fields. Multiple fields separated by commas may be specified
in the same parameter. Equally-keyed records are processed pair by pair. For the SUM
parameter, the values in the SUM fields are added, the sum is placed in one of the records,
and the other record is deleted. The sorted data will be reduced to one record per sort key
value if arithmetic overflow does not occur during the summing process.
If the sum of any of the specified SUM fields in any two equally-keyed records overflows the
size of the field, the duplicate-keyed record will not be deleted and none of the AVG, MAX,
MIN, or SUM functions will be performed.
The only valid value for FIELDS is NONE. Specify FIELDS=NONE only if no arithmetic
functions are desired. The sorted data will be reduced to one record per sort key value.
Use the ALLDUPS parameter to specify that only records with sort/merge fields that occur
more than once are retained.
Use the FIRSTDUP parameter to specify that only the first record of those with sort/merge
fields that occur more than once should be retained. If the NODUPS parameter is also spec-
ified, all records with sort/merge fields that occur exactly once are also retained. For a
merge, the first record will be the first record from the lowest numbered input file.
Use the LASTDUP parameter to specify that only the last record of those with sort/merge
fields occurring more than once should be retained. If the NODUPS parameter is also spec-
ified, all records with sort/merge fields occurring exactly once are also retained. For a
merge, the last record will be the last record from the highest numbered input file.
Use the NODUPS parameter to specify that only records with sort/merge fields that occur
exactly once are retained.
Specify the XDUP parameter if you want records deleted by DUPKEYS processing to be
written to a data set defined by the SORTXDUP DD statement. These records will be writ-
ten to SORTXDUP at the time of DUPKEYS processing. The records will not undergo OUT-
REC, E35, and OUTFIL processing because such processing occurs after DUPKEYS
processing.
The DCB BLKSIZE of the SORTIN data set will not be used to determine the BLKSIZE of
the SORTXDUP data set. System determined blocksize will be used when enabled and
appropriate. Unblocked output will be generated if system determined blocksize has been
disabled and an explicitly specified blocksize has not been provided in the JCL.
The XDUP file will be sequenced in the same order as the SORTOUT file.
• Adding XDUP to an existing sort application may result in an increase in the amount of
SORTWORK space required. This occurs because XDUP delays all DUPKEYS
processing until Phase 3.
• XDUP may require additional main memory. Specify a region size of 512K or more.
• AVG, MAX, MIN, and SUM fields may not overlap each other.
• Each AVG, MAX, MIN and SUM parameter may be used only once.
• If any variable-length record does not contain all of the AVG, MAX, MIN, or SUM fields,
none of the arithmetic functions will be performed for that record.
• Non-AVG, non-MAX, non-MIN, and non-SUM fields remain unchanged and are
retained from the record which contains the average, maximum, minimum, or sum
value, respectively.
• If overflow or underflow occurs during AVG or SUM calculations for records, then those
records will not have any functions performed and none of the records will be deleted.
MAX and MIN calculations are also suspended among those records. AVG, MAX, MIN,
and SUM arithmetic restarts when a subsequent set of records with equal control fields
can be averaged or summed without overflow. Further processing is determined by the
option selected at installation through the SUMOVFL parameter or the run-time
parameter OVFLO. If the RC16 option of this parameter has been selected, processing
will terminate with a WER049A critical error. For the RC0 (the delivered default) or the
RC4 option, average or sum processing will continue and a WER049I message will be
issued (only for the first occurrence). If a subsequent pair of records with equal control
fields can be averaged or summed without causing overflow or underflow, the
arithmetic functions will be performed. To avoid arithmetic overflow with SUM, use the
INREC control statement to insert zeros of the proper format immediately before the
SUM field. For example, for a PD field, use nZ to insert binary zeros.
• Remember that the first 4 bytes of variable-length records are reserved for the Record
Descriptor Word, so the first byte of the data portion of the record is byte 5.
• DUPKEYS is incompatible with an incore sort. If you specify the DUPKEYS control
statement, allocate SORTWKxx data sets in the JCL or use the DYNALLOC feature for
dynamic SORTWK allocation. If no JCL SORTWKs are provided and DYNALLOC is
disabled by default, DUPKEYS will cause DYNALLOC to be enabled.
• When AVG and SUM arithmetic is performed on FL fields, user-issued SPIE macros
are not permitted and exit routines must not produce exponent overflow or underflow.
Because of the numeric rounding performed by the hardware, the exact average or sum
depends on the order in which fields are calculated. Thus, the average or sum may vary
slightly for different executions.
• By default, the sign byte of a positive averaged or summed ZD field will be converted to
printable format. If you want to disable this action, use the NZDPRINT PARM option.
Refer to “ZDPRINT” on page 5.34.
The following DUPKEYS statement deletes records with equal control fields but places
arithmetic sum, minimum, maximum, and average values of some fields in the retained
record.
DUPKEYS SUM=(20,8,32,4,FI),MIN=(40,6),MAX=(48,6),
AVG=(56,5,PD,64,7,PD),FORMAT=ZD
When the control fields are equal, this sample statement sums the ZD field beginning in
byte 20 and the FI field beginning in byte 32; selects the minimum value of the ZD field
beginning in byte 40; selects the maximum value of the ZD field beginning in byte 48; aver-
ages the PD field beginning in byte 56 and the PD field beginning in byte 64; and then
deletes the equal-keyed record.
The END control statement has no parameters, but can contain comments if the comments
are preceded by at least one blank.
MFX supports alternative sets of collating rules based on a specified national language.
The alternative collating applies to INCLUDE/OMIT (and OUTFIL INCLUDE/OMIT) com-
parison processing as well as to SORT/MERGE processing. A locale defines single and
multi-character collating rules for a cultural environment.
Locale-based INCLUDE/OMIT processing applies only to character (CH) fields and charac-
ter or hexadecimal constants compared to character fields. When LOCALE is active, a CH
to BI (or BI to CH) comparison is not allowed. The illegal comparison will cause MFX to ter-
minate with an error message.
ALL
NONE
INCLUDE ,AND,
COND= ,&,
OMIT (c c ... ) [,FORMAT=f]
1 ,OR, 2
,|,
,EQ,
,NE,
,GT,
&MULTIINDD constant
,GE,
,LT,
,LE,
&MULTIINDD ,EQ, L(constant 1 [,constant 2 ]...)
,NE,
The COND parameter controls how records are included or omitted from an application.
There are three forms of the COND parameter:
COND=ALL All of the input records are to be included. This is the default.
The following several pages describe standard comparisons. For information on substring
comparisons, see “Substring Comparisons” on page 2.41.
Each field specified in the COND parameter is identified by its position (p), length (l) and
format (f). When processing variable-length records, by default all fields specified must be
contained within the record. If an application is expected to reference fields not completely
contained within the record, refer to “VLTESTI” on page 5.33. VLTESTI provides for pro-
cessing of records that do not contain all fields.
p The position value indicates the first byte of the field relative to the beginning
of the input record after E15 or E32 processing, if specified, has completed. The
field must begin on a byte boundary. (Keep in mind that if a variable-length file
is being referenced, the first 4 bytes must be reserved for the Record Descriptor
Word.)
l The length value indicates the length of the field. The length must be an inte-
ger number of bytes. See the table below for permissible field lengths by format.
f The format value indicates the format of the field. The permissible formats for
standard comparisons are indicated in the following table. If all data fields have
the same format, the FORMAT=f subparameter can be specified instead of the
individual f values. If both are specified, the individual f values will be used for
fields where they are specified.
Acceptable Field
Data Format
Length (Bytes)
AC 1 to 256
AQ 1 to 256
ASL 2 to 256
AST 2 to 256
BI 1 to 256
CH 1 to 256
CLO/OL 1 to 256
CSF/FS 1 to 32*
CSL/LS 2 to 256
CST/TS 2 to 256
CTO/OT 1 to 256
FI 1 to 256
PD 1 to 255
PD0 2 to 8
SFF 1 to 44
SS 1 to 32752
UFF 1 to 44
Y2B 1
Y2C/Y2Z 2
Y2D 1
Y2P 2
Y2S 2
ZD 1 to 256
For definitions of the field format, see “Valid Formats for Merge Control Fields” on page
2.63.
The constant to which a field can be compared may be one of the following types:
decimal A decimal constant can be any length. It should not be enclosed in sin-
gle quotes. It may or may not include a leading + or - sign. For example,
100 is a valid decimal constant. The following numeric data compare as
equal: +0, -0, 0. The &DATExP date parameter represents the current
date as a decimal number (+n) to which a field can be compared. See
page 2.38 for more details.
You can also include or omit records based on whether their dates fall
within a specified time frame before or after the current date. See page
2.40 for more details.
There are two methods in which the bit level characteristics of a binary input field can be
used to include or omit records. One is to compare the binary field to a bit mask; the other
is to compare the binary field to a bit pattern.
bit mask A bit mask is a string of bits, specified in terms of either hexadecimal or
binary digits. The bit mask indicates which bits in the input field are to
be tested. Each bit in the mask whose value is 1 (ON) is tested against
the corresponding bit in the input field. If the value of a mask bit is 0
(OFF), the corresponding bit in the input field is ignored.
The hexadecimal format of a bit mask is X'hh...hh,' where each 'hh' rep-
resents any pair of hexadecimal digits.
A bit mask is truncated or padded on the right to the byte length of the
binary field. The pad character is X'00' or B'00000000'.
EQ Equal to
NE Not equal to
GT Greater than
LT Less than
BO (or ALL) All mask bits are 1s (ON) in the input field
BM (SOME) Some but not all mask bits are 1s (ON) in the input field
BNO (NOTALL) Some or no mask bits are 1s (ON) in the input field
BNM (NOTSOME) All or no mask bits are 1s (ON) in the input field
BNZ (NOTNONE) All or some mask bits are 1s (ON) in the input field
Multiple comparisons are separated by ANDs or ORs to form a logical expression. (Alterna-
tively, & and may be used for AND and OR). When evaluating an expression, each compar-
ison cn is evaluated first. Then, AND conditions are evaluated before OR conditions.
Parentheses may be used around groups of comparisons to change the default evaluation
order. Any number of nested parentheses may be used. Conditions within parentheses are
evaluated first, from innermost to outermost parentheses.
For example, if you wanted to select all records from your Paris office for 1995 and 1996,
you might incorrectly specify:
INCLUDE COND=(1,4,CH,EQ,C'1995',OR,1,4,CH,EQ,C'1996',
AND,5,5,CH,EQ,C'PARIS')
The AND operator in the above statement would be evaluated first, producing unexpected
output. The correct statement would be:
INCLUDE COND=((1,4,CH,EQ,C'1995',OR,1,4,CH,EQ,C'1996'),
AND,5,5,CH,EQ,C'PARIS')
The added parentheses force the OR operator to be evaluated first, thus producing the
expected output.
Since INCLUDE/OMIT comparisons are often coded to compare one field in the record to a
long list of constants, this requires repeating the position p, length l and format f (option-
ally) of the field for each constant. For example,
INCLUDE COND=(1,2,CH,EQ,C'NY',OR,1,2,CH,EQ,C'NJ',
OR,1,2,CH,EQ,C'CT',OR,1,2,CH,...)
INCLUDE COND=(1,2,CH,EQ,L(C'NY',C'NJ',C'CT',...))
In the simplified statement above, the field data (1,2,CH) and comparison operator EQ are
stated only once; the compared constants are grouped together in parentheses preceded by
‘L’ for ‘list’; and OR is implied by use of EQ in the statement.
This simplified statement is only permitted when the comparison operator is EQ or NE. If
EQ is specified, the comparison conjunction OR is implied in the statement. If NE is speci-
fied, the comparison conjunction AND is implied in the statement. All constants that are
compatible with the p,l,f data field are permitted in the simplified constant list.
If you want to compare a field to a list of constants which reside in a file, MFX’s join facility
could be used instead of INCLUDE or OMIT.
For instance, if you needed to compare a field in a master file to a long list of airport codes,
you would normally need to create an INCLUDE or OMIT condition such as
1,3,CH,EQ,C’JFK’,OR,1,3,CH,EQ,C’LAX’,OR,1,3,CH,EQ,C’DFW’,OR,1,3,CH,EQ,C’ATL’,...
....JFK..... (record 1)
....LAX..... (record 2)
....DFW.... (record 3)
....ATL..... (record 4)
................ ...
you could easily use the join facility to read the file directly and compare a field in each
record to a field in the master file. This technique would perform the equivalent processing,
eliminating the need for a lengthy control statement.
See “Using Join Processing To Copy a Large Number of Master File Records” on page 3.24
for an example of how to do this with MFX’s join facility.
The format of a data field determines whether or not it can be compared to another data
field. The figure below illustrates which field-to-field comparisons are permitted.
When two fields are compared, the shorter field is padded to the length of the longer field.
Padding takes place as follows:
• The padding characters are blanks when the shorter field is in character format;
otherwise, they are zeros of the shorter field’s own format.
• Padding is on the right if the shorter field is in BI, CH or PD0 formats. Padding is on
the left for all other formats.
The year data formats that can be used with INCLUDE/OMIT are Y2B, Y2C, Y2D, Y2P,
Y2S and Y2Z. Year data formats can only be compared to other year formats; they cannot
be compared to formats in the table above.
The full date formats that can be used with INCLUDE/OMIT are Y2T, Y2U, Y2V, Y2W,
Y2X, and Y2Y. The full date formats may only be compared to other 2-digit year full date
formats with the same number of non-year digits.
The year data formats work with the CENTWIN run-time parameter or installation option
to define a 2-digit year value that is to be treated as a 4-digit year. CENTWIN defines a
sliding or fixed 100-year window that determines the century to which 2-digit year data
belong when processed by INCLUDE/OMIT and other control statements.
The year data formats and CENTWIN ensure that century evaluation is applied to
INCLUDE/OMIT comparison conditions involving 2-digit year data. For example, without
CENTWIN processing, an INCLUDE/OMIT comparison would treat the year 01 as "less
than" the year 98. With CENTWIN processing, the 01 field could be recognized as a twenty-
first century date (2001), which would be treated as "greater than" 98 (1998).
For details on the CENTWIN option, see “CENTWIN” on page 5.6. For details on the year
data formats, see “CENTWIN Parameter (Optional)” on page 2.237. For an example of an
INCLUDE control statement with a condition involving a year data field, see Figure 24 on
page 2.48.
For any of the 2-digit year formats, it is valid to compare them with any of the other for-
mats. Specifically, Y2B, Y2C, Y2D, Y2P, Y2S, and Y2Z fields can be compared to each other.
The following table summarizes the valid field to field comparisons for Full-Date formats:
The format of a data field determines the type of constant to which it can be compared. The
figure below illustrates which field-to-constant comparisons are permitted.
Binary Year
Format Decimal Hexadecimal Character
(bit pattern) Constant
AC X X
AQ X X
ASL X
AST X
BI X* X X X
CH X X
CLO/OL X
CSF/FS X
CSL/LS X
CST/TS X
CTO/OT X
FI X**
PD X
PD0 X
SS X X
Y2B X X
Y2C/Y2Z X X
Y2D X X
Y2P X X
Y2S X X
Y2T*** X X
Y2U*** X X
Binary Year
Format Decimal Hexadecimal Character
(bit pattern) Constant
Y2V*** X X
Y2W*** X X
Y2X*** X X
Y2Y*** X X
SFF X
UFF X
ZD X
Notes: * The decimal constant cannot be higher than 18446744073709551615 or lower than 0.
** The decimal constant cannot be higher than 9223372036854775807 or lower than
-9223372036854775808.
*** Full-Date formats
A constant will be padded or truncated to the length of the field with which it is compared.
Decimal constants are padded or truncated on the left; hexadecimal, binary, and character
constants are padded on the right. The padding characters are:
Decimal fields Zeros of proper format. Decimal constants for 2-digit year for-
mats are padded or truncated to two decimal digits represent-
ing a year. The year constant will then have CENTWIN
processing applied to it for comparison to a Y2 field. These are
only for the two digit year fields, not for full date constants.
The constants for PD0 comparison should not include the first digit and trailing sign of the
PD0 data that will be ignored. Thus, a PD0 field of n bytes will be compared to a constant of
n-1 bytes.
You can compare fields to the date of an MFX run or the date of the run with an offset in
addition to decimal fields and binary, character, and hexadecimal strings. Thus, records can
more easily be included or omitted based on whether their dates are equal to, less than, or
greater than the run date or the run date with an offset.
+
current date constant nnnn
–
where:
current date constant Specifies a form of one of the &DATEx, &DATEx(c), &DATExP,
or Y'DATEx' parameters where x is 1, 2, 3, 4 or 5 and depends
on date comparison compatibility.
For an example of an INCLUDE control statement that uses a date range based on a date
constant, see Figure 25 on page 2.48.
The forms of current date constants available for standard comparisons are:
• &DATExP represents the current date as a decimal number (+n) to which a field
can be compared.
• Y'DATEx' represents the current date with a Y constant (Y'string') to which a field
can be compared.
The following table shows the current date constants and the format produced by each. The
c character in &DATEx(c) represents a non-blank separator character, except open and
close parentheses.
&DATE5[{±}nnnn] C'yyyy-mm-dd-hh.mm.ss.nnnnnn'
Y'DATE1' Y'yymmdd'
Y'DATE2' Y'yymm'
Y'DATE3' Y'yyddd'
Constants used for full-date comparisons should have the same number of digits in the con-
stant as in the full-date field that has been specified. Leading zeros must be specified when
needed. The constant is constructed from two items; the first is a 2-digit year and the sec-
ond is a value representing the months or days that comprise the remainder of the full date
format. For example, if a 5-byte Y2W field were to be compared for a value greater than the
20th day of 1996, 96020 should be the code for the constant.
Constants can be coded to represent special values, such as those found in header or trailer
records. All zeros or nines may be used with Y2T, Y2U, Y2V, Y2W, Y2X, and Y2Y. The same
number of digits must be present as in the field that is being compared. The constant string
Y'LOW' (representing binary zeros), Y'HIGH' (representing binary ones), or Y'BLANKS'
(representing blanks) may be coded with the fields Y2T, Y2W, and Y2S. Y'DATEx' (repre-
senting the current date) may be coded with certain full-date formats specifically (see Table
9 on page 2.41).
Substring Comparisons
Substring comparison (SS format) can be based on any of the following searches:
In the first form, the length of the constant is less than the length of a specified field.
Records will be searched for the occurrence of the constant anywhere within the field. The
condition will be true if an EQ operator is specified and the constant is found or if a NE
operator was specified and the constant is not found. For example, consider the constant
“ANYTOWN” and a 60-byte field that contains an address. Records will be searched for the
occurrence of the literal “ANYTOWN” anywhere within the 60-byte address field. If a
match is found and the logical operator is EQ, then the logical result is “true.” The logical
result is also “true” if the literal does not appear within the 60 bytes and the logical opera-
tor is NE.
In the second form, the length of a constant is greater than or equal to the length of a spec-
ified field. Records will be searched for an occurrence of the field within the constant. For
example, the constant 'A02,A05,A06,A09' can be compared against the contents of a 3-byte
field within the record. This constant is composed of four 3-byte substrings in a format that
is known to match the data in the record field, separated by commas, a character known
not to be in the record field. This means that ‘A02’, ‘A05’, ‘A06’, and ‘A09’ are the only possi-
ble 3-byte strings that could possibly match the data in the record field. If the 3-byte field
matches any 3-byte character string in the constant, the logical result is “true” if the logical
operator is EQ. If the 3-byte field does not match all 3-byte character strings in the con-
stant, the logical result is “true” if the logical operator is NE.
The character used to separate elements of the constant should be a character that does not
appear in the field being compared. The comparison is then equivalent to a standard com-
parison with ORed conditions when the logical operator is EQ. That is, the condition is true
if 'A02' OR 'A05' OR 'A06' OR 'A09' is found in the field being compared. The substring com-
parison is a much more compact expression than multiple OR conditions in a standard com-
parison. When the logical operator is NE, the comparison is equivalent to a standard
comparison with ANDed conditions.
In the third form, a pattern constant is used to describe a string that is the object of the
search rather than the exact characters to be found. The pattern constant can consist of one
or more character or hexadecimal constants and wildcard characters. A wildcard can be
either a percent sign ‘%’ which matches any single character or an asterisk ‘*’ which can
match zero or more characters in a string.
In this form of searching, only an occurrence of a pattern constant within a record field can
be performed. An occurrence of a record field cannot be searched for in a pattern constant.
Typically this form of substring search is used when the beginning and ending characters
of a field contain the major values of the search. The middle characters represent a range of
values within this major category that are desired for selection.
For all forms of substring comparison, fields in the record can be from 1 to 32752 bytes in
length. Constants can be in either character or hexadecimal format and can be from 1 to
256 bytes in length. (See the description of constants just after Table 7 on page 2.37.)
See examples starting with Figure 18 on page 2.46 for some samples of how to use the sub-
string comparison.
NUM Subparameter
CSF/FS/FD/PD/ZD Specify CSF or FS format to evaluate the field for character numer-
ics. A field is character numeric if every byte contains only charac-
ters from 0 to 9. In hexadecimal format, for X'hhhh...hh', every 'hh'
represents hex values in the range F0 to F9. Otherwise, the field is
non-numeric. For example, 2468 and X'F3F2F1' are character
numeric; 24A68 and X'F3F2C1' are character non-numeric.
See Figure 22 on page 2.47 for an example of how to use the NUM subparameter.
&MULTIINDD
&MULTIINDD is used together with the MULTIIN PARM which directs MFX to read mul-
tiple input files from separate DD statements. &MULTIINDD is defined as the two-byte
C’nn’ of the SORTMInn ddname (or the two-byte C’n ’ for SORTMIn) from which a record
was read.
If the MULTIIN PARM option is not in effect, then &MULTIINDD is defined as two
blanks (C' '). If an E15 or E32 exit inserts a record, &MULTIINDD will be C’EX’ for that
record. There will be no change to the &MULTIINDD definition when an E15 exit
accepts or changes a record.
Example 1
INCLUDE COND=(24,4,PD,LT,28,4,PD,OR,10,2,CH,EQ,C'NY')
In this example, records will be included in the application if the numeric value in the field
beginning in byte 24 is less than the numeric value in the field beginning in byte 28 or if
the character value in the field beginning in byte 10 is equal to NY.
Example 2
OMIT COND=(1,3,ZD,EQ,100,AND,20,1,CH,NE,X'40')
In this example, records will be omitted from the application if the numeric value in the
field beginning in byte 1 is equal to 100 and if the character value in byte 20 is not equal to
a blank (X'40').
The next set of control statements exemplifies record selection using bit level logic. The
first two examples involve a comparison between a bit mask (shown coded in binary and
hexadecimal format) and a binary input field. The third example is a comparison between a
bit pattern and a binary field.
Example 3
INCLUDE COND=(10,1,BI,ALL,B'01001000')
or INCLUDE COND=(10,1,BI,ALL,X'48')
The record selection condition has the following elements (from left to right): a binary field
(BI) of length 1 byte that starts at column 10 of the record, a comparison operator (ALL),
and a bit mask (B'01001000' in binary, X'48' in hexadecimal). Counting from the left, the
second and fifth bits of the bit mask are ON (1). For the selection condition to be true, the
same bits must be ON in the binary input field. Therefore, if the input field contains, for
example, 01001000, 01111000 or 11111111, the condition for the inclusion of records is sat-
isfied. However, if the input field contains a bit string where both mask bits are not ON
(e.g., 01000000, in which the fifth bit is not ON), the condition fails and the records are
omitted.
Example 4
INCLUDE COND=(10,1,BI,NOTNONE,B'01001000')
or INCLUDE COND=(10,1,BI,NOTNONE,X'48')
The condition for the inclusion of records is met if at least one of the mask bits is ON in the
input field. Therefore, the condition would evaluate as true, if the bit string in the binary
field were 01000000 (the second bit is ON), 000010000 (the fifth bit is ON), 01001000 (both
the second and fifth bit are ON). However, with the string 10000111, for instance, in the
input field, the specified condition would evaluate as false (resulting in the omission of
records), since neither mask bit is ON.
The above method of comparing a binary input field to a bit mask is useful for testing the
contents of a "flag" byte where each bit has a different meaning.
Example 5
INCLUDE COND=(21,4,BI,EQ,B'000000010001........100100011111')
The condition specifies a 4-byte long binary input field (BI) in column 21, a logical relation-
ship (EQ), and a bit pattern. The bit pattern describes the required sequence of 1s and 0s in
the first and last twelve bit positions. The row of periods in the pattern represents the part
of the string that is irrelevant to the definition of the condition. The condition is true, if the
sequence of 1s and 0s in the input field is identical to that described in the bit pattern.
The method of comparing a binary input field to a bit pattern is useful when testing for
numeric digits that are one half byte each, as in the packed data format. For example,
assume that the binary input field specified in the condition above is a date field in the PD
format X'0mmddyyF'. Each date element is split across a byte boundary. The second half-
byte of each byte (except the last) represents the first of the two digits that form a date ele-
ment (mm,dd,yy). (In the last byte, the second half-byte--1111 in binary and F in hexadeci-
mal--stands for the fact that the bit pattern encodes a packed decimal.) The first half-byte
of each byte (except the first) represents the second digit of a date element (mm,dd,yy).
(The first half-byte, i.e. 0000, of the bit pattern gives it the length specified for the binary
field at column 21.) Mapping this scheme onto the bit pattern in the control statement
results in the following.
That is, the above control statement is an instruction to select just those records in whose
date field mm and yy equal 11 and 91, respectively, while dd can have any value. In other
words, the records thus selected are those from November 1991.
Example 6
INCLUDE COND=(11,60,EQ,C'ANYTOWN',
OR,121,3,EQ,C'A01,A05,A06,A09'),FORMAT=SS
In this example, a record will be included in the application if either of the following condi-
tions is true:
• The literal 'ANYTOWN' is found in the 60-byte field starting at position 11 in the
record.
• The contents of the 3-byte field starting at position 121 matches one of the four
substrings ('A01', 'A05', 'A06', or 'A09') in the constant. Because it is known that the 3-
byte field does not contain any commas, there cannot be a match to the constants ‘01,’
‘1,A’, ‘05,’ etc.
Example 7
The following sample control statements illustrate substring comparisons with various
forms of pattern (wildcard) constants.
INCLUDE COND=(20,12,SS,EQ,(C’ST’,*,C’KU’))
Figure 19. Sample INCLUDE Control Statement Using Substring with Wildcard (*)
In this example, a 12-byte field starting in position 20 will be searched for strings that
begin with ST and end with KU anywhere in the field, regardless of the characters in
between. Hence, records with ST43624KU in positions 22 through 30 and ST12KU in col-
umns 24 to 29 would be included, as well as records with STKU in the field.
The record selection would be different if the INCLUDE statement were modified to the fol-
lowing:
INCLUDE COND=(20,12,SS,EQ,(C’ST’,%%,C’KU’))
Figure 20. Sample INCLUDE Control Statement Using Substring with Wildcard (%)
In this case, only the record with ST12KU would be included since only two characters
would be allowed between the ST and the KU character constants.
The record selection would also be different if the INCLUDE statement were modified to
the following:
INCLUDE COND=(20,12,SS,EQ,(C’ST’,*%%%,C’KU’))
Figure 21. Sample INCLUDE Control Statement Using Substring with Wildcard (*%)
In this case, only the record with ST43624KU would be included, since three or more char-
acters are required between the ST and KU character strings.
Example 8
OMIT COND=(24,3,ZD,EQ,NUM,AND,31,5,ZD,NE,NUM)
OMIT COND=(24,3,EQ,NUM,AND,31,5,NE,NUM),FORMAT=ZD
In this example, both statements are equivalent; the latter statement specifies the ZD for-
mat using the FORMAT=f subparameter. Records will be omitted from the application if
the first field (byte 24 to byte 26) is identified as zoned decimal numeric AND the second
field (byte 31 to byte 35) is identified as zoned decimal non-numeric.
Example 9
In the following example, two files are similar enough to allow them to be sorted together
using the MULTIIN PARM, but certain fields are in different locations in the record.
This statement will include only New York records despite differences in formatting of the
input files defined by SORTMI01 and SORTMI02.
Example 10
INCLUDE COND=(20,2,Y2C,GT,96)
In this example only records whose data are from the years greater than 1996 will be
included in the application. If the CENTWIN parameter were set to 1980, representing a
century window of 1980 to 2079, the records would be processed in the following manner:
Contents of Record
Positions 20 and 21 Disposition
84 Omitted - represents 1984
99 Included - represents 1999
37 Included - represents 2037
Example 11
The following INCLUDE control statement illustrates the use of the current date constant
and the current date with an offset to include records with dates starting with the current
date and spanning through the two week period prior to the current date.
INCLUDE COND=(5,8,ZD,LE,&DATE1P,AND,5,8,ZD,GT,&DATE1P-14)
Figure 25. Sample INCLUDE Control Statement Using Current Date Constant and Cur-
rent Date With an Offset Comparison
If the application were run on April 25, 2002, the records included would have dates in the
8-byte field starting at position 5 from April 12, 2002 through and including April 25, 2002.
Using the INREC control statement to delete data fields improves sort performance by
reducing the number of bytes MFX must process. The same result may be achieved in some
cases by changing the data format of certain fields. For example, if you need to change the
format of a ZD field to PD, which reduces the number of bytes for the field, it is more effi-
cient to use INREC rather than OUTREC for the conversion. Additionally, for
SORT/MERGE processing PD fields are processed more efficiently than ZD fields.
Except for CONVERT, all the functions performed by the OUTREC control statement, such
as inserting character strings or changing the data format of a numeric field, can also be
performed by the INREC control statement. (See “OUTREC Control Statement” on page
2.132 for an explanation of these functions.) For example, you can use the INREC control
statement to insert zeros of the proper format to expand a numeric field before SUM or
DUPKEYS processing to prevent arithmetic overflow. However, you will usually want to
use the OUTREC control statement rather than the INREC control statement to expand
the record because OUTREC processing takes place after records are sorted or merged.
There is one function available with INREC that is not available with the OUTREC
control statement or the OUTREC parameter of the OUTFIL control statement: the
&MULTIINDD subparameter.
If you use the INREC control statement to reformat the input record, remember to use the
post-INREC field positions when you specify the SORT, MERGE, SUM, DUPKEYS,
OUTREC, and/or OUTFIL control statements.
If the SEQNUM function is used in a SORT application to insert a sequence number field
in the record, this field will reflect the order of the records prior to sorting. In a MERGE
application, the field will reflect the order of the records as they were read from each input
in the merge.
FIELDS
PARSE=(subparm), BUILD =(fields)
INREC OVERLAY
IFTHEN=(subparm) [,IFTHEN=(subparm), ... ,IFOUTLEN=n
FINDREP=(subparm)
See “OUTREC Control Statement” on page 2.132 for a complete description of all of the
INREC statement parameters, except for &MULTIINDD.
The &MULTIINDD subparameter of the INREC FIELDS parameter is used together with
the MULTIIN PARM, which directs MFX to read multiple input files from separate DD
statements. &MULTIINDD is defined as the two-byte C’nn’ of the SORTMInn ddname (or
the two-byte C’n ’ for SORTMIn) from which a record was read.
&MULTIINDD inserts the two-byte character string identifying the input record’s origin
into the record produced by the INREC statement.
If the MULTIIN PARM option is not in effect, then &MULTIINDD is defined as two
blanks (C’ ‘). If an E15 or E32 exit inserts a record, &MULTIINDD will be C’EX’ for that
record. There will be no change to the &MULTIINDD definition when an E15 exit
accepts or changes a record.
&MULTIINDD can only be specified on the INREC statement, including within the
IFTHEN WHEN subparameter on INREC, and not on the OUTREC control statement or
the OUTREC parameter of the OUTFIL control statement.
INREC FIELDS=(1:1,20,21:40,15,ZD,PD,29:60,5)
This INREC control statement specifies three data fields from an 80-byte record:
• The first field begins in byte 1 of the input record and is 20 bytes long.
• The second field begins in byte 40 of the input record and is a 15-byte ZD field. The data
format is to be converted to PD. Since the input field contains 15 decimal digits, the
converted PD output field created by MFX will be 8 bytes long.
• The third field begins in byte 60 of the input record and is 5 bytes long.
These three fields have been positioned to begin in bytes 1, 21, and 29, as indicated by their
column prefixes.
This INREC control statement can be used when multiple input files are for different time
periods, but do not contain time-distinguishing data.
In this example, a report will be formatted with the year as the primary key when each of
three input files is for a different year.
For comprehensive examples that illustrate the INREC control statement see “Chapter 3.
How to Use MFX’s Data Utility Features”.
When you do not provide a JOIN control statement in an application that has JOINKEYS
control statements, MFX produces an output from the join operation that includes all
paired records (an “inner join”). All unpaired records from both SORTJNF1 and
SORTJNF2 are discarded. By providing a JOIN control statement, you can specify that
unpaired records are to be included in the join output (an “outer join”). Parameters of the
JOIN statement provide options as to which of the unpaired records are to be retained for
output.
See the descriptions of the JOINKEYS and REFORMAT control statements for additional
information.
JOIN UNPAIRED
[,F1]
[,F2]
[,ONLY]
When joining files, a record from one file may or may not have a match in the other file. A
match occurs when the contents of the join keys in the record from the first file equal the
contents of the join keys in the record from the second file.
By specifying the JOIN statement you can discard unpaired records from one or both files,
or retain unpaired records from both files.
To retain unpaired records from SORTJNF1 (a “left outer join”) in addition to all joined
records, specify:
JOIN UNPAIRED,F1
Figure 30. Sample JOIN Statement to Retain Unpaired Records from SORTJNF1
To retain unpaired records from SORTJNF2 (a “right outer join”) in addition to all joined
records, specify:
JOIN UNPAIRED,F2
Figure 31. Sample JOIN Statement to Retain Unpaired Records from SORTJNF2
To retain unpaired records from both SORTJNF1 and SORTJNF2 (a “full outer join”) in
addition to all joined records, specify either:
JOIN UNPAIRED,F1,F2
Figure 32. Sample JOIN Statement to Retain Unpaired Records from SORTJNF1/2
or simply:
JOIN UNPAIRED
Figure 33. Sample JOIN Statement to Retain Unpaired Records from SORTJNF1/2
You have the option of discarding the paired records from a join and keeping only the
unpaired ones. To do this, specify:
JOIN UNPAIRED,ONLY
If you want to keep only the unpaired records from one SORTJNF1 or SORTJNF2, add
either the F1 or the F2 parameter.
Note: See the description of the REFORMAT statement for a discussion on what will
appear in the record created by join processing when source fields from either SORTJNF1
or SORTJNF2 are not available due to a join unpaired operation.
For more information, see “Joining Records from Multiple Files” on page 3.15.
The join feature joins records from two input files that are specified on the SORTJNF1 and
SORTJNF2 DD statements. By default, when the JOINKEYS fields from m records in
SORTJNF1 match the JOINKEYS fields from n records in SORTJNF2, all combinations of
the records are joined using the REFORMAT statement, producing m*n records as input to
subsequent MFX processing. (This is called an “inner join.”)
See the discussion of the REFORMAT control statement for a description of how a record is
constructed from the two records that have been selected as a match.
If the optional JOIN UNPAIRED statement is specified, the unmatched records from the
SORTJNF1 and/or SORTJNF2 files will also be REFORMATted and included in the input
to MFX without being joined. (Including the unmatched records from SORTJNF1 is called
a “left outer join,” including the unmatched records from SORTJNF2 is called a “right outer
join,” and including all unmatched records is called a “full outer join.”) Optionally, only
these unmatched records will become input to MFX. See the descriptions of the JOIN and
REFORMAT statements for further details on their specification.
The input files do not need to be presorted or have the same record type.
Two JOINKEYS control statements are required – one for each of the two files used in the
join.
The JOINKEYS control statement cannot be used with MAXSORT, PARASORT, MFX
PipeSort, SKIPREC, checkpoint, and merge exits (except for E35), and the DB2 Query
feature.
FILE= F1
F2 ,FIELDS =(p ,l ,f ,o [,p ,l ,f ,o ]...)[,FORMAT=f]
JOINKEYS 1 1 1 1 2 2 2 2
F1=ddname
F2=ddname
[,SORTED][,NOSEQCK]
ALL
NONE
,INCLUDE ,AND,
,OMIT = ,&,
(c c 2 ... )
1
,OR,
,|,
,TASKID=xx
F
,TYPE=
V
,STOPAFT=n
The FILE parameter connects the JOINKEYS control statement with the input file to be
read. The specification of F1 connects the JOINKEYS control statement with the
SORTJNF1 DD statement. The specification of F2 connects the JOINKEYS control
statement with the SORTJNF2 DD statement. FILE cannot be used if either F1 or F2 is
used.
For large applications, if one of the two input files has many more duplicate keys for the
join than the other input file, that file should be allocated as SORTJNF2 to achieve optimal
performance.
F1
FILE=
F2
The F1=ddname and F2=ddname parameters are used to specify the ddnames of the input
files to be read for the JOINKEYS control statement. F1 is used in place of FILE=F1 to con-
nect JOINKEYS to the first input file and change the ddname from SORTJNF1. F2 is used
similarly to connect JOINKEYS to te second input file and change the ddname from
SORTJNF2. You should use only one of F1 or F2. The FILE parameter cannot be used if
either F1 or F2 has been used.
F1=ddname
F2=ddname
The FIELDS parameter is required. It describes the fields to be used to match records from
the two files, SORTJNF1 and SORTJNF2.
The number of JOINKEYS fields and their sorted order (A or D) must be the same for both
files, although their starting positions and lengths need not be the same.
The join files do not need to be presorted on the fields specified on the JOINKEYS
statement. By default, MFX will sort the records to the proper sequence before performing
the join operation. If one or both of the files are already in the JOINKEYS fields sequence,
the SORTED parameter (see below) of the JOINKEYS statement can be specified. If the
SORTED parameter can be used, the performance of the application will be improved since
the need for MFX to preorder the records prior to join processing will be removed.
Each JOINKEYS field may be anywhere within the record through column 32750, the
maximum length of a field is 4080 bytes, and the sum of all fields on a JOINKEYS
statement cannot exceed 4080 bytes.
Each field specified in the FIELDS parameter is identified by a position (p), length (l),
format (f), and order (o).
p The position value indicates the first byte of the field relative to the beginning
of the input record.
f The format value indicates the data format. For a list of valid formats, refer to
the table in the next section, “Valid Formats for JOINKEYS Fields.” If all the
fields have the same format, you can specify the format value once by using the
FORMAT=f subparameter. If you specify both the individual f values and the
FORMAT subparameter, the individual f values will be used for fields where
they are specified.
A=Ascending order
D=Descending order
Table 10 on page 2.58 lists the valid formats for JOINKEYS fields.
Acceptable Field
Data Format
Length (Bytes)
AQ 1 to 4080
BI* 1 to 4080
CH 1 to 4080
FI 1 to 256
PD 1 to 255
ZD 1 to 256
Field-to-Field Comparisons
The formats of the JOINKEYS fields for the SORTJNF1 file must be compatible with the
corresponding fields for the SORTJNF2 file.
AQ BI CH FI PD ZD
AQ X
BI X X
CH X X
FI X
PD X X
ZD X X
When two fields of unequal lengths are compared, the shorter field is padded to the length
of the longer field. Padding takes place as follows:
• The padding characters are blanks when the shorter field is in CH or AQ format;
otherwise, they are zeros of the shorter field’s own format. For negative FI fields, the
padding character is X‘FF’.
• Padding is on the right if the shorter field is in BI, CH or AQ format. Padding is on the
left for FI, PD and ZD formats.
By default, MFX will presume that the records in the file are not presequenced per the
JOINKEYS fields specified. If the records are already collated in the proper sequence, the
SORTED parameter can be specified to improve the application's performance. Since
LOCALE is not used for CH JOINKEYS fields, do not specify SORTED if the files were
previously sorted with LOCALE.
MFX will sequence check each input file according to its JOINKEYS fields. If the SORTED
parameter of the JOINKEYS statement was specified to indicate that the file was presorted
and the sequence check fails, MFX will issue a critical error message containing the file
number. The record number within the file will also be in the error message text whenever
the INCLUDE/OMIT parameter of the JOINKEYS statement was not specified.
The NOSEQCK parameter may be used when the SORTED parameter has been specified.
NOSEQCK instructs MFX to bypass the sequence check that MFX performs for the sorted
input file. NOSEQCK should only be used when you are certain that the input file con-
nected to the JOINKEYS statement has already been sorted in the same collating sequence
as specified in the JOINKEYS FIELDS parameter, otherwise your output may be incorrect.
NOSEQCK may slightly improve the performance of your JOINKEYS application. NOSE-
QCK is ignored if SORTED has not been specified.
Specify the INCLUDE or OMIT parameter to indicate which records are to be included or
omitted from the SORTJNFn file specified on the JOINKEYS statement. The
INCLUDE/OMIT processing occurs prior to the JOINKEYS field matching process.
ALL
NONE
INCLUDE ,AND,
= ,&,
OMIT (c
1 c 2 ... )
,OR,
,|,
See “INCLUDE/OMIT Control Statement” on page 2.27 for the detailed format of a compar-
ison. The FORMAT=f parameter, which is permitted for the INCLUDE/OMIT control state-
ment, is not permitted for the INCLUDE/OMIT parameter. Field formats must be specified
on a field-by-field basis.
The TASKID=xx parameter is used to change the first two bytes of the ddnames for the
dynamically allocated sortwork data sets used to sort the JOINKEYS input file. This
parameter should be used when invoking MFX from a program and attaching multiple join
applications that will run concurrently.
The TYPE parameter can be used to indicate the record format. TYPE=F indicates fixed-
length records; TYPE=V indicates variable-length records.
TYPE should be provided if the input file being specified is VSAM. If TYPE is not provided,
TYPE=F will be assumed if the SORTJNFn file is VSAM.
Note: If the TYPE specification differs from the RECFM DCB parameter for the
SORTJNFn DD statement, the latter takes precedence.
For more information, see “Joining Records from Multiple Files” on page 3.15.
The STOPAFT parameter limits the number of records processed from the SORTJNFn file
specified. This can be useful when testing a new join application. You can sample a subset
of one or both input files and view your output without having to sort both input files in
their entirety and possibly generate a very large number of joined records.
The variable n specifies the number of records to be sorted or copied from SORTJNF1 or
SORTJNF2. These will be the first n records after JOINKEYS INCLUDE/OMIT process-
ing, if specified, has completed.
Cultural environment support allows you to choose an alternative set of collating rules
based on a specified national language. The alternative collating applies to SORT/MERGE
and INCLUDE/OMIT processing.
0
,CKPT ,EQUALS
,CENTWIN= s
f ,CHKPT ,NOEQUALS ,FILES=n
,SKIPREC=n ,STOPAFT=n
The FIELDS parameter is required for a merge. It describes the control fields.
List the control fields in order of greatest to least priority, with the primary control field
listed first, followed by progressively less significant fields. You can specify up to 128 con-
trol fields; however, if fields require complex internal processing, the limit for a particular
execution may be less than 128.
Each field specified in the FIELDS parameter is identified by its position p, length l, format
f and order o.
p The position value indicates the first byte of the field relative to the beginning
of the input record after INREC and/or E32 processing, if specified, have com-
pleted.
Binary control fields can begin on any bit of a byte. When a binary field does not
begin on a byte boundary, you must specify the bit number (0-7). For example, a
position value of 21.3 refers to the 4th bit of the 21st byte of the record.
l The length value indicates the length of the control field. The length value must
be an integer number of bytes, except for the length of a binary control field
which can be specified in bits. For example, a length value of 0.5 refers to a
binary control field 5 bits long.
For signed fields, the length value must include the area occupied by the sign.
f The format value indicates the data format. For a list of valid formats, refer to
Table 12 on page 2.63. If all the control fields have the same format, you can
specify the format value once by using the FORMAT=f subparameter. If you
specify both the individual f values and the FORMAT subparameter, the indi-
vidual f values will be used for fields where they are specified.
A=Ascending order
D=Descending order
E=As modified by an E61 exit
The following table lists the valid formats for merge control fields.
Field Length
Code Data Format
(bytes)
ASL Leading separate sign. An ASCII + or - precedes numeric field. One 2 to 256
digit per byte.
AST Trailing separate sign. An ASCII + or - trails numeric field. One digit 2 to 256
per byte.
Field Length
Code Data Format
(bytes)
CLO Leading overpunch sign. Hexadecimal F,C,E, or A in the first 4 bits of 1 to 256
OL your field indicates a positive number. Hexadecimal D or B in the first 4
bits indicates a negative number. One digit per byte. CMP=CLC is
forced.
CSF Floating sign format. An optional leading sign may be specified immedi- 1 to 32
FS ately to the left of the digits. If the sign is a -, the number is treated as
negative. For other characters, the number is treated as positive. Char-
acters to the left of the sign are ignored.
CSL Leading separate sign. An EBCDIC + or - precedes numeric field. One 2 to 256
LS digit per byte. CMP=CLC is forced.
CST Trailing separate sign. An EBCDIC + or - follows numeric field. One 2 to 256
TS digit per byte. CMP=CLC is forced.
PD0 Packed decimal. 2-8-byte packed decimal data with the first digit and 2-8
trailing sign ignored. The remaining bytes are treated as packed deci-
mal digits. Typically PD0 is used with century window processing and
Y2P format; Y2P processes the year, while PD0 processes month and
day.
SFF Signed free format. Decimal digits (0-9) are extracted from right to left 1 to 44
to form a number value. A character of – or ) found within the field will
cause the value to be treated as a negative number. All other non-
decimal digit values in the field are ignored. A maximum of 31 digits
can be provided. When more than 31 digits are found in the field, the
leftmost digits will be ignored.
Field Length
Code Data Format
(bytes)
UFF Unsigned free format. Decimal digits (0-9) are extracted from right to 1 to 44
left to form a positive number value. All non-decimal digit values in the
field are ignored. A maximum of 31 digits can be provided. When more
than 31 digits are found in the field, the leftmost digits will be ignored.
Y2B Binary. 2-digit, 1-byte binary year data treated as a 4-digit year by 1
CENTWIN (century window) processing.
Y2D Packed decimal. 2-digit, 1-byte packed decimal year data treated as a 4- 1
digit year by CENTWIN (century window) processing.
Y2P Packed decimal. 2-digit, 2-byte packed decimal year data. Of the four 2
packed digits contained in the 2 bytes, the first digit and trailing sign
are ignored; the two inner digits are treated as a 4-digit year by
CENTWIN processing.
Y2S Character or zoned decimal. 2-digit, 2-byte valid numeric data treated 2
as a 4-digit year by CENTWIN (century window) processing, as for Y2C
and Y2Z. However, certain data are not treated as year data. Data with
binary zeros (X'00') or a blank (X'40') in the first byte will be collated
before valid numeric year data for ascending order (after year data for
descending order). Data with all binary ones (X'FF') in the first byte will
be collated after valid numeric year data for ascending order (before
year data for descending order). Zones are ignored, as for Y2C and Y2Z,
except for data where the first byte begins with X'00', X'40' or X'FF'.
Y2T Full-date, character, binary, or packed decimal formats. Full-date data 2-6
formats can be used to merge a variety of date fields. They can process
Y2U dates ending or starting with year digits (x...xyy or yyx...x). They can
also process non-date data commonly used with dates. For details, see
Y2V
page 2.72.
Y2W
Y2X
Y2Y
Field Length
Code Data Format
(bytes)
Y2Z Zoned decimal. 2-digit, 2-byte zoned decimal year data treated as a 2
4-digit year by CENTWIN (century window) processing. The zones are
ignored. Processing is identical to Y2C fields.
ZD Zoned decimal. Trailing overpunch in the first 4 bits of the rightmost 1 to 256
CTO byte gives the sign. Hexadecimal F,C,E, or A indicates a positive num-
OT ber. Hexadecimal D or B indicates a negative number. One digit per
byte. CTO forces CMP=CLC.
For information on the year data formats (Y2B, Y2C, Y2D, Y2P, Y2S and Y2Z) plus the
related data format PD0, see “CENTWIN Parameter (Optional)” on page 2.67 and “Con-
verting Year Data with Century Window Processing on INREC, OUTREC, or OUTFIL
OUTREC” on page 2.160. Also, see “Specifying Field-to-Field Standard Comparisons for
Year Fields” on page 2.35.
• For fixed-length records, the sum of the lengths of all control fields cannot exceed 32752
bytes. When EQUALS is in effect, the sum of their lengths cannot exceed 4088 bytes.
• For variable-length records, all control fields must be located within the first 32750
bytes and the sum of their lengths cannot exceed 4084 bytes. When EQUALS is in
effect, all control fields must be located within the first 32746 bytes and the sum of
their lengths cannot exceed 4080 bytes.
• Remember that for variable-length records, the first 4 bytes are reserved for the Record
Descriptor Word, so the first byte of the data portion of the record is byte 5.
• If the output file is a key-sequenced VSAM cluster, the VSAM key must be the first
control field specified.
The CMP PARM determines how PD and ZD control fields will be compared. When
CMP=CPD is in effect, the Compare Decimal (CP) instruction may be used under certain
circumstances for the compare. ZD fields are packed and then compared. This method has
performance advantages. However, invalid PD data may cause a system 0C7 abend and
program termination. Moreover, the integrity of ZD fields is only guaranteed when they
contain valid ZD data. The CMP=CPD method will not be used for control fields that exceed
16 bytes or for variable-length merges when an even value (0, 2, 4, or 6) is specified for the
VLTEST PARM.
When CMP=CLC is in effect, no data validation is performed and the integrity of the out-
put is maintained, even if the sign for a PD or ZD field is invalid. This method will be used
if any control field exceeds 16 bytes or for variable-length merges when an even value is
specified for the VLTEST PARM.
Use FIELDS=COPY to copy one or more input files. (Multiple files can be copied if they are
concatenated on the SORTIN DD specification.) Other control statements such as
INCLUDE/OMIT, INREC, OUTREC, and OUTFIL may be specified in conjunction with a
copy application, allowing you to edit and reformat the file(s) without any collation process-
ing.
The SUM or DUPKEYS control statement and an E32 exit should not be specified with
FIELDS=COPY. All Phase 3 exits can be used.
The SORTIN DD statement defines the input to be copied. (SORTINnn DD statements are
not processed when FIELDS=COPY is specified.)
The CENTWIN run-time or installation option acts on 2-digit year data. At run-time,
CENTWIN can be specified as either a PARM option or a SORT/MERGE control statement
parameter. CENTWIN generates a century window (for example, 1950 through 2049) that
determines the century to which a 2-digit year belongs. CENTWIN ensures that year data
spanning centuries will be sequenced correctly. Without CENTWIN processing, an
ascending collation would sequence the year 01 before the year 98. With CENTWIN
processing, the 01 field could be recognized as a twenty-first century date (2001) and would
thus be sequenced after 98 (1998).
For more information on specifying the CENTWIN option, see “CENTWIN” on page 5.6.
CENTWIN processing only applies to data defined as year data formats (Y2B, Y2C, Y2D,
Y2P, Y2S, and Y2Z) and the full-date formats (Y2T, Y2U, Y2V, Y2W, Y2X, and Y2Y). These
data formats enable MFX to process 2-digit year fields as 4-digit years. A related data for-
mat, PD0, can be used to process the month and day portions of packed decimal date fields.
To correctly specify date fields for CENTWIN MERGE processing, you should be familiar
with the CENTWIN-related data formats.
The following describes each of the year data formats and provides MERGE control state-
ment examples:
This format is used to sequence 2-digit, 1-byte binary year data with CENTWIN process-
ing. The binary values are converted to decimal, and the two low order digits are used as
year data. Thus, while binary and decimal values range from 00 to 255, year values range
from 00 to 99. The relationship between binary, decimal and year values is shown in the fol-
lowing table:
These formats represent 2-digit, 2-byte year data in either character (Y2C) or zoned deci-
mal (Y2Z) format. Either Y2C and Y2Z formats can be used with data of the form
X'xyxy'
where y is a hexadecimal year digit 0-9 and x is hexadecimal 0 through F. Y2C and Y2Z
ignore the x digits, leaving yy, the 2-digit unsigned year representation.
Suppose you have a character or zoned decimal date field mmddyy that begins at byte 20.
You can use either Y2C or Y2Z to process the yy field. As the following example indicates,
you could specify three merge keys to correctly process this date:
The yy field (24,2) will be processed according to the century window setting. For example,
if CENTWIN=1945, the field yy=45 will be sequenced as if it were 1945, and yy=44 would
be sequenced as if it were 2044. Thus, for an ascending sequence, 44 would follow 45.
This format is used to sequence 2-digit, 1-byte packed decimal year data with CENTWIN
processing. Use Y2D to extract the year data yy from packed decimal date fields. For exam-
ple, consider a 3-byte packed decimal data field defined as
X'yyddds'
This field has the year yy in the first byte and the day ddd in bytes 2 and 3. The packed dec-
imal sign s would be in the last digit (half byte) of the third byte. To merge this date field,
which begins at byte 20, with 4-digit year processing, use the following MERGE control
statement:
This format is used to sequence 2-digit, 2-byte packed decimal year data with CENTWIN
processing. Use Y2P to extract the year data yy from packed decimal date fields spanning 2
bytes. For example, a packed decimal date of the form yymmdd would be stored as 4 bytes:
yymmdd = X'0yymmddC'
where the trailing C (sometimes F) is a positive sign and the leading 0 pads the field on the
left to make an even number of digits.
0y ym md dC
Y2P handles this condition by ignoring the first and last half bytes of the 2-byte field speci-
fication. Thus, Y2P processes 0yym as yy, ignoring the leading digit (0) and the trailing digit
m that is part of the month.
The following example uses Y2P to collate the year portion of the date field, which begins at
byte 20:
The field specification 20,2,Y2P treats X'0yym' as X'yy', and CENTWIN processing merges
yy as a 4-digit year yyyy.
The PD0 format, described below, can assist Y2P by processing month and day data that
overlap year data in the original field.
This format is used to sequence 2-digit, 2-byte character or zoned decimal data. The Y2S
format is identical to Y2C and Y2Z for valid numeric data, but Y2S treats data that begin
with X'00', X'40' or X'FF' as non-year data. Thus, the Y2S format can distinguish records
that have non-year data in the first byte of the year field, allowing such records to be col-
lated differently from other records.
• Data with binary zeros (X'00') or a blank (X'40') in the first byte will not have century
window processing applied to it. Instead, such data will be collated in sequence, before
valid numeric year data for ascending order or after the year data for descending order.
• Data with all binary ones (X'FF') in the first byte will also not have century window
processing applied to it. Instead, such data will be collated after valid year numeric
data for ascending order or before the year data for descending order.
Zones are ignored, as for Y2C and Y2Z, except for data where the first byte begins with
X'00', X'40' or X'FF'.
As an example, suppose you want to preserve the input order of header and trailer records
at the start or end of the file, and your header/trailer records are identified by binary zeros
(X'00'), a blank (X'40') or binary ones (X'FF') in the first byte of the date field. The Y2S for-
mat allows CENTWIN to identify the header/trailer records and treat them differently
from other records.
This format is used to sequence 2-8 byte packed decimal data. PD0 ignores the first digit
and trailing sign during processing. PD0 is normally used in conjunction with the Y2P data
format. The Y2P format is used to process the 2-digit year portion of a packed decimal date
field, while the PD0 format is used to process the month and day portion of the field.
Although PD0 is typically used with Y2P, CENTWIN processing is not applied to PD0.
Consider the packed decimal date field used in the Y2P example above:
yymmdd = X'0yymmddC'
where the trailing C (sometimes F) is a positive sign and the leading 0 pads the field on the
left to make an even number of digits.
0y ym md dC
The following MERGE control statement can be used to collate the entire date with
CENTWIN processing:
Full-Date Formats
Full-date formats can be used to merge various date fields, processing dates ending or
starting with year digits. They also process non-date data that are used with dates. For a
full description of full-date formats, see the following section.
MFX’s full-date data formats enable you to merge a variety of date fields. The full-date for-
mats are Y2T, Y2U, Y2V, Y2W, Y2X, and Y2Y. These date formats can process dates ending
or starting with year digits:
The full-date formats also process non-date data commonly used with the dates. MFX inter-
prets two-digit years (yy) according to the century window specified by the CENTWIN
option. CENTWIN processing does not apply to non-date data.
In most cases, for CH, ZD, and PD date fields the full-date data formats are easier to use
than the 2-digit date formats. The 2-digit formats can be more difficult because you must
divide the date into its components. This requires care, particularly for PD dates, where
date components (q, dd, mm, or yy) may span bytes or occupy only part of a byte. The full-
date formats, on the other hand, process such dates automatically.
Table 14 on page 2.72 describes the full-date formats. For date forms not in the table, use
the 2-digit year formats or the non-year formats.
yyxx yymm 4
yyxxx yyddd 5
yyxxxx yymmdd 6
yyxxx yyddd 3
(X'yyxxxs')
yyxxxx yymmdd 4
(X'0yyxxxxs')
xxyy mmyy 4
xxxyy dddyy 5
xxxxyy mmddyy 6
xxxyy dddyy 3
(X'xxxyys')
xxxxyy mmddyy 4
(X'0xxxxyys')
Table 14 on page 2.72 indicates the full-date formats that can be used with character (CH),
binary (BI), or packed decimal (PD) data. Note the recognized non-date values:
The following two examples illustrate how you might use Table 14 (“Full-Date Formats”) on
page 2.72:
• Suppose you have a packed decimal (PD) date field of the form mmyy. To merge this
field correctly, you would use the Y2Y 3-byte format from the table. Thus, if the field
starts in position 30 and the records are in descending order, you would specify the
following MERGE control statement:
MERGE FIELDS=(30,3,Y2Y,D)
Any PD fields of all PD zeros or all PD nines will be processed automatically as non-
date data.
• Suppose you have a character (CH) date field of the form yymmdd. To merge this field
correctly, you would use the Y2T 6-byte format from the table. Thus, if the field starts
in byte 40 and the records are in ascending order, you would specify the following
MERGE control statement:
MERGE FIELDS=(40,6,Y2T,A)
Any CH zeros, CH nines, BI zeros, blanks, and BI ones will be processed automatically
as non-date data.
For full-date formats, the yy component is always processed first (treated as primary key).
This is so even when the yy is physically at the rightmost end of the field, as for Y2W, Y2X,
and Y2Y. For example, a 6-byte Y2W field has the form xxxxyy. This is collated with the yy
as the primary key and xxxx as the secondary key. Because MFX automatically collates the
year character first, you don’t have to deal with yy manually, for example by using PD0 and
Y2D.
• If yyxxxx is actually yymmdd, you will be merging first by year, then month, then day.
• If yyxxxx is actually yyddmm, you will merging by year, then day, then month. In most
cases, collating in this way would not be what you intended.
To correctly collate a date, the date components must be in an order suitable for collating.
For example, mmddyy and yymmdd will collate correctly, but ddmmyy or yyddmm will not.
For date forms that will not collate correctly, you must use one of the 2-digit year formats
(Y2B, Y2C, Y2D, Y2P, Y2S, and Y2Z).
The following table shows the order for ascending collation when using full-date formats
with the CENTWIN option:
Y2U PD PD zeros
Y2V Lower century dates (e.g. 1980)
Y2X Higher century dates (e.g. 2010)
Y2Y PD nines
Other date formats (non-full-date), with the exception of Y2S, do not process non-date
data; their sequence for ascending order begins with lower century dates and ends with
higher century dates.
The EQUALS parameter insures that equal-keyed records are merged in the order of their
respective files. Equal-keyed records from the lowest numbered SORTINnn file are written
before those from the second input file, etc. NOEQUALS, the default, specifies that equal-
keyed records from different files be written in random order.
The order of equal-keyed records within each input file is always preserved during a merge,
whether or not the EQUALS parameter is specified.
When the EQUALS parameter is used with the SUM or DUPKEYS control statement, the
first of the equal-keyed records is retained with the sum or DUPKEYS function value; all
other records are deleted after the specified field(s) have been calculated.
The FILES=n parameter specifies the number of input files that an E32 exit will supply to
the merge. The n value can be any number up to 100.
Specifying the FILES parameter both on the MERGE control statement and in the 24-bit
parameter list will cause MFX to terminate with a critical error.
The SKIPREC=n parameter instructs MFX to skip a decimal number of records before the
input file is copied. The n records skipped are deleted from the input file before
INCLUDE/OMIT processing, if specified, takes place.
The SKIPREC parameter should only be specified for a MERGE FIELDS=COPY operation.
SKIPREC will be ignored when doing a merge of SORTINnn data sets.
If SKIPREC is specified as a PARM option as well as on the MERGE control statement, the
PARM specification takes precedence.
The STOPAFT=n parameter specifies the number of records to be copied. These will be the
first n records after INCLUDE/OMIT and SKIPREC processing, if specified, have com-
pleted.
The STOPAFT parameter should only be specified for a MERGE FIELDS=COPY operation.
STOPAFT will be ignored when doing a merge of multiple SORTINnn data sets.
If STOPAFT is specified as a PARM option as well as on the MERGE control statement, the
PARM specification takes precedence.
MERGE FIELDS=(1,5,CH,A,10,2,PD,D,30,4,BI,A)
This sample MERGE control statement specifies three merge control fields:
• The first, or primary, control field begins in byte 1, is 5 bytes long, is in character
format and is to be merged in ascending order.
• The second control field begins in byte 10, is 2 bytes long, is in packed decimal format
and is to be merged in descending order.
• The third control field begins in the third bit of byte 30, is 4 bytes long, is in binary
format and is to be merged in ascending order.
MERGE FIELDS=COPY,STOPAFT=200
This MERGE statement specifies a copy operation. Only the first 200 records will be copied.
MODS exit-name1=(parameters1),...,exit-name16=(parameters16)
where parameters =
,N
,S
,C
r,b [,d]
,E
,X
,T
Insert a positional comma if the d value is omitted but the link-editing code is supplied.
If an application has more than one exit, specify the exit-name parameter for each exit. Up
to 16 exits can be specified. Use commas to separate multiple exit-name parameters.
The exit-name parameter identifies the exit and provides additional information. Replace
'exit-name' with an E followed by the appropriate exit number. The 16 valid exit-names are
listed below.
E11
E14
E15 E15
E16
E17
E18
Exit E21
E25
E27
The exit-name parameter also provides the following information about the exit.
r The r value specifies the name of the user exit routine. Any valid name is
acceptable. If the exit routine resides in a library, specify the member name or
alias name for the r value. For an exit coded in REXX, r represents the REXX
exec name.
b The b value specifies the exact or estimated decimal number of bytes the exit
routine requires in main storage. This number should include any additional
main storage required by the exit (e.g., buffers, GETMAINs, etc.). Specify an
estimate (without an E before the value) if the exact number is not known. This
number should only include storage requirements below the 16-megabyte line.
REXX exits have some additional storage requirements. REXX system modules
and control blocks need 26K, and each EXEC that is called will require 12K of
storage. In addition to any variables that the EXEC uses, all special MFX vari-
ables will require storage (including space for a record).
d The d value identifies the DD statement name that specifies the library in
which the exit routine resides. The JCL must include a DD statement specify-
ing each library in which an exit routine resides. If the exit routine is to be
placed in the input job stream, specify SYSIN for the d value. (If more than one
exit routine is included in SYSIN, the exit routines must be specified in ascend-
ing numerical order by exit name.)
Ideally, exit routines should be designed so that they do not require link-editing each time
they are used. Link-editing consumes system resources and increases sort/merge execution
time.
When a link-editing code is specified, the name E10 is reserved and no Phase 1 exit or E61
exit can use this name as a CSECT or ENTRY name. Similarly, the names E20 and E30 are
reserved and cannot be used by Phase 2 or Phase 3 exits.
N The N value specifies that link-editing is not required. Link-editing has already
taken place and MFX can directly invoke the routine.
S The S value specifies that link-editing is required. This value can only be used
for E11, E21 and E31 exits. The S value also indicates that the exit routine can
be link-edited separately from other exit routines specified for the same phase.
C The C value identifies a COBOL exit routine. COBOL exits must be link-edited
before execution time. Only COBOL E15 and E35 exits can be specified.
E The E value identifies a C exit routine. C exits must be link-edited before execu-
tion time. Only C E15 and/or E35 exits can be specified.
X The X value identifies a REXX exit routine. Only REXX E15 and E35 exits can
be specified.
T The T value specifies that MFX will dynamically link-edit the exit routine along
with other routines specified for the same sort/merge phase.
MODS E15=(ADDREC1,600,MODLIB,N),E25=(ALTREC,500,SYSIN),
E35=(ADDREC2,600,MODLIB,C)
• An E15 exit is the first exit routine. ADDREC1 is the member name of the routine,
which requires 600 bytes in main storage and resides in a library referenced by the DD
statement named MODLIB. The routine does not require link-editing.
• An E25 exit is the second exit routine. ALTREC is the member name of the routine
which requires 500 bytes in main storage. The exit is included in the SYSIN input
stream. Because N is not specified, this routine will be link-edited.
• An E35 exit is the third exit routine. ADDREC2 is the member name of the routine,
which requires 600 bytes in main storage and resides in a library referenced by the DD
statement named MODLIB. This routine is a COBOL exit which has been link-edited
before execution time.
• Create and optionally e-mail an output file in a PDF, HTML or RTF format
Use the OUTFIL control statement to create multiple output files without making multiple
passes through the input data. The output files can be treated the same or differently:
• Whether the input files are fixed-length or variable-length, the output files may be
either.
Note that all the output files will be sequenced in the same way, as specified on the SORT
or MERGE control statement. If you need to sort the output files differently, you should use
MFX PipeSort, a Syncsort product that works with MFX to reduce total elapsed time by
generating multiple, differently sequenced output files from a single read of the input data.
The OUTFIL parameters associated with this task are CONVERT, ENDREC, FILES,
FINDREP, FNAMES, FTOV, IFTHEN, INCLUDE/OMIT, NULLOFL, OUTREC,
OVERLAY, REPEAT, SAMPLE, SAVE, SPLIT, SPLITBY, SPLIT1R, STARTREC, VLFILL,
and VLTRIM.
The SortWriter capability of OUTFIL can produce completely formatted reports. The report
writing features, which can be specified differently for each output file, can accomplish
these tasks:
• Format headers and trailers for sections, pages, and the complete report.
• Provide TOTAL and SUBTOTAL capabilities for data fields in a specific part of a
report.
• Provide MIN, MAX, AVG, SUBMIN, SUBMAX, and SUBAVG capabilities for data
fields in a specific part of a report.
• Provide COUNT and SUBCOUNT capabilities for records in a specific part of a report.
Once formatted, output files can be assigned to any tape, disk, or unit record device for sub-
sequent printing.
The OUTFIL parameters associated with this task are BLKCCH1, BLKCCH2, BLKCCT1,
HEADER1, HEADER2, LINES, NODETAIL, REMOVECC, SECTIONS, TRAILER1, and
TRAILER2.
An output file can be created in a PDF, HTML or RTF format. Any of these files can be
e-mailed as an attachment or attachments to one or more recipients. The OUTFIL
parameter associated with this task is OUTPUT.
Use the OUTFIL control statement if you need to reformat records after E35 processing.
The OUTFIL parameters associated with this task are FINDREP, IFOUTLEN, IFTHEN,
OUTREC, OVERLAY, and PARSE.
The format for the OUTFIL control statement is illustrated on the following page.
OUTFIL [ACCEPT=n][,BLKCCH1][,BLKCCH2][,BLKCCT1]
,CONVERT ,ENDREC=n
,VTOF
,FILES = fileid ,FNAMES = ddname
fileid 1 ,fileid 2 ... ddname ,ddname ...
1 2
ALL
NONE
,INCLUDE ,AND,
,OMIT = ,&, ,IFTRAIL=(subparms)
(c c 2 ... )
1
,OR,
,|,
n RC0
,LINES = ANSI ,NODETAIL ,NOTMTOFL = RC4
(ANSI,n) RC16
RC0
,NULLOFL = RC4 , OUTPUT = subparm
RC16
,OUTREC
, PARSE=(subparm) ,BUILD = field ,field ...
,OVERLAY 1 2
,REMOVECC
, IFTHEN= subparm ,IFTHEN = subparm ... ,IFOUTLEN =n
, FINDREP=(subparm)
n
,REPEAT=n ,SAMPLE= ,SAVE ,SECTIONS= field 1 ,field 2 ...
(n,m)
,SPLIT
,SPLITBY=n ,STARTREC=n
,SPLIT1R=n
,TRAILER1= field1 ,field 2 ... ,TRAILER2= field1 ,field 2 ...
,VLFILL=f ,VLTRIM=b
The FILES parameter connects the OUTFIL control statement with one or more output
files. The files specified on this parameter, along with any specified on the FNAMES
parameter, will constitute the ddnames to receive output for this OUTFIL specification.
fileid
FILES =
(fileid 1 [,fileid 2 ] ...)
where:
OUT
fileid = x
xx
The fileid identifies the output file and connects the OUTFIL control statement with the
corresponding SORTOUT, SORTOFx, or SORTOFxx DD statement. For example,
FILES=OUT connects the OUTFIL control statement with the SORTOUT DD statement.
Similarly, FILES=1 connects the OUTFIL control statement with the SORTOF1 DD state-
ment, and FILES=01 connects the OUTFIL control statement with the SORTOF01 DD
statement. The x can be any alphanumeric character or special character allowed by JCL
DD statements.
If multiple output files have identical specifications (that is, identical record selection,
record reformatting, and report writing specifications), the FILES and/or FNAMES
parameter can connect the OUTFIL control statement with more than one DD statement.
For example, FILES=(OUT,02,03) connects the OUTFIL control statement with the
SORTOUT, SORTOF02, and SORTOF03 DD statements. Such a set of output files is
termed an OUTFIL group.
If multiple output files have different specifications, then each file is specified on a separate
OUTFIL control statement with one FILES and/or FNAMES parameter on each control
statement.
If a SORTOUT ddname is defined in the JCL and does not appear in any FILES or
FNAMES specification, it will be written to without any OUTFIL processing. If an inline
E35 exit has been specified, OUTFIL is ignored.
The FNAMES parameter connects the OUTFIL control statement with one or more output
files. The files specified on this parameter, along with any specified on the FILES parame-
ter, will constitute the ddnames to receive output for this OUTFIL specification.
ddname
FNAMES=
(ddname 1 [,ddname 2 ]...)
If multiple output files have identical specifications (that is, identical record selection,
record reformatting, and report writing specifications), the FNAMES and/or FILES param-
eter can connect the OUTFIL control statement with more than one DD statement. For
example, FNAMES=(FILE1OUT,FILE2OUT,FILE3OUT) connects the OUTFIL control
statement with the three listed DD statements. Such a set of output files is termed an
OUTFIL group.
If multiple output files have different specifications, then each file is specified on a separate
OUTFIL control statement with one FNAMES and/or FILES parameter on each control
statement.
If a SORTOUT ddname is defined in the JCL and does not appear in any FILES or
FNAMES specification, it will be written to without any OUTFIL processing. If an inline
E35 exit has been specified, OUTFIL is ignored.
See “COND Parameter (Required)” on page 2.29 for a complete description of comparisons
and logical expressions.
Specify the INCLUDE or OMIT parameter to indicate which records are to be included in
or omitted from each output file. These parameters let you create multiple output files
which contain different records. The default is to include all sorted or merged records in the
output file.
The comparison determines which records are included or omitted. When no data records
are to be included in the output file(s) (when running a test, for example), specify either
INCLUDE=NONE or OMIT=ALL.
Note: The location within the data records of the fields specified in the INCLUDE/OMIT
parameter will be based on the formatting of the record after processing by an E15/E32
exit, the INREC control statement, the OUTREC control statement, and an E35 exit, but
before processing due to the OUTREC and/or report writing parameters of the OUTFIL
control statement.
The following four parameters (STARTREC, ENDREC, SAVE, and SPLIT) are related to
the previous parameter (INCLUDE/OMIT) in that they specify records to be included for
OUTFIL processing. However, these four options specify records in bulk rather than
through a comparison condition.
The REPEAT=n parameter enables each output record to be written multiple times. n spec-
ifies the number of times each OUTFIL output record is written. The minimum value for n
is 2.
REPEAT can be used with the OUTFIL OUTREC multiline feature (designated by a / in
the OUTREC specification). When this is done, each line will be written n times defined by
the OUTREC specification. All occurrences of the first line will be written followed by all
the occurrences of the second, and so on.
The REPEAT parameter cannot be used with IFTRAIL, LINES, HEADER1, TRAILER1,
HEADER2, TRAILER2, SECTIONS, and NODETAIL.
The ACCEPT=n parameter is used to limit the number of records processed for the
OUTFIL group. Records entering OUTFIL processing that are not excluded by any of the
INCLUDE, OMIT, SAMPLE, STARTREC, or ENDREC parameters are included in the
ACCEPT count, and no further records are processed after n records have been included. If
ENDREC has also been specified, processing will stop when either one has been satisfied.
Use the STARTREC=n parameter to specify the record number n of the first record to be
processed by the OUTFIL specification in effect. All records prior to the specified record
will be ignored for the OUTFIL group. The record number is determined by the sequence of
records presented for OUTFIL processing.
Use the ENDREC=n parameter to specify the record number n of the last record to be pro-
cessed by the OUTFIL specification in effect. All records after the specified record will be
ignored for the OUTFIL group. The record number is determined by the sequence of
records presented for OUTFIL processing.
If ACCEPT has also been specified, processing will stop when either one has been satisfied.
The SAMPLE=n and SAMPLE=(n,m) parameters allow the selection of a sample of records
from an OUTFIL group. A specific interval and number of records in that interval can be
specified. The sample process will take place within the range of records specified by
STARTREC or ENDREC if they are specified. SAMPLE=n and SAMPLE=(n,m) are
mutually exclusive.
The sample consists of the first m records in every nth interval. n specifies the interval size.
The minimum value for n is 2 (sample every other record).
m specifies the number of records to be processed in each interval. The minimum value for
m is 1 (process the first record in each interval). If m is not specified, 1 is used for m. If m is
specified, it must be less than n.
Use SAVE to include records for OUTFIL processing that have not been included in any
other OUTFIL group.
If SAVE is specified on more than one OUTFIL group, then each of these OUTFIL groups
get the records that were discarded from all other OUTFIL groups that do not have SAVE.
The OUTFIL INCLUDE/OMIT parameter is mutually exclusive with the SAVE parameter.
Only one of these parameters can be specified for an OUTFIL group.
Note that if the SORTOUT data set has not been associated with any OUTFIL control
statement but is present in the JCL, the SORTOUT data set will receive a copy of all
records prior to OUTFIL processing. This does not affect the SAVE operation, since SAVE is
only pertinent to other OUTFIL group specifications.
The SPLIT parameter of the OUTFIL control statement causes output records to be distrib-
uted in rotation among files in an OUTFIL group.
In the normal case, when the SPLIT parameter is not used, the output files in the group
will contain the same records. SPLIT distributes the output records. The following OUTFIL
control statement will distribute records among three output files:
OUTFIL FILES=(01,02,03),SPLIT
For the above example, the first record will be written to the SORTOF01 data set; the sec-
ond, to SORTOF02; the third, to SORTOF03. The fourth record will be written to
SORTOF01 again, and so on in round-robin fashion.
The OUTFIL control statement can contain an INCLUDE/OMIT and an OUTREC parame-
ter, in which case the selected and reformatted subset of records will be distributed among
the output files.
Note that the SPLIT parameter cannot be used with any report writing (SortWriter) func-
tions. Specifically, report writing parameters (HEADERn, TRAILERn, SECTIONS, LINES,
NODETAIL, IFTRAIL) cannot be specified on the OUTFIL control statement that defines
the output group.
SPLIT can be used with BatchPipes/MVS; that is, the output records can be distributed
among BatchPipes/MVS data sets.
The SPLITBY=n parameter writes groups of records in rotation among multiple output
data sets and distributes multiple records at a time among the OUTFIL data sets. n speci-
fies the number of records to split by. The minimum value for n is 1.
The SPLITBY parameter is similar to SPLIT, but SPLITBY can be used to rotate by a spec-
ified number of records rather than by one record, for example, records 1-10 to the first
OUTFIL data set, records 11-20 to the second OUTFIL data set, and so on.
For example, if SPLITBY=10 is specified for an OUTFIL group with three data sets:
• The first OUTFIL data set in the group receives records 1-10, 31-40, and so on.
• The second OUTFIL data set in the group receives records 11-20, 41-50, and so on.
• The third OUTFIL data set in the group receives records 21-30, 51-60, and so on.
Note that the SPLITBY parameter cannot be used with any report writing (SortWriter)
functions. Specifically, report writing parameters (HEADERn, TRAILERn, SECTIONS,
LINES, NODETAIL, IFTRAIL) cannot be specified on the OUTFIL control statement that
defines the output group.
The SPLIT1R=n parameter of the OUTFIL control statement causes all output records to
be grouped and distributed among files in an OUTFIL group in a single rotation to main-
tain contiguity. The first n records are written to the first output file followed by the next n
records written to the next output file and so on, with the remaining records written to the
last output file regardless of n. The value of n must be specified.
Note that the SPLIT1R=n parameter cannot be used with any report writing (SortWriter)
functions. Specifically, report writing parameters (HEADERn, TRAILERn, SECTIONS,
LINES, NODETAIL, IFTRAIL) cannot be specified on the OUTFIL control statement that
defines the output group.
OUTFIL FILES=(01,02,03),SPLIT1R=10
For the above example, given 36 records to be distributed in a single rotation, records 1 to
10 will be written to the first data set; records 11 to 20 will be written to the second data
set; and records 21 to 36 will be written to the third data set.
The OUTREC parameter indicates how the records are to be formatted in each output file.
(BUILD is an alias for OUTREC.) This parameter lets you create multiple output files
which contain differently formatted records.
When the records in all multiple output files are formatted and edited identically, it is more
efficient to specify a single OUTREC control statement rather than several OUTREC
parameters.
The OUTREC parameter reformats the records that are to be included in the output file(s)
after E35 processing, if specified. If no additional reformatting is required, omit this
parameter.
All references to field positions specified in the OUTREC parameter refer to the record
after processing by an E15 exit, the INREC control statement, the OUTREC control state-
ment, and an E35 exit but before insertion of ANSI control characters.
OUTREC=(field1[,field2]...)
The format of the OUTFIL OUTREC parameter is generally identical to the format of the
FIELDS parameter of the OUTREC control statement. (See the subsections dealing with
the FIELDS parameter in “OUTREC Control Statement” on page 2.132.) Note, however,
that FIELDS= is not used with OUTFIL OUTREC. In addition, OUTFIL OUTREC accepts
the / subparameter and can be used with the VLFILL parameter.
[n]/ The / subparameter indicates the end of a line and can be used to create
multiple output lines from a single input record. Multiple slashes (coded
//.../ or n/) can be used to specify leading, trailing, or embedded blank lines.
At the beginning or end of the OUTREC parameter, n/ produces n blank
lines. Embedded within the OUTREC parameter, n/ produces n-1 blank
lines.
The IFTHEN parameter employs conditional logic, which enables you to reformat your
records based on specified criteria. Multiple IFTHEN parameters may be specified within
the same control statement and are processed sequentially. The IFTHEN parameter may
be used within the INREC, OUTREC, and OUTFIL control statements. See “IFTHEN
Parameter (Optional)” on page 2.198 for a complete description.
The PARSE parameter is used to extract variable-position and variable-length fields from
records and place the resultant data into fixed-length parsed fields. See “PARSE Parameter
(Optional)” on page 2.210.
The IFOUTLEN parameter overrides the maximum record length, which is automatically
set by the IFTHEN parameter, and changes it to a specified value. The IFOUTLEN param-
eter may only be used in conjunction with the IFTHEN parameter. See “IFOUTLEN
Parameter (Optional)” on page 2.208 for a complete description.
The FINDREP parameter provides the ability to find and replace one or more constants in
a record. A constant to be searched for can be specified as a character or hexadecimal string
and its replacement constant can be either a character, hexadecimal or null string.
See “FINDREP Parameter (Optional)” on page 2.192 for details on its use.
The OVERLAY parameter enables you to change particular columns and add fields to the
end of a record without rebuilding the entire record. When using the OVERLAY parameter
you only need to specify the columns you want to change. The rest of the input record
remains unchanged. See “OVERLAY Parameter (Optional)” on page 2.209 for a complete
description.
• It provides a means to override the default fill byte used in an OUTFIL OUTREC
CONVERT application when there are missing bytes in a p,l field specification.
In the first instance, if VLFILL has not been specified the application will terminate with
the critical error WER244A. In the second case, by default, spaces will be used for missing
field bytes.
f specifies a byte to be used for missing field bytes. f can be specified as either a character or
hexadecimal value. Specify either C'x' where x is a single EBCDIC character or X'hh' where
hh represents a hexadecimal digit pair (00-FF).
Note: If VLFILL is specified, the OUTREC parameter must also be specified. VLFILL is
ignored when the FTOV parameter is used. VLFILL may not be used with the IFTRAIL
parameter.
The CONVERT parameter is used in conjunction with the OUTREC parameter to convert
variable-length records to fixed-length records.
The records do not require an RDW and will be written to the output file(s) with a RECFM
of F or FB. When using CONVERT, you no longer need to apply the rules for “Specifying the
FIELDS parameter for Variable-Length Records” found in the description of the OUTREC
control statement.
You cannot specify the variable portion of the input records (position without length) when
using CONVERT. All other p,l data fields that are not present will be filled with blanks by
default. The OUTFIL VLFILL parameter can be used to specify a different fill byte for any
missing fields (see above description).
An E35 exit may process converted fixed-length records by using CONVERT on the
OUTREC statement rather than on the OUTFIL statement.
The FTOV parameter converts fixed-length input records to variable-length output records.
FTOV can be used both with and without the OUTREC parameter. When FTOV is used
with the OUTREC parameter, the variable-length record is created from the specified fields
of the fixed-length record. When FTOV is not used with the OUTREC parameter, the vari-
able-length record is created from the whole fixed-length record.
Notes: FTOV cannot be used with IFTRAIL, CONVERT or VTOF. If the input record is
variable-length, FTOV, if specified, will be ignored. FTOV can be used with the VLTRIM
parameter to delete pad bytes at the end of a record.
For an example of an OUTFIL control statement that uses the FTOV parameter, see Figure
70 on page 2.130.
The VLTRIM parameter defines a byte to be deleted from the end of a variable-length
record. All prior occurrences of this byte will also be deleted until a byte that is not equal to
the trim byte is found. The resulting records are decreased in record length. However,
VLTRIM will not delete the first data byte, the ANSI carriage control character, or the
Record Descriptor Word (RDW).
VLTRIM=b
b specifies the byte to be deleted from the end of the record. b can be specified as either a
character or hexadecimal value. Specify either C'x' where x is a single EBCDIC character or
X'hh' where hh represents a hexadecimal digit pair (00-FF).
For an example of an OUTFIL control statement that uses the VLTRIM parameter, see
Figure 70 on page 2.130.
The BLKCCH1 parameter of the OUTFIL control statement prevents a page eject at the
start of HEADER1, the report header. In the first line of HEADER1, a blank character
replaces the ANSI carriage control character '1'. When specifying BLKCCH1, HEADER1
also must be specified; otherwise, it is ignored.
The BLKCCH2 parameter of the OUTFIL control statement prevents a page eject at the
start of the first HEADER2, the page header. In the first line of HEADER2, a blank charac-
ter replaces the ANSI carriage control character '1'. When specifying BLKCCH2,
HEADER2 also must be specified; otherwise, it is ignored.
The BLKCCT1 parameter of the OUTFIL control statement prevents a page eject at the
start of TRAILER1, the report trailer. In the first line of TRAILER1, a blank character
replaces the ANSI carriage control character '1'. When specifying BLKCCT1, TRAILER1
also must be specified; otherwise, it is ignored.
HEADER1 and HEADER2 are parameters of the OUTFIL control statement. HEADER3 is
a subparameter of OUTFIL’s SECTIONS parameter. Refer to “SECTIONS Parameter
(Optional)” on page 2.115 for an explanation of how to specify HEADER3.
The three types of headers function independently of each other. Each serves a different
purpose.
• HEADER1 provides a header or a possible title page for the entire report. It appears
only once at the beginning of the report on its own page.
• HEADER2 provides a page header or a running head for each page defined by the
LINES parameter. It appears at the beginning or top of each page.
• HEADER3 provides a section header that appears at the beginning of each specified
section and, optionally, at the top of each page (or directly below any HEADER2).
The chart below illustrates the format for HEADERs. The field entries represent the sub-
parameters that can be specified for each HEADER entry.
HEADER1=(field1[,field2]...)
HEADER2=(field1[,field2]...)
HEADER3=(field1[,field2]...)
The following HEADER Subparameters Format chart illustrates and defines the available
subparameters. Each subparameter constitutes a separate field of the HEADER.
[n] X
[n] X'hhhh...hh'
[n] 'literal string'
[n] /
p,l
&DATE ± nnnn
&DATE=(m m
1 2 3 4m m ± nnnn
&DATENS=(xyz) ± nnnn
&YDDD=(m m
1 2 3 m ) ± nnnn
&YDDDNS=(m 1 m 2 ) ± nnnn
[ c: ] &TIME
&TIME=(hp)
&TIMENS=(tt)
&PAGE
f o [,LENGTH=n]
TO = f o [,LENGTH=n]
&PAGE=( Mm )
[,SIGNS=(...)] [,LENGTH=n]
EDIT=(...)
M0
'literal string' Use the 'literal string' subparameter to define a literal string.
Specify the number of occurrences by coding n immediately before
it. An apostrophe within a literal string must be specified as a
double apostrophe; for example, – 'O"Leary'.
p,l Use the p and l subparameters to include a field (or fields) within
a record in the header. For a HEADER1, the field(s) will be
extracted from the first record in a file; for a HEADER2, the
field(s) will be extracted from the first record on a page; for a
HEADER3, the field(s) will be extracted from the first record in a
section. p is the starting position of the field in the record; l is the
length in bytes (1-32752) of the field. Any number of fields can be
specified. (Contiguous fields within a record can be specified with
a single p,l entry, but their combined length cannot exceed 32752
bytes.) The specified field(s) should be a character or alphanu-
meric string or a number in printable format, and the field(s) can-
not be converted or edited.
&DATE [{±}nnnn] The &DATE subparameter specifies the current system date or
date with offset and requires 8 bytes to display mm/dd/yy.
Optionally, you can create an offset of the current date. The offset
takes the form {±}nnnn, where '+' indicates a date after the cur-
rent date and '–' indicates a date before the current date. 'nnnn' is
the date offset. The range is 0 to 9999, which represents the num-
ber of days to be added or subtracted from the current date.
For example, to print the date with the form yy-mm-dd, specify
&DATE=(YMD-). For December 31, 1999, the date would appear
as “99-12-31.”
The field for this form of &DATE requires 8 bytes for a 2-digit
year representation and 10 bytes for a 4-digit year. The M, D, and
Y or 4 may only appear once in the mask. All four positions must
be specified.
&TIME The &TIME subparameter specifies the current time of day and
requires 8 bytes to display hh:mm:ss, where hh is in 24-hour for-
mat.
&TIME=(hp) This form of the &TIME subparameter generates the current sys-
tem time of day and controls the formatting of the time. You can
print the time in 24-hour or 12-hour format and specify the sepa-
rator character between the hours, minutes, and seconds.
&TIMENS=(tt) This form of the &TIMENS subparameter specifies that the cur-
rent time is to appear in the report record in the form 'hhmmss'
(24-hour time) or 'hhmmss xx' (12-hour time). If tt is 24, the time
is to appear in the form 'hhmmss' (24-hour time) where hh repre-
sents the hour (00-23), mm represents the minutes (00-59), and ss
represents the seconds (00-59).
• For fixed-length records, headings specified with fewer blanks than the logical record
length (LRECL) of the output record are automatically padded on the right with
blanks.
• If a header length exceeds the logical record length (LRECL) of the output record, MFX
will issue the WER116A error message. If you do not wish to shorten the header, you
can lengthen the record. For fixed-length output, use the OUTREC control statement or
the OUTREC parameter to expand the output record length so that it is at least as long
as the longest header (and trailer). For example, if the longest header is 115 characters
and the output record length is 80 bytes, use the OUTREC control statement or the
OUTREC parameter to insert a blank in position 115 of the output record. This will
cause bytes 81 through 115 to be padded with blanks. For variable-length records, it is
easiest to just change the LRECL on the output data set DD statement to match the
length of the longest header (and trailer).
TRAILER1 and TRAILER2 are parameters of the OUTFIL control statement; TRAILER3
is a subparameter of OUTFIL’s SECTIONS parameter. Refer to “SECTIONS Parameter
(Optional)” on page 2.115 for an explanation of how to specify TRAILER3.
The three types of trailers function independently of each other. Each serves a different
purpose:
• TRAILER1 provides a trailer or a possible summary for the entire report. It appears
only once at the end of the report on its own page.
• TRAILER2 provides a page trailer for each page defined by the LINES parameter. It
appears at the end of each page.
• TRAILER3 provides a section trailer that appears at the end of each specified section
and serves as a conclusion or summary for that section.
The chart below illustrates the format for TRAILERs. Its field entries represent the subpa-
rameters that can be specified for each TRAILER entry.
TRAILER1=(field1[,field2]...)
TRAILER2=(field1[,field2]...)
TRAILER3=(field1[,field2]...)
The following TRAILER Subparameters Format chart illustrates and defines the available
subparameters. Each subparameter constitutes a separate field of the TRAILER.
[n] X
[n] X'hhhh...hh'
[n] 'literal string'
[n] /
p,l
&DATE ± nnnn
&DATE= m 1 m 2 m 3 m 4 ± nnnn
&DATENS=(xyz) ± nnnn
&YDDD=(m 1 m 2 m 3 ) ± nnnn
&YDDDNS=(m m ) ± nnnn
1 2
&TIME
&TIME=(hp)
&TIMENS=(tt)
&PAGE
f o [,LENGTH=n]
TO = f o [,LENGTH=n]
&PAGE=( Mm )
EDIT=(...) [,SIGNS=(...)] [,LENGTH=n]
M0
TOTAL/TOT
,f o [,LENGTH=n]
SUBTOTAL/SUB
[c:] MIN ,TO = f o [,LENGTH=n]
SUBMIN
= (p,l,f ,Mm )
MAX
,EDIT=(...) [,SIGNS=(...)] [,LENGTH=n]
SUBMAX
AVG ,M0
SUBAVG
COUNT
f o [,LENGTH=n]
TO = f o [,LENGTH=n]
COUNT + nnn =( Mm )
- [,SIGNS=(...)] [,LENGTH=n]
EDIT=(...)
M0
SUBCOUNT
f o [,LENGTH=n]
TO = f o [,LENGTH=n]
SUBCOUNT=(
Mm )
EDIT=(...) [,SIGNS=(...)] [,LENGTH=n]
M0
COUNT15
SUBCOUNT15
'literal string' Use the 'literal string' subparameter to define a literal string.
Specify the number of repetitions by specifying n immediately
before it. An apostrophe within a literal string must be specified
as a double apostrophe; for example, – 'O"Leary'.
p,l Use the p and l subparameters to include a field (or fields) within
a record in the trailer. For a TRAILER1, the field(s) will be
extracted from the last record in a file; for a TRAILER2, the
field(s) will be extracted from the last record on a page; for a
TRAILER3, the field(s) will be extracted from the last record in a
section. p is the starting position of the field in the record; l is the
length in bytes (1-32752) of the field. Any number of fields can be
specified. (Contiguous fields within a record may be specified with
a single p,l entry, but their combined length may not exceed
32752 bytes.) The specified field(s) should be a character or alpha-
numeric string, or a number in printable format, and the field
cannot be converted or edited.
&DATE [{±}nnnn] The &DATE subparameter specifies the current system date or
date with offset and requires 8 bytes to display mm/dd/yy.
Optionally, you can create an offset of the current date. The offset
takes the form {±}nnnn, where '+' indicates a date after the cur-
rent date and '–' indicates a date before the current date. 'nnnn' is
the date offset. The range is 0 to 9999, which represents the num-
ber of days to be added or subtracted from the current date.
For example, to print the date with the form yy-mm-dd, specify
&DATE=(YMD-). For December 31, 1999, the date would appear
as “99-12-31”.
The field for this form of &DATE requires 8 bytes for a 2-digit
year representation and 10 bytes for a 4-digit year. The M, D, and
Y or 4 may only appear once in the mask. All four positions must
be specified.
&TIME The &TIME subparameter specifies the current time of day and
requires 8 bytes to display hh:mm:ss, where hh is in 24-hour for-
mat.
&TIMENS=(tt) This form of the &TIMENS subparameter specifies that the cur-
rent time is to appear in the report record in the form 'hhmmss'
(24-hour time) or 'hhmmss xx' (12-hour time). If tt is 24, the time
is to appear in the form 'hhmmss' (24-hour time) where hh repre-
sents the hour (00-23), mm represents the minutes (00-59), and ss
represents the seconds (00-59).
TOTAL/TOT Use the TOTAL subparameter to specify that numeric data are to
be accumulated and totaled at the end of a report, logical page, or
section.
After the results are included in the appropriate trailer, the accu-
mulator resets to zero. TOTALs either appear in printable format
or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For
more information, see the fo description on page 2.108.
BI 1-4 10
BI 5-8 20
FI 1-4 10
FI 5-8 20
FL 4 or 8 20
FS 1-16 15
FS 17-32 31
PD 1-8 15
PD 9-16 31
SFF/UFF 1-15 15
SFF/UFF 16-44 31
ZD 1-15 15
ZD 16-31 31
AVG Use the AVG subparameter to obtain the average numeric value
of an input field for all records within the report, logical page, or
section. AVG values either appear in printable format or can be
converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more
information, see the fo description on page 2.108.
• Separate fields with commas, except for /, where commas are optional.
• If an MFX editing mask is used for totaled or subtotaled data (either by specification or
by default), the length of the generated pattern will be determined based on the
information provided in Table 17 on page 2.110, regardless of the actual length of the
field being totaled or subtotaled. Use the LENGTH subparameter to override the
length of the pattern.
• For fixed-length records, trailers specified with fewer blanks than the logical record
length (LRECL) of the output record are automatically padded on the right with
blanks.
• If a trailer length exceeds the logical record length (LRECL) of the output record, MFX
will issue the WER116A error message. If you do not wish to shorten the trailer, you
can lengthen the record. For fixed-length output, use the OUTREC control statement or
the OUTREC parameter to expand the output record length so that it is at least as long
as the longest trailer (and header). For example, if the longest trailer is 115 characters
and the output record length is 80 bytes, use the OUTREC control statement or the
OUTREC parameter to insert a blank in position 115 of the output record. This will
cause bytes 81 through 115 to be padded with blanks. For variable-length records, it is
easiest to just change the LRECL on the output data set DD statement to match the
length of the longest trailer (and header).
The SECTIONS parameter allows the output report to be divided into sections.
SECTIONS=(field1[,field2]...)
The SECTIONS parameter identifies the control field(s) that determine or control section
breaks. More than one control field can be specified to subdivide a report within sections.
However, if more than one control field is specified, the specifications must be made in
major to minor order. A major control field break causes all minor control fields to break at
the same time.
p The position value indicates the first byte of the field relative to the beginning
of the record after processing by an E15/E32 exit, the INREC control statement,
the OUTREC control statement, and an E35 exit, if specified, but before pro-
cessing by the OUTREC parameter and other report writing parameters of the
OUTFIL control statement, if specified.
l The length value indicates the length of the field. The length must be an inte-
ger number of bytes and cannot exceed 256 bytes.
For each control field, one or more of the following subparameters may be specified: SKIP,
HEADER3, or TRAILER3. The SECTIONS subparameters are described below.
P
,SKIP = nL [,TRAILER3=(...)] [,HEADER3=(...)] [,PAGEHEAD]
A control field may be specified without any subparameters. This allows multiple non-
contiguous control fields to be specified for each SECTIONS break field.
Use the LINES parameter to define the logical pages constituting a report. The pages can
be defined in three ways:
Regardless of which method is selected, the number of lines defining a logical page must be
equal to or greater than the total number of lines, including blank lines, required for all
HEADER2, HEADER3, TRAILER2, and TRAILER3 entries plus at least one record. If
multiline OUTREC is used, all lines produced from each input record will be written to the
same logical page.
n
LINES = ANSI
(ANSI,n)
LINES=n
If LINES=n is specified, paging is automatic and carriage control characters are added to
the beginning of each record by MFX. Because MFX requires one byte for a control charac-
ter, the LRECL specified in the SORTOUT, SORTOFx, or SORTOFxx DD statement must
be one byte longer than the number of bytes specified for the output record length.
Specify n as a value from 1 to 255. If report writing parameters are specified for the file(s)
(e.g., HEADERs, TRAILERs, SECTIONS), the default is LINES=60.
The LINES=n specification works in conjunction with any HEADERs and TRAILERs you
have specified as follows:
• HEADER1, if specified, prints as a preface to the report. Its page is not numbered.
• An automatic page break occurs after HEADER1. Every nth line after the completion of
HEADER1 will signal the start of a new page.
• A HEADER2 entry, if present, is the first line(s) on each page, followed by any
HEADER3 entries that might be triggered either by control breaks or by PAGEHEAD
specifications in the SECTIONS parameter. HEADER2 is part of the logical page.
• A HEADER3 entry, if present, is part of a section of the report. It prints as a header for
the separate report sections. HEADER3s appear in major to minor order according to
the order of their associated sections.
• A TRAILER2 entry, if present, will be the last line(s) on the logical page, preceded by
any TRAILER3s triggered by coincidentally occurring control breaks. TRAILER2 is
part of the logical page.
• TRAILER1 will be the last page of the entire report. Its page is not numbered.
LINES=ANSI
The ANSI control characters which can be used with the LINES=ANSI specification are
summarized in the ANSI Control Character Chart below.
If printed output is requested, the ANSI control characters do not print as part of the out-
put record. If, however, the report is routed to a disk or tape device, the control characters
are included in the output data.
• After HEADER1 is output, the first logical page begins with the first line of HEADER2.
• A logical page ends when data with a ‘1’ in the first byte are encountered. The printing
of a data record beginning with a ‘1’ is delayed until after TRAILER2 and HEADER2, if
specified, are output. When record printing resumes, this delayed record will be
modified to have a control character ‘+’, which causes it to print over the last line of
HEADER2 (or HEADER3, if HEADER3 appears at the top of the page). To prevent the
data record from printing over a text line of a header, the header should end with at
least one blank line, specified by a slash (/).
• To print HEADER2 at the top of a new physical page, the HEADER2's first line should
begin with a ‘1’.
• Because you are in complete control of the paging with LINES=ANSI, you can permit
HEADER2 to appear between variable numbers of printed records.
LINES=(ANSI,n)
If LINES=(ANSI,n) is specified, ANSI control characters govern vertical control, and the ‘n’
specification provides additional automatic paging. Added flexibility is provided because
the user can elect to double or triple space the output and still use automatic paging.
When MFX encounters a data record with a ‘1’ in the first byte, MFX begins a new logical
page. If no data record begins with a ‘1’ but the next data record would cause the number of
lines on the page to exceed n, MFX treats the record as if it began with a ‘1’ and begins a
new page.
Refer to the LINES=ANSI section on page 2.118 for information on using a HEADER2 with
ANSI control characters.
The following chart lists the ANSI control characters accepted by MFX.
blank Space one line before printing 6 Skip to channel 6 before printing
IFTRAIL=(TRLID=(conditions),TRLUPD=(field1[,field2]...)[,HD=YES])
The IFTRAIL parameter is used to identify an existing trailer record in the input data for
an OUTFIL group and update any count or total fields in the record. This parameter is use-
ful when an input file is being altered in the current application by adding or deleting
records, or by modifying data fields used to produce count and total fields in the trailer
record. Using IFTRAIL lets you update the count and total fields to reflect those changes.
The updated count and total fields will reflect the input data to OUTFIL processing.
The trailer record is identified by using the TRLID subparameter, and the updates are
specified in the TRLUPD subparameter. Since the trailer record is not a data record, no
other OUTFIL processing, such as INCLUDE/OMIT or OUTREC parameter processing,
will be performed on it. The trailer record will also not be used for the updated count or
total values. You may optionally identify the first record passed to the OUTFIL group as a
header record by using the HD=YES parameter. A header record will similarly not be sub-
ject to other OUTFIL processing, nor will it be used for the updated count or total values in
the trailer record.
IFTRAIL may not be used with any of the following OUTFIL operands: HEADERn, TRAIL-
ERn, SECTIONS, CONVERT, VTOF, FTOV, LINES, NODETAIL, REPEAT, SPLIT,
SPLITBY, SPLIT1R, VLFILL or VLTRIM.
TRLID=(cond) The TRLID subparameter specifies the condition that is used to identify
the trailer record in the input data to an OUTFIL group. The condition is specified
in the same manner as for the OUTFIL INCLUDE parameter (see p. 2.86), which is
based on the INCLUDE/OMIT control statements. For example,
TRLID=(10,6,CH,EQ,C'TOTAL:'). Note that locale processing is not used for
TRLID.
The first record into the OUTFIL group for which the condition is true is deter-
mined to be the trailer record and thus end-of-file. All succeeding records will be
ignored for the OUTFIL group.
For variable length records, the VLTESTI installation parameter and EXEC state-
ment parameter does not apply. Records that do not contain all TRLID fields will
bypass TRLID processing.
For example,
TRLUPD=(5:COUNT=(EDIT=(IITTT)),21:TOT=23,4,ZD,M1,LENGTH=6)).
The fields should not overlap the RDW in columns 1-4 for variable length records,
and they should not extend past the end of the trailer records or they will not be
included in the record. For fixed length records, the trailer record will be truncated
or padded with blanks to match the output file record length as necessary. If a col-
umn number is not specified, the field will begin in column 1 or directly after the
previous field. Fields should not overlay each other and should be specified in
ascending column order.
The values used for the COUNT and TOTAL fields derive from the original OUT-
FIL group input records and do not include the trailer record itself.
HD=YES HD=YES is used to identify the first OUTFIL group input record as a header
record. Normal OUTFIL processing for parameters such as INCLUDE or OUTREC
will not be applied to the header record, and the record will not be used to deter-
mine COUNT and TOTAL values for the trailer record, if one is found. TRLID pro-
cessing will not apply to the header record.
The NODETAIL parameter instructs the SortWriter facility to generate an output report
consisting only of header and trailer entries. Data records are not included in the output
report when this parameter is specified.
Thus, for example, it is possible to generate a report with section trailers containing totals
and record counts without printing any data records.
The REMOVECC parameter generates reports that do not include ANSI carriage control
characters that specify printer actions (for example, skipping a line or ejecting a page). The
REMOVECC parameter omits the carriage control character from all of the report records.
REMOVECC simplifies the removal of printer controls when output is to be displayed
online or written to a list data set rather than a printout. When REMOVECC is used, the
LRECL does not require an extra byte for the carriage control character, and the RECFM
does not require the ‘A’ (for ANSI); thus you would specify FB, not FBA.
RC0
NOTMTOFL= RC4
RC16
The NOTMTOFL parameter specifies the action to be taken when any non-SORTOUT
OUTFIL data set contains at least one data record. NOTMTOFL will be ignored for a Bet-
terGener application.
RC0 The default instructs MFX to issue a return code of 0 if not overridden by a higher
return code set for another reason.
RC4 Instructs MFX to issue a WER495I warning message and continue processing. A
return code of 4 will be issued if not overridden by a higher return code set for
another reason.
RC16 Instructs MFX to issue a WER495A message and terminate processing with a
return code of 16.
RC0
NULLOFL= RC4
RC16
The NULLOFL parameter specifies the action to be taken when any non-SORTOUT OUT-
FIL data set contains no data records. NULLOFL is ignored in a BetterGener application.
RC0 The delivered default instructs MFX to issue a return code of 0 if not overridden by
a higher return code set for another reason.
RC4 Instructs MFX to issue a WER461I warning message and continue processing. A
return code of 4 will be issued if not overridden by a higher return code set for
another reason.
RC16 Instructs MFX to issue a WER461A message and to terminate processing with a
return code of 16.
The OUTPUT parameter specifies that the OUTFIL data set will be written in a PDF,
HTML or RTF format. The corresponding OUTFIL DD must define an HFS data set with
the PATH, PATHOPTS and PATHMODE parameters. The data sets created can then be
downloaded or e-mailed (using the OUTPUT EMAIL subparameter) to a platform that sup-
ports the viewing of these formats. If the file is downloaded, it must be downloaded as a
binary file.
If the RECFM associated with the data set includes “A” for ANSI control characters, either
due to OUTFIL report writing or because it was copied from the input RECFM, the only
printer control characters reflected in the output will be blank, 0, - and 1. All other charac-
ters will be interpreted as blank, i.e. a new line. For HTML, whenever a ’1’ ANSI control
character is encountered, a blank line will be generated before the record is written, except
for the very first record.
The following DD statements can be added if you want to receive informational messages
from the Java environment which is used to process PDF, RTF and HTML data sets.
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
An example illustrating the use of the OUTPUT parameter appears on page 3.67.
PDF
HTML
RTF
,PORTRAIT
,LANDSCAPE
LETTER
,PAGESIZE= LEGAL
papersize
,MARGINS = LEFT = nPT ,RIGHT = nPT ,TOP = nPT ,BOTTOM = nPT
36PT 36PT 36PT 36PT
,TITLE = ...
,AUTHOR = ...
,SUBJECT = ...
,KEYWORDS = ...
,APPLICATION = ...
,OWNERPASSWORD = ...
,USERPASSWORD = ...
YES
,COPYALLOWED =
NO
YES
,PRINTINGALLOWED =
NO
WHITE
,BACKGROUNDCOLOR =
color parameters
PDF Specifies PDF output format. This format is the default if the
OUTPUT parameter is specified. If PDF is specified, the HTML and
RTF subparameters may not be specified.
HTML Specifies HTML output format. If HTML is specified, the PDF and
RTF subparameters may not be specified.
RTF Specifies RTF output format. If RTF is specified, the PDF and
HTML subparameters may not be specified.
PAGESIZE Specifies the page size of the output data set. LETTER (8.5” x 11”)
is the default. Any of the following common paper sizes can be spec-
ified:
_11X17, A0, A1, A10, A2, A3, A4, A5, A6, A7, A8, A9, ARCH_A,
ARCH_B, ARCH_C, ARCH_D, ARCH_E, B0, B1, B10, B2, B3, B4,
B5, B6, B7, B8, B9, CROWN_OCTAVO, CROWN_QUARTO,
DEMY_OCTAVO, DEMY_QUARTO, EXECUTIVE, FLSA, FLSE,
HALFLETTER, ID_1, ID_2, ID_3, LARGE_CROWN_OCTAVO,
LARGE_CROWN_QUARTO, LEDGER, LEGAL, LETTER, NOTE,
PENGUIN_LARGE_PAPERBACK,
PENGUIN_SMALL_PAPERBACK, POSTCARD,
ROYAL_OCTAVO,ROYAL_QUARTO, SMALL_PAPERBACK, TAB-
LOID.
MARGINS Specifies the size of the left, right, top and bottom margins on the
page. Each value is in points and 36 is the default number of points
for each margin. One inch is equal to 72 points. The number of
points can be from 0 through 4000.
TITLE Specifies a title for the document. It can be any string up to 4095
characters. An apostrophe within the string must be specified with
double apostrophes.
AUTHOR Specifies the author of the document. It can any string up to 4095
characters. An apostrophe within the string must be specified with
double apostrophes.
KEYWORDS Specifies keywords associated with the document. They can be spec-
ified as a string of up to 4095 characters. An apostrophe within the
string must be specified with double apostrophes.
APPLICATION Specifies the application name for the document. It can be any
string up to 4095 characters. An apostrophe within the string must
be specified with double apostrophes. This subparameter is only
applicable to PDF files.
OWNERPASSWORD Specifies the owner password of the document. It can be any string
up to 4095 characters. An apostrophe within the string must be
specified with double apostrophes. This subparameter is only appli-
cable to PDF files.
USERPASSWORD Specifies the user password of the document. It can be any string up
to 4095 characters. An apostrophe within the string must be speci-
fied with double apostrophes. This subparameter is only applicable
to PDF files.
BACKGROUNDCOLOR Specifies the background color for the document. Any one of the
following colors may be specified: BLACK, BLUE, CYAN, DARK-
GRAY, GRAY, GREEN, LIGHTGRAY, MAGENTA, ORANGE,
PINK, RED, WHITE, YELLOW, RGB=(int_red,int_green,int_blue).
The RGB subparameters create a color with the specified red,
green, and blue values in the range 0 to 255 or X’00’ to X’FF’.
WHITE is the default.
COURIER
HELVETICA
FONTNAME=
TIMES_ROMAN
name of font
,nPT
,12PT
,BOLD
,ITALIC
,BOLDITALIC
,BLACK
, color parameters
,UNDERLINE
FONTNAME Specifies the name of the font. When creating a PDF format file,
only COURIER, HELVETICA and TIMES_ROMAN are
allowed. If you specify a font other than one of these three for a
PDF format, COURIER will be used. For an HTML or RTF for-
mat file, you can choose any font as your fontname. If the name
of the font is not a real font, the system default will be used.
nPT Specifies the size of the font, where n can be a number from 1
through 72.
BOLD Specifies whether to use bold and/or italics. The default is
ITALIC none of these.
BOLDITALIC
color parameters Specifies the choice of color from the following list: BLACK,
BLUE, CYAN, DARKGRAY, GRAY, GREEN, LIGHTGRAY,
MAGENTA, ORANGE, PINK, RED, WHITE, YELLOW,
RGB=(int_red,int_green, int_blue). The RGB subparameters
create a color with the specified red, green, and blue values in
the range 0 to 255 or X’00 to X’FF’. BLACK is the default.
SHADING Specifies the shading color. Choose one of the color parameters
listed above. The default is no shading.
EMAIL Specifies that the output data set(s) defined by the OUTFIL state-
ment be e-mailed as an attachment (or attachments) to one or more
recipients. The file name of the attachment will be the file name
specified in the PATH parameter of the OUTFIL DD statement.
FROM = email_address
,TO = email_address_list
,TODD = ddname
,CC = email_address_list
,CCDD = ddname
,BCC = email_address_list
,BCCDD = ddname
,SUBJECT = text
,BODY = text
,REPLYTO = email_address_list
,HOSTNAME = SMTP_server_name
,PORT = 25, n
HOSTNAME Specifies the name or IP address of the SMTP server that will
be used to send the e-mail. This can used to override the system
default.
PORT Specifies the TCP port number that will be used to relay the e-
mail. The default is 25.
Example 1
The following example illustrates how to use the OUTFIL control statement to define mul-
tiple output files.
OUTFIL FILES=1,OUTREC=(10:1,20,40:45,5,50:60,8),
INCLUDE=(21,2,CH,EQ,C'NY')
OUTFIL FILES=2,OUTREC=(20:1,20,50:60,8),
INCLUDE=(21,2,CH,EQ,C'MA')
The two OUTFIL control statements illustrated above are required to create two different
output files.
• The output records in the first file (SORTOF1) contain three fields from the input
record. The first input record field begins in byte 1 and is 20 bytes long, the second
input record field begins in byte 45 and is 5 bytes long, and the third input record field
begins in byte 60 and is 8 bytes long. This file will include only those records with ‘NY’
in bytes 21 and 22 of the input record. These three fields will begin in bytes 10, 40, and
50 of the output record.
• The output records in the second file (SORTOF2) contain two fields from the input
record. The first input record field begins in byte 1 and is 20 bytes long, and the second
input field begins in byte 60 and is 8 bytes long. This file will include only those records
with ‘MA’ in bytes 21 and 22 of the input record. These two fields will begin in bytes 20
and 50 of the output record.
Example 2
OUTFIL FILES=(01,02,03),OUTREC=(1:1,40,50:41,40)
This OUTFIL control statement creates three identically formatted output files:
SORTOF01, SORTOF02, and SORTOF03. These files may be written to the same output
device or to three different output devices.
• The output records contain two input record fields. The first input record field begins in
column 1. This field began in position 1 before OUTREC processing and is 40 bytes
long. The second input record field begins in column 50. This field began in position 41
before OUTREC processing and is 40 bytes long. The two fields will begin in positions 1
and 50 after OUTREC has been processed.
Example 3
OUTFIL FTOV,VLTRIM=C'*',OUTREC=(1,7,9:8,8)
Figure 70. Sample OUTFIL Control Statement with FTOV and VLTRIM
This OUTFIL control statement uses FTOV to convert fixed-length records to variable-
length records and VLTRIM to remove the specified type of trailing bytes (in this case,
asterisks).
Comprehensive examples illustrating the SortWriter facility and the multiple output capa-
bility of the OUTFIL control statement are provided in “Chapter 3. How to Use MFX’s Data
Utility Features”.
• Find and replace character or hexadecimal input constants anywhere in your records
with character, hexadecimal, or null output constants.
• Extract variable-position and variable-length fields from records and place them into
fixed-length parsed fields. These parsed fields can then be used in any
FIELDS/BUILD/OVERLAY function in which a standard p,l fixed-length field can be
used.
• Insert the current date, current time, or current date with an offset.
• Add or subtract units of days to or from an input record date field and create an output
record date field in the same format with the same length.
The OUTREC parameter of the OUTFIL control statement can also be used to accomplish
any of the above tasks. The INREC control statement can also be used to accomplish any of
the above tasks except for converting a variable-length record file to a fixed-length record
file. The INREC control statement also supports the &MULTIINDD subparameter, which
is used to identify the input record’s origin when using the MULTIIN PARM.
Consider these guidelines when deciding whether to use the INREC control statement, the
OUTREC control statement, or the OUTREC parameter of the OUTFIL control statement:
• Use the INREC control statement to delete irrelevant data fields, reformat numeric
fields to a shorter length, or combine numeric fields with arithmetic operations and
functions. Reducing the size of the input records before they are sorted or merged
usually improves performance.
• Use either the OUTREC control statement or the OUTREC parameter of the OUTFIL
control statement to expand the data record, create new numeric fields, realign data
fields, convert and edit numeric data, and change from variable-length format to fixed-
length format when you are creating one output file.
• Use the OUTREC control statement when you are creating multiple output files with
the same output record formatting.
• Use the OUTREC parameter of the OUTFIL control statement when you are creating
multiple output files with different output record formatting.
• Use the OUTREC control statement if you need to convert a numeric field to printable
format so it can be displayed in an OUTFIL header.
• Use the OUTREC parameter of the OUTFIL control statement when an E35 exit must
process the records first.
• Use the OUTREC parameter of the OUTFIL control statement when you specify the
TOTAL and/or SUBTOTAL subparameters of the TRAILER parameter so that the
accumulator(s) can sum numeric fields before they have been converted to readable
format and edited.
• Use the OUTREC parameter of the OUTFIL control statement if you want to use the
VLFILL parameter or the n/ subparameter, which are not available on the OUTREC or
INREC control statements; they can only be used with the OUTREC parameter of the
OUTFIL control statement. For a description of the n/ subparameter, see page 2.91; for
the VLFILL parameter, see page 2.92.
PARSE=(subparm), FIELDS =(fields) ,CONVERT
BUILD ,VTOF
OUTREC
IFTHEN = subparm ,IFTHEN=(subparm), ,IFOUTLEN = n
PARSE=(subparm), OVERLAY=(fields)
FINDREP = subparm
p,l [,subparm]
%pp [,subparm]
[n] X
[n] X'hhhh...hh'
[n] C'literal string'
[n] Z
'date field'
'time field'
1 1 (p,h)
SEQNUM,1,f ,START= --- ,INCR= --- ,RESTART=
n i %pp
DATEADD=(datefield,number,unit)
DATEDIFF=(datefield 1 ,datefield 2 ,unit)
[c:] p 1 ,l 1 ,f 1yxx ,DATEDIFF,p 2 ,l 2 ,f 2yxx
ADDDAYS
ADDMONS
ADDYEARS TOGREG= f o c
p,l,f yxx , SUBDAYS ,numeric_field,
TOJUL= f o c
SUBMONS
SUBYEARS
NEXTDday
PREVDday
LASTDAYW TOGREG= f o c
p,l,f yxx LASTDAYM ,
TOJUL= f o c
LASTDAYQ
LASTDAYY
PARSE Parameter
The PARSE parameter is used to extract variable-position and variable-length fields from
records and place the resultant data into fixed-length parsed fields. See “PARSE Parameter
(Optional)” on page 2.210.
IFTHEN Parameter
The IFTHEN parameter is used to conditionally reformat records. See “IFTHEN Parameter
(Optional)” on page 2.198.
OVERLAY Parameter
The OVERLAY parameter is used to reformat only selected portions of records. See
“OVERLAY Parameter (Optional)” on page 2.209.
FINDREP Parameter
The FINDREP parameter provides the ability to find and replace one or more constants in
a record. A constant to be searched for can be specified as a character or hexadecimal string
and its replacement constant can be either a character, hexadecimal or null string. See
“FINDREP Parameter (Optional)” on page 2.192 for details.
FIELDS/BUILD Parameter
The FIELDS parameter specifies fields to be included in the output record. (BUILD is an
alias for FIELDS.)
Data field specification is defined in “Data Fields (p,l) or (%pp) Subparameters” on page
2.135. For the specification of literal fields, see “Literal Fields Subparameters” on page
2.164. For the specification of function fields, see “Function Field Subparameters” on page
2.170.
• Change an input field to a replacement value in the reformatted output record if the
input field equals a search constant. The replacement value can be a constant or
another field from the input record.
• Change the case of EBCDIC letters from lowercase to uppercase or vice-versa, translate
ASCII characters to EBCDIC ones or vice-versa, or transform data to printable
hexadecimal (0-9 or A-F) or binary (0 or 1), or vice-versa, or translate data based on an
alternative collating sequence (ALTSEQ) table in effect.
• Convert SMF date and time formats to standard date and time formats.
The figure below illustrates how the FIELDS subparameters should be specified and
describes their functions. For information on the EDIT, LENGTH, Mm, and SIGNS subpa-
rameters, see “How to Convert Numeric Data” on page 2.154 .
,f o [,LENGTH=n]
,TO = f o [,LENGTH=n]
expression , Mm
, M0
[,SIGNS=(...)] [,LENGTH=n]
, EDIT=(...)
,a
,CHANGE=(........) [,NOMATCH=(....)]
,JFY=(....)
,SQZ=(....)
p,l ,f yxx (c)
%pp ,f P
y 2f
[c:]
,DT = m 1 m 2 m 3 m 4
,f yxx
,DTNS = xyz
,HEX
LTOU
UTOL
ATOE
p [,l] ETOA
%pp ,TRAN= HEX
UNHEX
BIT
UNBIT
ALTSEQ
Each data field specified in the FIELDS parameter is identified either by its position p
and length l or by its %pp identifier for parsed fields.
p For INREC, the position value indicates the first byte of the field
relative to the beginning of the input record after E15 processing, if
specified, has completed. For OUTREC, the position value indicates
the first byte of the field after both E15 and INREC processing, if
specified, have completed. If the OUTREC parameter of the OUT-
FIL control statement is used, the position value refers to the
record after E35 processing as well. The field must begin on a byte
boundary.
l The length value indicates the length of the field. The length must
be an integer number of bytes.
c: Use the c: subparameter to define the column in which the field should begin. MFX
will add the appropriate number of blanks to achieve the proper alignment. This
subparameter can be specified for all types of fields.
p,l,f
i
%pp,f i
+n
-n
''expression '' [,''operator'',''expression ''
1 2
p,l,fi This specifies the position, length, and format of an input field. (See
the description of fi below for details.)
%pp,fi Identifies a fixed-length parsed field and format. (See the descrip-
tion of fi below for details.)
Once an expression has been defined, its value can either be con-
verted to a numeric output data format or to a printable numeric
format using editing masks. See “How to Convert Numeric Data” on
page 2.154. The default is to use the M0 editing mask to create
printable output. The number of digits in an expression is defined
to be 31 unless the expression is a simple p,l,fi field.
+10
10,2,Y2Z
+10,ADD,10,2,Y2Z
1,4,ZD
10,2,PD
+30
1,4,ZD,ADD,10,2,PD
+30,MUL,(1,4,ZD,ADD,10,2,PD)
+30,MUL,(1,4,ZD,ADD,10,2,PD),MIN,(5,5,ZD,DIV,+100)
(+30,MUL,(1,4,ZD,ADD,10,2,PD)),MIN,(5,5,ZD,DIV,+100)
MUL multiplication
DIV division
MOD modulus
ADD addition
SUB subtraction
fi Use this parameter together with p,l to define the input format of a
numeric field that is part or all of an expression. The expression
will then be converted to either another numeric data format or to a
printable format. In such cases, indicate the format of the data field
that is to be converted by replacing fi with BI, FI, FL, PD, ZD,
CSF/FS, PD0, SFF, UFF, one of the SMF formats (DT1, DT2, DT3,
TM1, TM2, TM3, and TM4), time-of-day (TOD) formats (DC1, DC2,
DC3, TC1, TC2, TC3, TC4), extended time-of-day (ETOD) formats
(DE1, DE2, DE3, TE1, TE2, TE3, TE4), or one of the year data for-
mats (Y2B, Y2C, Y2D, Y2P, Y2S, Y2Z, Y2T, Y2U, Y2V, Y2W, Y2X,
Y2Y, Y4T, Y4U, Y4V, Y4W, Y4X, Y4Y).
Also use this parameter when a 2-digit packed decimal year value is
to be expanded to a 4-digit packed decimal value. In such cases
replace fi with Y2ID or Y2IP. The Y2ID and Y2IP formats cannot be
used to form complex arithmetic expressions and do not allow the
specification of mask (Mm), EDIT, SIGNS, or LENGTH.
SIGNS=(s1,s2,s3,s4) Use the SIGNS subparameter to specify the signs that will appear
before or after the edited number. For details, see “SIGNS Subpa-
rameter” on page 2.181.
LENGTH=n Use the LENGTH subparameter to alter the length of the output
field. This is normally determined by the number of numeric digits
d and either the data format or the edit pattern and format of the
edited field. For details, see “LENGTH=n Subparameter” on page
2.178.
a Use this subparameter to tell MFX how the field should be aligned
with respect to the start of the output record. Replace a with H, F,
or D to specify halfword (H), fullword (F), or doubleword (D) align-
ment. The alignment itself actually takes place after the column
designation. It will automatically pad any provided field with the
JFY=(...) Use the JFY subparameter to specify that an input field be pro-
cessed for left-justification or right-justification for the output
record. For left-justification, leading blank characters are elimi-
nated; the remaining characters are shifted left; if necessary, blank
characters are introduced to the right. For right-justification, trail-
ing blank characters are eliminated; the remaining characters are
shifted right; if necessary, blank characters are introduced to the
left. Options include introducing new leading and trailing nonblank
characters; eliminating previous leading and trailing nonblank
characters; and changing the length of the field in the output
record. For a complete description and options, see “JFY Subparam-
eter” on page 2.186.
SQZ=(...) Use the SQZ subparameter to specify that an input field be pro-
cessed for “left-squeezing” or “right-squeezing” for the output
record. SQZ includes the justification functions of the JFY subpa-
rameter but adds elimination of all blank characters in the input
field and additional options for selecting and replacing blank and
nonblank characters, which include introducing leading and trail-
ing nonblank characters; replacing user-specified nonblank charac-
ters with blank characters prior to squeeze operation; replacing
blank characters with user-specified nonblank characters; retaining
blank characters between paired apostrophes and paired quotes;
and changing the length of the field in the output record. For a com-
plete description and options, see “SQZ Subparameter” on page
2.189.
HEX Use the HEX subparameter to convert a record field to its hexadeci-
mal representation. Specify this subparameter immediately after
the position p and the length l of the field to be converted. Specify
p,l,HEX for both fixed-length records and the fixed-length portion of
variable-length records. Specify p,HEX for the variable-length por-
tion of variable-length records. Starting in position p of the input
record, for a length of l, each byte will be converted to its hexadeci-
mal representation. Note that in the reformatted record, the con-
verted field will be twice the length of the original field.
TRAN Use this subparameter to change the case of EBCDIC letters from
lowercase to uppercase or vice-versa, translate ASCII characters to
EBCDIC ones or vice-versa, transform data to printable hexadeci-
mal (0-9 or A-F) or binary (0 or 1), or vice-versa, or translate data
based on an alternative collating sequence (ALTSEQ) table in
effect. Specify this subparameter immediately after the position p
and the length l of the field to be converted. Specify p,l,TRAN for
both fixed-length records and the fixed-length portion of variable-
length records. Specify p,TRAN for the variable-length portion of
variable-length records. Starting in position p of the input record,
for a length of l, each byte will be converted as per specification.
LTOU
UTOL
ATOE
ETOA
TRAN= HEX
UNHEX
BIT
UNBIT
ALTSEQ
fy2f(c) Use this subparameter together with the p,l elements to indicate
the conversion of a full-date field to a printable date with separator
character(s). The “c” represents the separator and can be any char-
acter except a blank. For Y2x fields, the year portion of the date is
converted to a 4-digit year using the century window defined by the
CENTWIN parameter. The century window is not used for the spe-
cial values, which are expanded with characters of the proper for-
mat. (See Table 19 on page 2.146.)
yyxx 4 yyyy/xx
yyxxx 5 yyyy/xxx
yyxxxx 6 yyyy/xx/xx
yyxxx 3 yyyy/xxx
(X'yyxxxs')
yyxxxx 4 yyyy/xx/xx
(X'0yyxxxxs')
xxyy 4 xx/yyyy
xxxyy 5 xxx/yyyy
xxxxyy 6 xx/xx/yyyy
xxxyy 3 xxx/yyyy
(X'xxxyys')
xxxxyy 4 xx/xx/yyyy
(X'0xxxxyys')
f y2f P Use this subparameter together with the p,l elements to indicate
the conversion of a full-date field to a packed decimal format. The
year portion of the date is converted to a 4-digit year using the cen-
tury window defined by the CENTWIN parameter. The century
window is not used for the special values, which are expanded with
characters of the proper format. See Table 20 on page 2.147.
yyxx 4 X'0yyyyxxC'
yyxxx 5 X'yyyyxxxC'
yyxxxx 6 X'0yyyyxxxxC'
yyxxx 3 X'yyyyxxxC'
(X'yyxxxs')
yyxxxx 4 X'0yyyyxxxxC'
(X'0yyxxxxs')
xxyy 4 X'0xxyyyyC'
xxxyy 5 X'xxxyyyyC'
xxxxyy 6 X'0xxxxyyyyC'
xxxyy 3 X'xxxyyyyC'
(X'xxxyys')
xxxxyy 4 X'0xxxxyyyyC'
(X'0xxxxyys')
,DT [ = m 1 m 2 m 3 m 4
f y2f ,f y4f
,DTNS = m 1 m 2 m 3 Use this subparameter together with the p,l elements to
indicate the conversion of a full-date field to a printable Grego-
rian date. The resultant field can be created with a separator
character by specifying the DT subparameter or without a sepa-
rator by specifying the DTNS subparameter. For Y2x fields, the
year portion of the date is converted to a 4-digit year using the
century window defined by the CENTWIN parameter. Invalid
input date values will be converted to all nines in the digit fields.
All full-date Y2x and YYx fields are vald input fields. (See page
2.141)
The field for this form requires 8 bytes for a 2-digit year
representation and 10 bytes for a 4-digit year represen-
tation. The M,D, and Y or 4 may only appear once in the
mask.
The field for this form requires 6 bytes for a 2-digit year
representation and 8 bytes for a 4-digit year representa-
tion. The M, D, and Y or 4 may only appear once in the
mask.
,YD [ = m 1 m 2 m 3 Use this subparameter together with the p,l elements to indicate
f y2fg
,YDNS = m 1 m 2 the conversion of a full-date Gregorian date field to a printable
Julian date. The resultant field can be created with a separator
Y2T yymmdd 6
Y2V X'0yymmdds' 4
Y2W mmddyy 6
Y2Y X'0mmddyys' 4
The field for this form requires 6 bytes for a 2-digit year
representation and 8 bytes for a 4-digit year representa-
tion. The D and Y or 4 may only appear once in the
mask.
The field for this form requires 5 bytes for a 2-digit year
representation and 7 bytes for a 4-digit year representa-
tion. The D and Y or 4 may only appear once in the
mask.
Full-date year fields can be converted to other full-date year-field formats using the
TOJUL and TOGREG parameters. For printable output formats, you may insert a separa-
tor character. Input and output formats may be either 2-digit years (Y2x fomats) or 4-digit
years (Y4x formats). When expanding a 2-digit year field to a 4-digit year field, CENTWIN
processing is used to determine the high-order yy. Full-date year fields can also be con-
verted to an output field that is an indicator of the day of the week of the field using the
WEEKDAY parameter. The eligible input formats are:
Y2T 5 C'yyddd'
Y2T 6 C'yymmdd'
Y2W 5 C'dddyy'
Y2W 6 C'mmddyy'
Table 22. Eligible Input Date Formats for TOJUL, TOGREG, and WEEKDAY
Y4T 7 C'yyyyddd'
Y4T 8 C'yyyymmdd'
Y4W 7 C'dddyyyy'
Y4W 8 C'mmddyyyy'
Table 22. Eligible Input Date Formats for TOJUL, TOGREG, and WEEKDAY
SUN SUNDAY 1
MON MONDAY 2
TUE TUESDAY 3
WED WEDNESDAY 4
THU THURSDAY 5
FRI FRIDAY 6
SAT SATURDAY 7
If you are not using the CONVERT option to convert variable-length records to fixed-length
records, you must observe these rules when you specify the FIELDS parameter for vari-
able-length records:
• Remember to specify 4 bytes for the Record Descriptor Word in the first output field.
You can include the 4 bytes in the length value of the first field if the first field in the
original data record is also the first field specified in the FIELDS parameter.
• To include any portion of the variable part of the input records, specify a position value
without a length value as the last entry. The only subparameters you can specify after
the position value are the HEX and TRAN conversion subparameters. (Refer to the
FIELDS subparameters sections on HEX and TRAN on pages 2.143 and 2.144.)
• If INREC or OUTREC processing changes the output record length, the contents of the
Record Descriptor Word will be automatically revised by the sort.
One of the most important functions of OUTREC processing is to convert a numeric data
field or an expression to either an output numeric data format or a printable format with
editing capabilities. OUTREC processing can convert 2-digit year fields into 4-digit year
fields, as well as any 2-digit or 4-digit year full-date field into any other full-date field,
including conversion between Julian and Gregorian formats. For details on converting 2-
digit year data, see “Converting Year Data with Century Window Processing on INREC,
OUTREC, or OUTFIL OUTREC” on page 2.160. When a single numeric field defined by
p,l,fi is to be converted to a printable format without editing, the format and length of the
field determine the length of the output field, as illustrated in the following two tables.
Data Conversion
ZD n n
PD n 2n-1
BI, FI 1 3
BI, FI 2 5
BI, FI 3 8
BI, FI 4 10
BI, FI 5 13
BI, FI 6 15
BI, FI 7 17
BI, FI 8 20
FL 4 or 8 20
Y2ID 1 2 bytes
Y2IP 2 3 bytes
For full-date formats, the number of bytes in the input field can vary. The following table
shows input lengths for full-date formats and the resulting output length:
Y2T 3 5
4 6
5 7
6 8
Y2U 2 5
3 7
Y2V 3 6
4 8
Y2W 3 5
4 6
5 7
6 8
Y2X 2 5
3 7
Y2Y 3 6
4 8
Y4T 7 7
8 8
Y4W 7 7
8 8
Y4U 4 7
Y4V 5 8
Y4X 4 7
Y4Y 5 8
For any other type of expression (those that are not a simple p,l,fi), MFX internally main-
tains a 31-digit number. The number of digits that are used for conversion or editing
depends upon the lengths of the fields used in the expression. For more information, see the
description of expression in the section “The following describes the c: subparameter:” on
page 2.138.
If all fields in the expression conform to the following, then 15 digits will be used. If any
field in the expression exceeds these length values, 31 digits will be used for editing or con-
version. Note that full-date formats in an expression (not a simple p,l,f) are treated as pro-
viding a 15-digit value when evaluating the following rules.
PD fields 1 to 8 bytes
ZD fields 1 to 15 bytes
Table 28. Field Lengths That Produce a 15-Digit Default Output Length
If you specify no other FIELDS subparameters, the result will be converted to printable
output according to the default editing mask, M0. See “Mm Subparameter (Editing Masks)”
on page 2.178. Other forms of printable output can be created by using the EDIT, LENGTH,
Mm, and SIGNS subparameters, which allow you to create your own edit patterns, or by
using one of the 27 MFX-supplied editing masks, which are appropriate for many editing
operations.
To convert to a numeric data field, specify an output format of BI, CSF/FS, FD, FI, PD,
PDC, PDF, ZD, ZDC or ZDF. The default output field length is determined for CSF/FS, PD,
PDC, PDF, ZD, ZDC and ZDF formats by Table 29 on page 2.158 . For BI and FI formats,
use Table 30 on page 2.158. For FD, use Table 31 on page 2.159.
The number of digits (d) in the following table is obtained from column 3 of Table 26 on
page 2.155 for an expression that is a single p,l,fi field. For any other type of expression (not
a single p,l,fi), d is either 15 or 31 based upon the fields in the expression. If all fields in the
expression conform to the lengths in Table 28 on page 2.157, then d is 15. If any are longer,
d is 31.
CSF/FS d+1
For BI or FI fields, when the field to be converted is a single p,l,fi field, the default output
length is either 4 or 8 bytes depending upon the format and length of the field to be con-
verted. See Table 30 on page 2.158 to determine the default length.
BI or FI from 1 to 4 bytes 4
BI or FI from 5 to 8 bytes 8
FL either 4 or 8 bytes 8
PD from 1 to 8 bytes 4
PD from 9 to 16 bytes 8
ZD from 1 to 15 bytes 4
ZD from 16 to 31 bytes 8
Table 30. Output Lengths for BI and FI Formats when Input is a Single p,l,fi Field
For any other type of expression (those that are not simple p,l,fi), the output length when
converting to BI or FI is based upon the number of digits available for output. If all fields in
the expression conform to the lengths in Table 28 on page 2.157, then d is 15. If any are
longer, d is 31. When the number of digits available is 15, the output length will be 4. When
the number of digits is 31, the output length will be 8.
Table 31 on page 2.159 displays the formats that can be converted to FD and the default
output lengths.
BI or FI from 1 to 4 bytes 8
BI or FI from 5 to 8 bytes 16
FL either 4 or 8 bytes 16
PD from 1 to 8 bytes 8
PD from 9 to 16 bytes 16
ZD from 1 to 15 bytes 8
ZD from 16 to 31 bytes 16
A 2-digit year-only field, as specified by the Y2B, Y2C, Y2D, Y2P, Y2S, Y2Z, Y2ID, and Y2IP
formats, can be converted on output to a 4-digit year.
The following describes output data conversion for 2-digit year-only date fields:
• The Y2B format specifies 2-digit, 1-byte binary year data that will be converted to a 4-
digit, displayable character format with the appropriate century value. For information
on the range of binary values representing year data with Y2B, see Table 38 on page
2.238.
• The Y2C and Y2Z formats specify 2-digit year data that are in displayable (zoned
decimal) format. The 2-digit year data will be expanded to a 4-digit field containing the
appropriate century value.
• The Y2S format is equivalent to Y2C and Y2Z for valid numeric year data. All three
formats will convert such data to a displayable 4-digit year with the appropriate
century value. Y2S, however, provides additional functionality. For data with binary
zeros (X'00'), a blank (X'40') or binary ones (X'FF') in the first byte, typically to identify
header/trailer records, Y2S will expand the data to 4 bytes, padded in the first 2 bytes
with the same character as found in the first byte of the input field. The fourth byte of
the output field is copied unchanged from the second byte of the input field.
The following symbolic representation shows the treatment in hexadecimal of the three
types of data:
• The Y2D and Y2P formats specify 2-digit year values in packed decimal format. The
processing applied to these fields will create a 4-digit year value converted to a
displayable character format.
• The Y2ID and Y2IP formats take as input the same 2-digit packed decimal year data as
the Y2D and Y2P formats but produce a 4-digit year output that remains in packed
decimal format. Y2ID will convert data from X'yy' to X'ccyy', and Y2IP will convert data
from X'ayys' to X'accyys', where cc is the correct century. (For a description of Y2D and
Y2P formats, see “The Y2D Format” on page 2.239 and “The Y2P Format” on page
2.239.
For full-date fields with 2-digit years (Y2T, Y2U, Y2V, Y2W, Y2X, and Y2Y), the 2-digit por-
tion will expand to the appropriate 4-digit year based on the CENTWIN setting. When
doing a simple p,l,f conversion to a printable format, the output field length can be deter-
mined from Table 27 on page 2.156. Conversion to other formats can be done using the DT,
DTNS, TOJUL or TOGREG parameters.
Note that an additional data format, PD0, which is typically used to process the month and
day portion of packed decimal data, is not affected by CENTWIN processing and will not
convert 2-digit year data to 4-digit years. PD0 can be used with the MFX-supplied edit
mask M11. The year data formats Y2B, Y2C, Y2D, Y2P, and Y2Z or the full-date formats
Y2T, Y2U, Y2V, Y2W, Y2X, and Y2Y can also be used when forming expressions. The 4-digit
year for year data formats or the full date data for the full-date formats will be converted to
an integer for arithmetic calculations. Any expression with these formats can also be
converted to an output numerical data format fo or to printable output by specifying one or
more of the OUTREC FIELDS subparameters (Mm, EDIT, SIGNS, or LENGTH). For
information on using the year data formats for SORT or MERGE field specifications, see
“CENTWIN Parameter (Optional)” on page 2.237 or “CENTWIN Parameter (Optional)” on
page 2.67, respectively. For more information on using the year data formats for INREC or
OUTREC processing, see “Example 5” on page 2.220.
For more information on converting full-date formats, see the descriptions of the fi and
fy2f,(c) parameters on pages 2.140-2.145, Table 19 on page 2.146, and Table 27 on page
2.156.
You can convert SMF date and time formats to standard date and time formats. The follow-
ing table shows the SMF formats and the converted output:
DT1 Z'yyyymmdd'
DT2 Z'yyyymm'
DT3 Z'yyyyddd'
TM1 Z'hhmmss'
TM2 Z'hhmm'
TM3 Z'hh'
TM4 Z'hhmmssxx'
For DTn, the source is the 4-byte packed SMF date value (P'cyyddd'). For TMn, the source
is a 4-byte binary SMF time value.
The c in the date source P'cyyddd' represents the century. It is converted as follows: 0 is
converted to 19, 1 is converted to 20, and 2 or greater is converted to 21.
The converted output is a zoned decimal field, where each character in the table represents
a single byte. For TM4, xx represents hundredths of a second.
The MFX predefined edit masks (M0-M26) or specified edit patterns can be used to edit the
converted date and time. The default mask is M11.
Notes: A data exception (0C7 ABEND) or an inaccurate ZD date can occur if an SMF date
is not valid. An inaccurate ZD time can occur if an SMF time is not valid. SMF dates and
times are processed as positive values.
For an example of an OUTREC control statement that converts SMF formats, see Figure
123 on page 2.220.
The time of day data (TOD) and time of day data extended format (ETOD) created by the
STCK or STCKE hardware instruction can be interpreted to produce several variations of
date and time values. The formats DCn, TCn, DEn, and TEn specify what information is to
be extracted from the TOD value and presented for use in an expression. This data can
either be directly used for conversion to a printable value or another data format or used as
an individual term in an expression. The system service STCKCONV is used to perform the
conversion to the desired format.
The following table describes the available formats and the output format of the data that
is extracted from the TOD or ETOD field. In all cases, the input is an 8-byte field. For TOD
formats (DCn and TCn), the entire TOD field is used. For ETOD formats (DEn and TEn),
the position specified should reflect the first 8 bytes of the ETOD field.
DC1 Z’yyyymmdd’
DC2 Z’yyyymm’
DC3 Z’yyyyddd’
DE1 Z’yyyymmdd’
DE2 Z’yyyymm’
DE3 Z’yyyyddd’
TC1 Z’hhmmss’
TC2 Z’hhmm’
TC3 Z’hh’
TC4 Z’hhmmssxx’
TE1 Z’hhmmss’
TE2 Z’hhmm’
TE3 Z’hh’
TE4 Z’hhmmssxx’
The MFX predefined edit masks (M0-M26) or specified edit patterns can be used to edit the
converted date and time. The default mask is M11.
Spaces (X), hexadecimal digits (X'hhhh...hh'), literal strings (C'literal string'), and binary
zeros (Z) can also be specified in the FIELDS parameter. Each of these entries can be pre-
ceded by an 'n' value which indicates that a specified number of spaces, hex digits, literal
strings, or binary zeros should be inserted in the output record. Additionally, you can insert
the date and time, or the date with an offset, of your MFX run into your records.
nX'hhhh...hh' Use the nX'hhhh...hh' entry to specify that n copies of hex digits or
hex digit strings should be inserted in the output record. (Each hh
pair is 1 byte of output.) The repetition factor n may be any number
from 1 to 4095 inclusive.
nC'literal string' Use the nC'literal string' entry to specify that n copies of literal
strings should be inserted in the output record. The repetition fac-
tor n may be any number between 1 and 4095 inclusive. An apostro-
phe within a literal string must be specified with a double
apostrophe (e.g., C'O''LEARY').
You can insert the date and time, or the date with an offset, of your MFX run into your
records. Table 34 (“Run-time Constants”) on page 2.167 shows the constants generated by
the run-time date and time parameters.
A 'C' in the output format denotes a character constant. A 'P' denotes a packed decimal con-
stant, which contains a positive sign and a leading zero when padding is necessary. A '(c)' in
the parameter represents a separator character.
Optionally, you can create an offset of the current date. The offset takes the form {±}nnnn,
where '+' indicates a date after the current date and '–' indicates a date before the current
date. 'nnnn' is the date offset. The range is 0 to 9999, which represents the number of days
to be added or subtracted from the current date; or 0 to 999, which represents the number
of months to be added or subtracted from the current month for DATE2, DATE2P, or
DATE2(c).
&TIME C'hh:mm:ss' 8
&TIME1 C'hhmmss' 6
&TIME1(c) C'hhcmmcss' 8
&TIME1P P'hhmmss' 4
&TIME2 C'hhmm' 4
&TIME2(c) C'hhcmm' 5
&TIME2P P'hhmm' 3
&TIME3 C'hh' 2
&TIME3P P'hh' 2
For example, to print the date with the form yy-mm-dd, specify
&DATE=(YMD-). For December 31, 1997, the date would appear
as “97-12-31.”
The field for this form of &DATE requires 8 bytes for a 2-digit
year representation and 10 bytes for a 4-digit year. The M, D, and
Y or 4 may only appear once in the mask. All four positions must
be specified.
Optionally, you can create an offset of the current date. See “Gen-
erating Run-time Date and Time Constants” on page 2.164 for a
description.
Optionally, you can create an offset of the current date. See “Gen-
erating Run-time Date and Time Constants” on page 2.164 for a
description.
&TIME=(hp) This form of the &TIME subparameter generates the current sys-
tem time of day and controls the formatting of the time. You can
print the time in 24-hour or 12-hour formats and specify the sepa-
rator character between the hours, minutes and seconds.
&TIMENS=(tt) This form of the &TIMENS subparameter specifies that the cur-
rent time is to appear in the output record in the form 'hhmmss'
(24-hour time) or 'hhmmss xx' (12-hour time). If tt is 24, the time
is to appear in the form 'hhmmss' (24-hour time) where hh repre-
sents the hour (00-23), mm represents the minutes (00-59), and ss
represents the seconds (00-59).
Optionally, you can create an offset of the current date. See “Gen-
erating Run-time Date and Time Constants” on page 2.164 for a
description.
Optionally, you can create an offset of the current date. See “Gen-
erating Run-time Date and Time Constants” on page 2.164 for a
description.
The function fields allow you to insert a sequence number into your output record, to add or
subtract values from date fields, to compute the difference between two date fields, and per-
form other date field functions.
The figure below illustrates how the function subparameters should be specified and
describes their functions.
1 1 (p,h)
SEQNUM,1,f ,START= --- ,INCR= --- ,RESTART=
n i %pp
DATEADD=(datefield,number,unit)
DATEDIFF=(datefield 1 ,datefield 2 ,unit)
ADDDAYS
ADDMONS
ADDYEARS TOGREG= f o c
p,l,f yxx ,
[c:] SUBDAYS
,numeric_field,
TOJUL= f o c
SUBMONS
SUBYEARS
NEXTDday
PREVDday
LASTDAYW TOGREG= f o c
p,l,f yxx LASTDAYM ,
TOJUL= f o c
LASTDAYQ
LASTDAYY
SEQNUM Use SEQNUM to create a sequence number field within the output
record. The length of the field can be from 1 to 16 bytes and can be
represented in either BI, PD, or ZD formats. A starting value and
an increment can be specified for the field. In addition, the sequence
numbering can be restarted when the value in a specified field
changes.
Example 1
OUTREC FIELDS=(.....DATEADD=(10,8,DT=(J4-),13,WEEK),.....)
Column 10 contains a Julian date in the form ddd-yyyy and 13 weeks are to be added to it
to create the output field.
Example 2
OUTREC FIELDS=(.....DATEADD=(10,4,DTNSP=(YMD),-30,DAY),.....)
Column 10 contains a Gregorian date in the form X’0yymmdds’ and 30 days are to be sub-
tracted from it to create the output field.
Example 3
OUTREC FIELDS=(.....DATEADD=(10,6,DTNS=(M4),3,MONTH),.....)
Column 10 contains a month/year date field in the form mmyyyy and 3 months are to be
added to it to create the output field.
DATEDIFF Use DATEDIFF to compute the interval between two date values. It
returns a numeric value that can be used in expressions or format-
ted with an EDIT pattern; the default formatting will be with mask
M0 for 15 digits, generating a 16-byte field. The value is calculated
by counting the number of unit boundaries between the two date
values. Therefore, there is no rounding. For example, when unit is
DAY, the value is the number of midnights between datefield1 and
datefield2 - midnight is the boundary between one day and the
next. Similarly, the week boundary is defined as midnight on Sun-
day; the month boundary is midnight of the last day of the month,
and so on.
Example 1
OUTREC FIELDS=(.....DATEDIFF=(10,8,DT=(J4-),20,4,DTNSP=(YDM),
DAY),.....)
Column 10 contains a Julian date in the form ddd-yyyy, column 20 contains a Gregorian
date in the form X’0yyddmms’ and the difference in days is desired.
Example 2
OUTREC FIELDS=(.....DATEDIFF=(10,6,DTNS=(YMD),20,5,DT=(YM/),
MONTH),M12,LENGTH=5,.....)
Column 10 contains a Gregorian date in the form yymmdd and column 20 contains a
year/month date in the form yy/mm. The difference in months is desired, although it is not
known which the earlier date is (a negative result would indicate that it was datefield1).
The result will be in a 5-byte field with a leading sign, using the M12 editing mask.
Example 3
INREC FIELDS=(.....DATEDIFF=(2013/06/08,&DATE,DAY),.....)
The number of days from the current date until June 8th, 2013 is needed.
For the following date arithmetic functions, the eligible p,l,f fields are the full-date fields
from Table 27 on page 2.156.
p1,l1,f1yxx,DATEDIFF,p2,l2,f2yxx
This is an alternate usage of DATEDIFF for full-date fields only. This alternate usage pro-
duces the difference between the two dates in days only, and the output is a printable field
rather than a numerical value. The output field is 8 bytes, where the first byte is a + or -
sign byte, followed by 7 digits. The sign byte will be + if the first field is greater than or
equal to the second field, otherwise the byte will be - . A parsed field can be used for p1,l1
but not for p2,l2..
ADDDAYS
ADDMONS
ADDYEARS TOGREG= f o c
p,l,f yxx ,numeric_field,
SUBDAYS TOJUL= f o c
SUBMONS
SUBYEARS
These date functions are used to add or subtract any of days, months, or years from the
input field to create a formatted output date field.
When the unit is months or years, a valid output date will always be created. For example,
subtracting one month from a March 30th date will result in February 28th in a non-leap
year and February 29th in a leap year.
The numeric_field can be a number (+n or -n) or a numeric field (p,l,f) in the record, where f
can be BI, FI, ZD, PD, FS, UFF, or SFF with a valid length for those formats. The value of
the numeric_field must be from -3652058 to +3652058 for ADDDAYS or SUBDAYS, from -
119987 to +119987 for ADDMONS or SUBMONS, or from -9998 to +9998 for ADDYEARS
or SUBYEARS.
The output field is formatted by either the TOJUL or TOGREG parameter as described on
page 2.152.
NEXTDday
PREVDday
LASTDAYW TOGREG= f o c
p,l,f yxx ,numeric_field,
TOJUL= f o c
LASTDAYM
LASTDAYQ
LASTDAYY
These date functions are used to compute new calendar dates based on a full-date input
field. The input p,l can also be a parsed field.
The NEXTDday function computes the next specified weekday date relative to the input
date. ''day'' in the keyword can be any of SUN, MON, TUE, WED, THU, FRI or SAT, such as
NEXTDSAT.
The PREVDday function computes the previous specified weekday date relative to the
input date. See above for valid ''day'' values.
LASTDAYW computes the Friday date of the week of the input date, where Friday is con-
sidered the last day of the week.
LASTDAYM computes the last date of the month of the input date.
LASTDAYQ computes the last date of the quarter of the input date.
LASTDAYY computes the lasst date of the year of the input date.
The output field is formatted by either the TOJUL or TOGREG parameter as described on
page 2.152.
EDIT Subparameter
The EDIT subparameter lets you create your own edit patterns for converted numeric data.
An edit pattern can consist of:
The characters used to represent significant or insignificant digit selectors are determined
by the keyword EDIT. If EDIT is specified, the letter I represents leading insignificant dig-
its which will print as blanks if the digits are zeros, and the letter T represents significant
digits (digits that will print in their true form, even as leading zeros).
The keyword EDIT can be specified with replacements for the letters I and/or T. Any print-
able character can be used as a replacement character. This replacement makes available
to the user a pattern which encompasses all printable characters.
The figure below illustrates the concept of replacing the insignificant and significant digit
selectors I and T with other characters.
EDxy=
where:
When a blank, quotation mark or unbalanced parenthesis appears within an EDIT pattern,
the entire pattern must be enclosed within single quotation marks. Balanced parentheses
need not be enclosed within quotation marks. A single quotation mark within the pattern
(i.e., an apostrophe) must be specified as two apostrophes.
All other characters are printed as specified in the edit pattern, with the following excep-
tions:
• Any character specified after the first leading insignificant digit selector and before the
first significant digit selector will print as a blank, unless a previously selected digit
was non-zero.
• Any character specified after the last significant digit selector will print as a blank if
the edited number is positive.
• Any character or character string specified before the first leading insignificant digit
selector, including a leading sign character, will print to the immediate left of the first
significant digit. The appropriate number of leading blanks will be supplied, assuring
that the total number of characters in the printed field corresponds to the total number
of characters in the edit pattern.
• Any leading insignificant digit selector specified after the first significant digit selector
will be treated as a significant digit selector.
• The sign replacement character appearing as the first and/or last character of the
pattern is replaced as per the SIGNS subparameter.
LENGTH=n Subparameter
Use the LENGTH=n subparameter to alter the default length of the output field data. The
maximum value which can be specified for n is 44.
• When an editing mask is used, the default length is determined by the edit pattern and
the format of the field. If LENGTH=n is not specified, the length is equal to the number
of characters specified in the edit pattern. If LENGTH=n is specified, the edit pattern
will either be truncated on the left or padded with blanks on the left so that the length
of the pattern equals the n value.
The maximum value that can be specified for n when editing masks are used is 44.
• When output data format fo is used, the default length is determined based on the
expression characteristics. For more information, see “How to Convert Numeric Data”
on page 2.154. If LENGTH=n is specified, the output data will either be truncated on
the left or padded on the left with zeros (or blanks for CSF/FS) of the appropriate
format to a length of n. For FD output format, only 4, 8 or 16 may be specified for the
length.
For other output formats, the maximum value that can be specified for n when an out-
put data format fo is used is 44.
MFX provides editing masks to simplify the more common editing operations.
M6 III-TTT-TTTT 12
M7 TTT-TT-TTTT 11
M8 IT:TT:TT 8
M9 IT/TT/TT 8
M10 IIIIIIIIIIIIIIT d
M11 TTTTTTTTTTTTTTT d
M14 SIII III III III IITS (' ',(,' ',)) d+2 + [(d-1)/3]
M15 III III III III IITS (,,' ',-) d+1 + [(d-1)/3]
M16 SIII III III III IIT (' ',-) d+1 + [(d-1)/3]
M20 SI III III III IIT,TTS (' ',(,' ',)) d+2 + [d/3]
Notes:
• If neither Mm nor EDIT is specified, M0 is used to edit BI, FI, FL, PD, PD0, ZD, and
CSF/FS fields and M11 is used to edit DTn, DCn, DEn, TMn, TCn, and TEn fields.
• The letter d represents the number of resulting digits after data conversion. The mask
patterns in the Pattern column shows the resulting digits when the number of digits is
15. (See Table 26 on page 2.155.) When the number of digits to be displayed is greater
than 15, the masks will be extended on the left with the required digit selectors and
constant characters.
• The bracket symbols indicate that only the integer part of this division should be
retained.
Table 35 on page 2.179 illustrates the following for each of the available masks.
• Edit pattern.
• Length. If an MFX editing mask is used for totaled or subtotaled data, the length of the
output field is determined from the length of the field and by using Table 17 on page
2.110, not by the specified length of the input field. The subparameter LENGTH can be
used to override the length of the output field.
The edit patterns use the same symbolic letters used in the EDIT subparameter. Leading
insignificant digits are represented by the letter I; significant digits are represented by the
letter T. Leading or trailing sign replacement characters are represented by the letter S. All
other characters print as they appear in the pattern.
The SIGNS illustrated for each mask follow the format requirements of the SIGNS subpa-
rameter. You can specify the SIGNS subparameter to selectively override the signs for a
particular mask. For example, if you specify mask M4 and also specify SIGNS=(' '), a lead-
ing blank will print instead of a plus sign if the number is positive. However, a leading
minus sign will print if the number is negative because the leading negative sign specified
in the editing mask has not been overridden.
The lengths in the table represent the length, in bytes, of the mask. The lengths of masks
M0-M5 and M10-M26 are determined, in part, by the number of digits d. See Table 26 on
page 2.155 to determine the number of digits for each type of numeric field.
SIGNS Subparameter
The SIGNS subparameter specifies the sign(s) that will appear before or after the edited
number.
The sign replacement character, normally 'S', has special meaning if it appears as the first
or last character in an edit pattern. In these positions, the sign replacement character will
be replaced, as appropriate, by the characters specified by the SIGNS subparameter.
SIGNS=(s1,s2,s3,s4)
where:
Because the SIGNS subparameter contains four positional values, commas must be used to
indicate embedded, unspecified values. Each of the four values can contain one, and only
one, character; specified characters must be separated by commas.
A blank, comma, quotation mark and unbalanced parenthesis used as a SIGNS character
must be enclosed within apostrophes. An apostrophe used as a SIGNS character must be
specified as two apostrophes enclosed within apostrophes ('''').
When the SIGNS subparameter is specified, the letter 'S' is normally used as the sign
replacement character in the user-supplied edit pattern. The user can change the last letter
of the keyword SIGNS in order to specify another character as the sign replacement charac-
ter. For example, if the user specifies SIGNX instead of SIGNS, the letter 'X' becomes the
sign replacement character in the user-provided edit pattern.
If the user specifies a sign replacement character in the edit pattern but does not specify a
value in the corresponding position in the SIGNS parameter, a blank will be assumed. For
example, if the user specifies the following:
EDIT=(IITT.TTS),SIGNS=(,,,-)
then a trailing minus sign will print if the number is negative and a trailing blank will
print if the number is positive.
The SIGNS subparameter can also be used to override the sign values in MFX-provided
editing masks.
CHANGE Subparameter
The CHANGE subparameter changes an input field to a replacement value in the reformat-
ted output record if a specified field equals a search constant.
p,l
[c:] ,CHANGE=(o,srch 1 ,repl 1 [,srch 2 ,repl 2 ,...srch n repl n
%pp
nmrepl
,NOMATCH=( r,n )
%pp
Multiple search-replacement paired values, with different data formats, can be specified on
a CHANGE subparameter. Note the following rules for mixing data formats:
formats; thus, if one search constant on a CHANGE subparameter is binary, all other
search constants on that subparameter must also be binary.
p,l The normal MFX position-length designation that specifies the search field.
When this search field matches a search constant, the input field will be
changed in the output to a replacement value.
%pp Identifies a fixed-length parsed field that specifies the search field. When
this field matches a search constant, the input field will be changed in the
output to a replacement value.
srch The search constant to which the search field is compared. Permissible for-
mats are character string (C'x...x'), hexadecimal string (X'x...x'), or a binary
byte (B'bbbbbbbb'). When the search constant matches the search field, the
input field will be changed to an output replacement value.
If the search constant is longer than the length of the search field, the con-
stant will be truncated to the length of the search field. If the search con-
stant is shorter, the constant will be padded on the right. Character strings
are padded with blanks (X'40'). Hexadecimal strings are padded with zeros
(X'00'). Binary strings are neither truncated nor padded since only one-byte
strings are permissible.
repl The replacement value to which the input field is changed in the reformat-
ted output record when the search field matches a search constant. The
replacement value can either be a constant, a field from the input record, or
a fixed-length parsed field.
mrepl
j,k
%pp
j,k The position j and the length k of an input field that will be
inserted in the output record. k must be at least 1 and cannot be
greater than the length o specified for the output replacement
field. If k is less than o, the field j,k will be padded on the right
with blanks (X'40') to the length o.
NOMATCH Indicates how MFX should respond if the input field does not match a
search constant. If NOMATCH is not specified and no search constant
matches the input field, sort processing will terminate with an error mes-
sage.
nmrepl A replacement constant to which the input field is changed in the reformat-
ted output record when the search field p,l fails to match a search constant.
For details, see the description of the repl variable above.
r,n The position r and length n of an input field that will be inserted in the out-
put record when the CHANGE search field fails to match a search constant.
n must be at least 1. If n is greater than the length o specified for the output
replacement field, the output field r,n will be truncated on the right to
length o. If n is less than o, the field r,n will be padded on the right with
blanks (X'40') to the length o.
%pp Identifies a fixed-length parsed field that will be inserted in the output
record when the CHANGE search field fails to match a search constant.
The length of %pp specified by FIXLEN cannot be greater than the length o
specified for the output replacement field. If FIXLEN is less than o, the %pp
field will be padded on the right with blanks (X'40') to the length o.
OUTREC FIELDS=(16,2,
CHANGE=(13,C'NJ',C'NEW JERSEY',
C'NY',C'NEW YORK',
C'PA',C'PENNSYLVANIA',
C'XX',50,13),
NOMATCH=(C'NOT SUPPORTED'),
8X,
24,1,
CHANGE=(10,B'1.......',C'EAST COAST',
B'0.......',C'WEST COAST'))
In the above example, the FIELDS parameter contains two CHANGE subparameters. The
first CHANGE subparameter changes the input field in columns 1 through 13 to a state
name in the reformatted output record when the search field in column 16 matches a state
code. If the state code is XX, positions 50 through 62 of the input record will be placed in the
output record. If no matches are found, the output field will be 'NOT SUPPORTED.' The
second change subparameter changes the one-byte input field in column 22 to 'EAST
COAST' or 'WEST COAST' in the reformatted output record, depending on the binary con-
tents of the search field in column 24.
The following example illustrates a situation that can arise when using binary search con-
stants. In such cases, more than one search constant may match a search field:
OUTREC FIELDS=(24,1,
CHANGE=(6,B'.....11.',C'SHARE',
B'.....01.',C'UNIQUE'))
Note that in the above example, the search field X'06' would match both binary search con-
stants. In such cases, the first search constant is used, thus the output would be the charac-
ter string 'SHARE'. If the search field were X'02', the output would be the character string
'UNIQUE'.
JFY Subparameter
The JFY subparameter specifies that an input field be processed for left-justification or
right-justification for the output record. The JFY subparameter specifies the following
basic operations:
• If left-justification is specified, leading blank characters are eliminated; all
remaining characters are shifted left; if necessary, blank characters are introduced
to the right to create a fixed-length field.
• If right-justification is specified, trailing blank characters are eliminated; all
remaining characters are shifted right; if necessary, blank characters are
introduced to the left to create a fixed-length field.
• If a variable-length field is requested, all characters are shifted left and trailing
blanks are eliminated.
p,l, SHIFT=LEFT
[c:] JFY=( SHIFT=RIGHT ,LENGTH=n ,PREBLANK=list
%pp, VL
,LEAD=string ,TRAIL=string )
p,l Specifies the beginning byte position p and byte length l of the
input record’s relevant field.
The maximum length of the field is determined from the input field
length and the lengths of any LEAD and TRAIL strings.
11,18,JFY=(SHIFT=LEFT,LENGTH=15,PREBLANK=C'/[]*{}',
LEAD=C'<',TRAIL=C'>')
In the example above, the field (11,18) is specified for left-justification for the output record;
LENGTH changes the output length to 15 bytes to reduce the output field size;
PREBLANK substitutes a blank character for each instance of /, [, ], *, { and } in the leading
and trailing characters before justification; LEAD introduces < to the left of the first
nonblank character in the justified field; and TRAIL introduces > to the right of the last
nonblank character in the justified field.
The following example illustrates the use of JFY with the VL subparameter:
OUTFIL OUTREC=(5,40,JFY=(VL),C’,’,45,60,JFY=(VL),C’,’,105,96,
JFY=(VL)),FTOV
SQZ Subparameter
The SQZ subparameter specifies that an input field be processed for “left-squeezing” or
“right-squeezing” for the output record. It includes the justification functions of the JFY
subparameter but adds elimination of all blank characters in the input field and additional
options for selecting and replacing blank and nonblank characters.
p,l, SHIFT=LEFT
[c:] SQZ=( SHIFT=RIGHT ,LENGTH=n ,PREBLANK=list
%pp, VL
p,l Specifies the beginning byte position p and byte length l of the
input record’s relevant field.
SHIFT=LEFT Specifies left-squeezing of the input field. By default, all blank char-
acters are eliminated and all nonblank characters are shifted left; if
necessary, blank characters are introduced on the right side to com-
pensate for the length of the output field. (The default output field
length is equal to the input field length.)
The maximum length of the field is determined from the input field
length and the lengths of any LEAD, MID and TRAIL strings.
11,18,SQZ=(SHIFT=LEFT,LENGTH=30,PREBLANK=C'/[]*{}',
LEAD=C'<',MID=C',',TRAIL=C'>',PAIR=QUOTE)
In the example above, the field (11,18) is specified for left-squeezing for the output record;
LENGTH changes the output length to 30 bytes to accommodate added characters;
PREBLANK substitutes a blank character for each instance of /, [, ], *, { and } throughout
the entire input field before squeezing; LEAD introduces < to the left of the first nonblank
character in the squeezed field; MID substitutes a comma for each group of blank
characters between the first and last nonblank characters; TRAIL introduces > to the right
of the last nonblank character in the squeezed field; and PAIR specifies that all blank and
PREBLANK characters between pairs of quotes remain unchanged.
The CONVERT parameter enables you to convert variable-length records into fixed-length
records.
These records do not require an RDW and will be written to any output file(s) with a
RECFM of F or FB. When using CONVERT, you no longer need to apply the rules for
“Specifying the FIELDS parameter for Variable-Length Records.”
You cannot specify the variable portion of the input records (position without length) when
using CONVERT. However, all data fields need not be present in each record being
CONVERTed, unless a numeric or year data field is specified. That is, blanks will be used
as a default for any missing p,l field bytes, while all p,l,f fields must be present.
When using CONVERT in conjunction with the OUTREC parameter on the OUTFIL
control statement, data fields of any type need not be present, and you may change the
default padding character with the VLFILL parameter. (See the explanations of CONVERT
and VLFILL in the OUTFIL control statement section.)
You may also create multiple output files with different record formats when specifying
CONVERT on the OUTFIL control statement.
The FINDREP parameter allows you to find one or more constants in a record and replace
them with a provided constant.
FINDREP compares the current position in an input record to an input constant, seeking a
match. By default it starts with position 1 for fixed-length records and position 5 for vari-
able-length records. The current position will increase by 1 until a match is found. Once
FINDREP discovers a match at the current position, the output constant will supplant the
input constant, the current position will advance beyond the location of the replaced input
constant, and the process will continue. Bytes appearing after the replaced constants will
be moved either left or right as necessary until the current position reaches the record's
final position and processing ceases.
For fixed-length records if a record needs to be shortened due to a shorter replace constant,
it will be padded with trailing blanks as needed. If a fixed-length record is lengthened,
trailing blank characters will be removed. Variable-length records will have their length
adjusted as appropriate. If a variable-length record exceeds its maximum record length,
trailing blanks will be deleted.
FINDREP processing requires input and output constants to be specified. An input con-
stant can be any of the following: a single hexadecimal string, a repeated hexadecimal
string, a single character string, or a repeated character string. An output constant can be
any of the following: a single hexadecimal string, a repeated hexadecimal string, a single
character string, a repeated character string, or a null string. Permissible syntax expres-
sions for input and output constants are listed below.
• C’string’
• nC’string’
• X’string’
• nX’string’
Note the following considerations for defining input and output constants:
IN=(ic1[,ic2]…[,icn] ) Specifies one or more input constants that will be searched for dur-
ing the FINDREP operation. Each ic specifies an input constant to
search for. See description above on how to specify input constants.
OUT=oc Specifies the output constant that will be used to replace any of the
input constants that are found. oc represents the output constant
used in the replace operation. See description above on how to spec-
ify output constants.
By default, the FINDREP function starts at position 1 for fixed-length records or position 5
for variable-length records and ends processing at the end of the record. The following
options will alter the default FINDREP behavior:
ENDPOS=q Use this option to change the ending position of the FINDREP
operation. The ENDPOS=q option uses the variable q to denote the
last position to scan in the input record. For variable-length
records, q will be reset to 5 if a value less than 5 is specified. When
both ENDPOS=q and STARTPOS=p are defined, if q is less than p,
FINDREP will perform no action for the record. ENDPOS does not
affect the shifting of bytes during the FINDREP operation.
DO=n Use this option to limit the maximum number of times FINDREP
will be performed for a record. The DO=n option uses the n variable
to denote the number of times an input constant is found and
MAXLEN=m Use this option to change the maximum length of the output record,
which has a default of the maximum record length input to
FINDREP. The MAXLEN=m option uses the m variable to denote
the maximum length of the record. MAXLEN can increase or
decrease the record length, except for an IFTHEN FINDREP where
it can only increase the record length. MAXLEN can be used to
increase the record length when the replace constants are longer
than the find constants. For further details, see the "Consider-
ations" section.
Considerations:
• In an OUTFIL statement, you cannot use FINDREP with BUILD, OVERLAY, IFTHEN,
IFOUTLEN, VTOF, CONVERT or VLFILL, although FINDREP within an IFTHEN
clause is permitted.
• After a constant has been replaced at the current position in a single FINDREP option,
no further checks are performed at that position. One FINDREP statement cannot be
used to replace a constant and then replace the original constant’s replacement.
The following examples outline the proper uses of the FINDREP parameter and its subpa-
rameters.
Example 1
Col 1..........................col 60 80
.. WOODCLIFF LAKE, NJ 07677
...... ..NEW ROCHELLE, NY 10801
Col 1..........................col 60 80
.. WOODCLIFF LAKE, NEW JERSEY 07677
.......NEW ROCHELLE, NEW YORK 10801
In the above example, if the values to be replaced were positioned closer to column 80, it
would be possible that the trailing zip code would be pushed past column 80. By default
this would generate an error since only blanks can be truncated from a record. This error
could be avoided by specifying the MAXLEN parameter to extend the record length to
accommodate the new longer replacement literals. The following OUTREC control state-
ment could address this problem:
If non-blank characters after the replacement string are not needed, the OVER-
RUN=TRUNC option can be specified to remove the trailing characters from the record. For
example, the following can be used:
Example 2
In the following example an INREC statement will be used to abbreviate each instance of
‘NEW JERSEY’ and ‘NEW YORK’ in a record when position 24 of the record contains a
X’01’.
INREC IFTHEN=(WHEN=(24,1,BI,EQ,X’01’),
FINDREP=(INOUT=(C’NEW JERSEY’,C’NJ’,C’NEW YORK’,
C’NY’)))
NY,ABC NJ,XYZ,NY
If the records are variable-length, the RDW of the record would be reduced to indicate the
new length after the shorter literals are substituted. If the records are fixed-length, spaces
would be appended to the end of the record to replace the deleted characters.
Example 3:
In the following example, the input constant will be replaced by the output constant with-
out shifting bytes to accommodate the replaced constant. This can be used to replace only a
portion of the input search constant with a new constant. In this example, a portion of the
input constant will be replaced.
OUTREC FINDREP=(IN=(C’CODE=VALID’,C’CODE=INVALID’),
OUT=C’FLAG’,SHIFT=NO)
Note that in this instance where the output constant is shorter than the input constant, the
FINDREP operation will resume at the next character after the output constant rather
than the input constant as would normally be the case.
The IFTHEN parameter employs conditional logic, which enables you to reformat your
records based on specified criteria. Multiple IFTHEN parameters may be specified within
the same control statement and are processed sequentially.
The IFTHEN parameter may be used within the INREC, OUTREC, and OUTFIL control
statements.
,BUILD= fields
,PARSE=(subparm) ,OVERLAY= fields
WHEN=INIT
,FINDREP=(subparm)
,PARSE=(subparm)
WHEN=GROUP,selectoption[,selectoption][,selectoption], PUSH=(pushsubparm)
where selectoption is:
BEGIN=(conditions)
END=(conditions)
KEYBEGIN=(p,l)
RECORDS=n
IFTHEN= ( )
[,PARSE=(subparm)] ,BUILD =(fields)
WHEN=(conditions) ,OVERLAY [,HIT=NEXT]
,FINDREP=(subparm)
,BUILD
WHEN=ANY [,PARSE=(subparm)] ,OVERLAY =(fields) [,HIT=NEXT]
,FINDREP=(subparm)
,BUILD
WHEN=NONE ,PARSE=(subparm) =(fields)
,OVERLAY [,HIT=NEXT]
,FINDREP=(subparm)
At the beginning of IFTHEN processing, a temporary record is created from each of your
input records.
The IFTHEN parameter automatically makes the following changes to the temporary
record to accommodate any adjustments in length. In a variable-length record, the RDW
length is adjusted accordingly. In a fixed-length record, the record is padded with blanks
when necessary. Blanks also replace missing bytes in input fields.
The IFTHEN parameter has two main parts: the WHEN subparameter and a second sub-
parameter. As shown in Figure 109 on page 2.199, the WHEN subparameter may be
WHEN=INIT, WHEN=GROUP, WHEN=(conditions), WHEN=ANY, or WHEN=NONE.
Except for WHEN=GROUP, the second subparameter may be FINDREP, PARSE and
BUILD or OVERLAY. The WHEN subparameter defines a condition that must be satisfied
before the second subparameter is applied to the temporary records. If the WHEN subpa-
rameter condition is not satisfied, then the second subparameter is not applied to the tem-
porary records.
Since IFTHEN parameters refer to the temporary records instead of the input records, all
subsequent IFTHEN parameters within the same control statement will take previous
FINDREP, BUILD or OVERLAY changes into account. Once IFTHEN processing for each
record stops, the temporary record becomes the output record.
You can use %pp parsed fields in IFTHEN expressions. If the %pp field is defined in a
WHEN=INIT, WHEN=(conditions), WHEN=ANY, or WHEN=NONE expression, it can be
used in the IFTHEN BUILD or IFTHEN OVERLAY of that expression. Additionally, for
WHEN=INIT, the %pp fields can be used in any subsequent IFTHEN BUILD or OVERLAY
expression. See “PARSE Parameter (Optional)” on page 2.210 for further description on
PARSE.
• FORMAT=f
• Locale processing
• VLTESTI (during IFTHEN processing,
blanks replace missing bytes in input fields)
• D2 format
• FORMAT=f
• Locale processing
The IFTHEN parameters must be specified such that the WHEN subparameters are in the
following order:
• WHEN=NONE
FINDREP The FINDREP parameter provides the ability to find and replace
one or more constants in a record. A constant to be searched for can
be specified as a character or hexadecimal string and its replace-
ment constant can be either a character, hexadecimal or null string.
Depending on the length of the replacement constant, subsequent
characters will be shifted left or right. For fixed-length records, if
data is shifted left, the record will be padded with blanks as needed.
If data is shifted right, any trailing blank characters will be
removed. Variable-length records will have their length adjusted as
appropriate. If a variable-length record exceeds its maximum
record length, trailing blanks will be deleted.
WHEN=GROUP can be useful for keeping together groups of unlike input records,
enabling them to be correctly sorted.
For instance, if each transaction at a store generates a series of unlike records, and all the
records are collected in a file that needs to be sorted by date and register number,
WHEN=GROUP can generate appropriate sort keys for each record in the group.
A header record (code ‘H’) with a register number and date, detail SKU records (code ’S’)
with an SKU number, unit price and quantity, and a trailer total record (code ’T’) are
generated for each transaction. A file with 20-byte fixed-length records for three
transactions might look like
H 0003 2008/08/17
S 872567 0010.22 001
S 510945 0001.99 003
S 734018 0003.98 002
T 0024.15
H 0005 2008/08/16
S 013298 0000.69 004
S 510945 0017.03 001
T 0019.79
H 0002 2008/08/17
S 212134 0003.49 003
T 0010.47
INREC WHEN=GROUP can be used with BEGIN to identify a header record starting a
group and END to identify a trailer record ending a group. PUSH extends each record by
placing the date and register number from the header record at the end of each record in
the group, followed by a 5-byte group number and a 3-byte record sequence number. This
enables all the records in a group to be sorted together.
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C’H’),
END=(1,1,CH,EQ,C’T’),
PUSH=(21:8,10,31:3,4,35:ID=5,SEQ=3))
The records are then sorted using the new PUSH data.
SORT FIELDS=(21,10,CH,A,31,4,CH,A,35,8,CH,A)
The data added by PUSH can be eliminated from the output data with a simple OUTREC
statement for the original 20 bytes of the record, or by specifying LRECL=20 on the
SORTOUT DD statement, creating the following correctly sorted output.
H 0005 2008/08/16
S 013298 0000.69 004
S 510945 0017.03 001
T 0019.79
H 0002 2008/08/17
S 212134 0003.49 003
T 0010.47
H 0003 2008/08/17
S 872567 0010.22 001
S 510945 0001.99 003
S 734018 0003.98 002
T 0024.15
If desired, a simple report can be created using OUTFIL IFTHEN to identify each different
record type, format it appropriately, and remove the data added by PUSH. SECTIONS is
used to generate a report header for each transaction.
DATE REG# ID
2008/08/16 0005 00002
SKU#: 013298 PRICE: $0000.69 QUANTITY: 004
SKU#: 510945 PRICE: $0017.03 QUANTITY: 001
TOTAL: $0019.79
DATE REG# ID
2008/08/17 0002 00003
SKU#: 212134 PRICE: $0003.49 QUANTITY: 003
TOTAL: $0010.47
DATE REG# ID
2008/08/17 0003 00001
SKU#: 872567 PRICE: $00010.22 QUANTITY: 001
SKU#: 510945 PRICE: $0001.99 QUANTITY: 003
SKU#: 734018 PRICE: $0003.98 QUANTITY: 002
TOTAL: $0024.15
In an OUTFIL control statement, the IFTHEN parameter may be used with FTOV or VLT-
RIM. The IFTHEN parameter may not be used with CONVERT or VTOF. Under the OUT-
FIL control statement, see “FTOV Parameter (Optional)” on page 2.93 for a complete
description of the FTOV parameter and “VLTRIM Parameter (Optional)” on page 2.93 for a
complete description of the VLTRIM parameter.
• Multiple output records are created with the / subparameter. Under the OUTREC
parameter of the OUTFIL control statement, see “[n]/” on page 2.91 for a complete
description of the / subparameter.
OUTREC IFTHEN=(WHEN=INIT,
BUILD=(1,80,1,8,ZD,MUL,+107,DIV,+100,ZD)),
IFTHEN=(WHEN=(81,15,ZD,GT,+10000),
OVERLAY=(81:81,15,ZD,ADD,+0500,ZD),HIT=NEXT),
IFTHEN=(WHEN=(81,15,ZD,GT,+20000),
OVERLAY=(81:81,15,ZD,ADD,+2000,ZD),HIT=NEXT),
IFTHEN=(WHEN=ANY,
OVERLAY=(96:C’*’,97:81,15,ZD,MUL,+15,DIV,+100)),
IFTHEN=(WHEN=NONE,
OVERLAY=(97:81,15,ZD,MUL,+12,DIV,+100))
This OUTREC control statement refers to 80-byte input records containing a salesperson’s
weekly sales in dollars in the first field (1,8,ZD) of each record. There are five IFTHEN
parameters in the example and they reformat each input record as follows:
• The first IFTHEN parameter uses WHEN=INIT to take the sales total in the first field
(1,8,ZD), increase it by 7%, and enter the result in a new 15-byte ZD field in column 81.
• The second IFTHEN parameter uses WHEN=(conditions) to test if the newly adjusted
sales total in the field (81,15,ZD) is over $10,000. If it is, the second IFTHEN parameter
increases the total by $500 and replaces the result in that field.
• The third IFTHEN parameter uses WHEN=(conditions) to test if the newly adjusted
sales total in the field (81,15,ZD) is over $20,000. If it is, the third IFTHEN parameter
increases the total by $2,000 and replaces the result in that field.
• The fourth IFTHEN parameter uses WHEN=ANY to test the second and third
IFTHEN parameters. If one or both WHEN subparameter conditions are satisfied,
indicating that the salesperson is getting a bonus, the fourth IFTHEN parameter
inserts an “*” in column 96 to denote a bonus, calculates a commission rate of 15%, and
enters the result in column 97.
• The fifth IFTHEN parameter uses WHEN=NONE to test the second and third
IFTHEN parameters. If neither WHEN subparameter condition is satisfied, indicating
that the salesperson is not getting a bonus, the fifth IFTHEN parameter calculates a
commission rate of 12% and enters the result in column 97.
The IFOUTLEN parameter overrides the maximum record length, which is automatically
set by the IFTHEN parameter, and changes it to a specified value. The IFOUTLEN param-
eter may only be used in conjunction with the IFTHEN parameter.
IFOUTLEN=n
The IFOUTLEN parameter automatically makes the following changes to the record to
match the new length. A fixed-length or variable-length record longer than n is truncated
to n. In a fixed-length record shorter than n, the record is padded with blanks to reach a
length of n.
The OVERLAY parameter enables you to change particular columns and add fields to the
end of a record without rebuilding the entire record. When using the OVERLAY parameter
you only need to specify the columns you want to change. The rest of the input record
remains unchanged.
The format of the OVERLAY parameter is similar to that of the FIELDS parameter of the
INREC and OUTREC control statements. Under the OUTREC control statement, see
Figure 71 on page 2.134 for the format of the OVERLAY parameter. The following excep-
tions apply:
• In the OVERLAY parameter the length l is always required, unlike one case of the
FIELDS parameter in which l is optional after p.
• In the OVERLAY parameter for a variable-length record, the column value c: is always
required and must be set at 5 or greater, since c: is set to 1 by default and positions 1
through 4 comprise the RDW. The RDW cannot be overlaid.
The OVERLAY parameter automatically makes the following changes to the output record
to accommodate any adjustments in length. In a variable-length record, the RDW length is
adjusted accordingly. In a fixed-length record, the record is padded with blanks when nec-
essary. Blanks also replace missing bytes in input fields.
Modifications to records will be made in the order of the OVERLAY parameters specified. If
you modify the same field more than once, the second and subsequent modifications will
apply to the previously modified field.
OUTREC OVERLAY=(9:9,4,PD,SUB,13,4,PD,PD,LENGTH=4,81:9,4,PD)
This OUTREC control statement refers to an 80-byte record. The OVERLAY parameter
subtracts the Payments field (13,4,PD) from the Balance Due field (9,4,PD). This updated
Balance Due amount is entered in a new, displayable field at the end of the record.
In an OUTFIL control statement, the OVERLAY parameter may be used with FTOV or
VLTRIM. The OVERLAY parameter may not be used with CONVERT or VTOF. Under the
OUTFIL control statement, see “FTOV Parameter (Optional)” on page 2.93 for a complete
description of the FTOV parameter and “VLTRIM Parameter (Optional)” on page 2.93 for a
complete description of the VLTRIM parameter.
Use PARSE to extract variable-position and variable-length fields from records. The result-
ant data will be placed into fixed-length parsed fields. The fixed-length parsed fields are
specified by %pp, where pp is an integer from 00 to 99. Therefore, up to 100 fixed-length
parsed fields may be defined for each PARSE application.
The criteria for extracting variable fields is specified using the PARSE subparameters. The
resultant %pp fields may then be used to the same extent as fixed fields, which have a fixed
position p and a fixed-length l, in the FIELDS, BUILD, or OVERLAY parameters associ-
ated with the statements.
For use of PARSE with IFTHEN and in the case of missing fields, see “PARSE with
IFTHEN” on page 2.215.
STARTAFT 1 =string STARTAFT 2 =string
STARTAFT =BLANKS STARTAFT =BLANKS
ABSPOS=p 1 2
ADDPOS=x , STARTAT 1 =string , STARTAT 2 =string ...
SUBPOS=y STARTAT =BLANKS STARTAT =BLANKS
1 2
STARTAT 1 =NONBLANK STARTAT 2 =NONBLANK
ENDBEFR 1 =string ENDBEFR 2 =string
ENDBEFR 1 =BLANKS ENDBEFR 2 =BLANKS PAIR=APOST
, , ... , PAIR=QUOTE
ENDAT 1 =string ENDAT 2 =string
ENDAT 1 =BLANKS ENDAT 2 =BLANKS
By default the first PARSE operation will begin at byte 1 for fixed-length records and byte 5
for variable-length records. This represents the initial position of the cursor within the
record. The cursor can be repositioned to start the PARSE operation through the use of the
ABSPOS, ADDPOS, SUBPOS, STARTAFT, or STARTAT subparameters. The PARSE oper-
ation to extract the field continues until the ENDBEFR or ENDAT conditions are satisfied
or, in their absence, for the number of bytes specified in the FIXLEN subparameter. The
cursor is advanced as the result of processing the above subparameters. A subsequent
PARSE operation, by default, will begin at the byte where the cursor was last positioned by
the prior PARSE operation. This position can also be modified as described above. Refer to
the descriptions of the subparameters for details on cursor position as a result of their oper-
ation.
ADDPOS=x Optionally specifies that the start position of the cursor will be
at the current position plus x bytes added. You can set x from 1
to 32752.
SUBPOS=y Optionally specifies that the start position of the cursor will be
at the current position minus x bytes subtracted. You can set y
from 1 to 32752. If the result is less than 1 for a fixed-length
record, then the cursor position is set to 1. If the result is less
than 5 for a variable-length record, then the cursor position is
set to 5.
If the string is not present, then data from the field will
continue to be extracted up until the end of the record. Blank
characters will be inserted into all subsequent parsed fields.
If a blank character is not present, then data from the field will
continue to be extracted up until the end of the record. Blank
characters will be inserted into all subsequent parsed fields.
character. The start position of the cursor for the next parsed
field is then set at the byte after the string.
If the string is not present, then data from the field will
continue to be extracted up until the end of the record. Blank
characters will be inserted into all subsequent parsed fields.
If a blank character is not present, then data from the field will
continue to be extracted up until the end of the record. Blank
characters will be inserted into all subsequent parsed fields.
You can use %pp parsed fields in IFTHEN expressions. If the %pp field is defined in a
WHEN=INIT, WHEN=(conditions), WHEN=ANY, or WHEN=NONE expression, it can be
used in the IFTHEN BUILD or IFTHEN OVERLAY of that expression. Additionally, for
WHEN=INIT, the %pp fields can be used in any subsequent IFTHEN expression. See
“IFTHEN Parameter (Optional)” on page 2.198 for further description of the IFTHEN
parameter.
A sample application of using PARSE with IFTHEN is when the parse cursor needs to be
reset to the default position at the beginning of the record, as in the case of variable records
with missing fields. For each WHEN=INIT statement implemented with PARSE, the cur-
sor position is set to byte 1 for fixed-length records and byte 5 for variable-length records.
Using PARSE without IFTHEN, a search resulting in a missing field would cause any sub-
sequent fields to be overlooked and not properly parsed into %pp fields. However, using
IFTHEN PARSE, each search would reset the cursor to the beginning of the record and
fields could be properly parsed into %pp fields independent of each other.
A file with comma-delimited records for a stock portfolio contains fields for stock symbol,
current price, and today’s change amount:
DIS,34.56,+1.09
T,37.05,-.42
GOOG,449.12,-11.62
To format this information into fixed-length columns so that the data can be properly
sorted and displayed, the following INREC and SORT statements may be used:
The ENDBEFR subparameters for the %1 and %2 parsed fields capture the data in the first
two fields in the input records up until the comma delimiters and reposition the cursor
after the commas, while ENDBEFR for %4 works similarly for the last field in each record.
FIXLEN sets the maximum output length for each field. %3 is used to strip the sign off the
change amount, so that the numeric part of the amount can be right-justified. The BUILD
parameter is used to right-justify the numeric data into columns and to add spacing
between the numbers. Using INREC allows the data to be sorted by stock symbol, produc-
ing the following output:
A file has records with name and address information in a keyword format
PARSE may be used to search for each keyword and extract the data into fixed-length fields
in a reconstructed record. In this example, some of the keywords in certain records may be
missing. This normally would cause the cursor to be moved to the end of the record, so that
the search for the next keyword fails. But, by using PARSE with an IFTHEN WHEN=INIT
separately for each field, this problem can be avoided because the cursor is reset to the
beginning of the record for each new PARSE.
This produces the following output, where blanks are used for each missing field:
Example 1
The following example illustrates how the OUTREC control statement can be used to insert
binary zeros and blanks into the record.
OUTREC FIELDS=(1:4Z,5:20,10,23:44,28,10X)
• Four binary zeros are inserted in the first 4 bytes of the record (4Z).
• The next field begins in position 5. This field began in position 20 before OUTREC
processing and is 10 bytes long (5:20,10).
• Eight blanks are inserted before the next field, which is positioned at byte 23. MFX
automatically inserts blanks in the unused positions between fields.
• The next field begins in position 23. This field began in position 44 before OUTREC
processing and is 28 bytes long (23:44,28).
• Ten blanks are inserted in the last 10 bytes of the record (10X).
Example 2
The following example illustrates how the OUTREC control statement can be used to con-
vert and edit numeric fields.
OUTREC FIELDS=(1,50,64,4,PD,M2,68,6,ZD,
EDIT=($I,IIT.TTS),SIGNS=(,,+,-))
• The first field (1,50) begins in position 1. This field began in position 1 before OUTREC
processing and is 50 bytes long.
• The next field (64,4) begins in position 51. This packed decimal field began in position
64 before OUTREC processing and is 4 bytes long. After being converted and edited by
editing mask M2 (64,4,PD,M2) the resulting field will be 10 bytes long. However, the
number of digits that will actually print will depend on the number of leading zeros, if
any, because this mask specifies that only three digits must print whether or not they
are leading zeros. Moreover, this mask specifies that a minus sign print after the
number if it is negative and a blank print after the number if it is positive.
• The last field (68,6) begins in position 61. This zoned decimal field began in position 68
before OUTREC processing and is 6 bytes long. The EDIT and SIGNS subparameters
(EDIT=($I,IIT.TTS),SIGNS=(,,+,-)) specify a 10-byte field because 4 additional bytes are
needed for the dollar sign, the comma, the decimal point and the trailing plus or minus
sign. Note that if the first three digits are leading zeros, they will be suppressed.
Example 3
This example uses the OUTREC control statement to convert numeric data from one for-
mat to another.
OUTREC FIELDS=(1,10,ZD,PD,
11,4,FI,ZD,LENGTH=8)
• The first field (1,10,ZD,PD) begins in position 1. This field was a 10-byte ZD field that
began in position 1 before OUTREC processing. It will be converted to a 6-byte PD field
in the output record, because 6 bytes are required to contain 10 decimal digits as a PD
field.
• The next field (11,4,FI,ZD) begins in position 7. This field was a 4-byte FI field that
began in position 11 before OUTREC processing. It will be converted to an 8-byte ZD
field in the output record. Normally 10 ZD bytes would be required to contain the 10
decimal digits that may be represented by a 4-byte FI field, but the LENGTH=8
parameter overrode the output length. If there are more than 8 decimal digits in any of
the 11,4,FI fields, those digits will be truncated on the left in the output record.
Note that ZD output is not the same as printable output using editing masks. High
order zeros will appear as zeros in a ZD field, while they appear as blanks when using
the default M0 mask, as well as most other masks. The sign indicator in a ZD field is
placed in the first 4 bits of the rightmost byte, and not as a separate printable sign.
Example 4
This OUTREC example uses arithmetic and function operators to do algebraic calculations.
New 8-byte PD fields are required in each record containing the maximum and average of
fields A, B, and C. Another new 5-byte printable field is required containing field D as a
percentage of field E. The field definitions are:
Field A: 1,4,PD
Field B: 5,8,ZD
Field C: 13,4,FI
Field D: 25,4,PD
Field E: 29,4,PD
• The first field (1,36) retains the complete contents of the input record.
• The second output field begins in position 40. An arithmetic calculation is done using
three different numeric input fields and the constant +3 to compute the arithmetic
average. This is an expression that is considered to contain 15 decimal digits. The
output is requested as a PD field. The length of this field will be 8 bytes, since that is
the length required to contain 15 decimal digits.
• The third output field begins in position 50. Multiplying numeric Field D by 100 before
dividing by numeric Field E gives the desired percentage number, which is considered
to contain 15 decimal digits. No output format or editing mask is specified, so the
default mask M0 is used to create printable output. LENGTH=5 is specified to reduce
the default length of the output field from 16 to 5, since it is known that the percentage
number will not be large.
Example 5
This OUTREC control statement uses DT1, TM1, and edit masks to convert SMF date and
time values to appropriate formats.
OUTREC FIELDS=(1,4,DT1,EDIT=(TTTT/TT/TT),
3X,5,4,TM1,EDIT=(TT:TT:TT))
2002/07/04 07:22:12
2002/07/04 05:15:25
2002/07/05 11:37:39
2002/07/05 16:42:28
Example 6
This OUTREC control statement illustrates the use of the &DATE1(c) and &TIME1(c)
parameters in an MFX run on June 9, 2002 at 04:16:29 p.m.
The output would include data from the input record in the first twenty columns followed
by the run-time date and time starting in column 24. The date and time would appear as
'2002 06 09 16:16:29'.
Example 7
The following control statements illustrate two of the options of the TRAN subparameter.
This OUTREC control statement uses TRAN=LTOU to translate the letters in positions 1-5
of each output record from lowercase to uppercase.
OUTREC FIELDS=(1,5,TRAN=LTOU)
This OUTREC control statement uses TRAN=ALTSEQ to translate each binary zero (X'00')
in columns 1-5 to an asterisk (X'5C') in positions 1-5.
ALTSEQ CODE=(005C)
OUTREC FIELDS=(1,5,TRAN=ALTSEQ)
Comprehensive examples illustrating the OUTREC control statement and the OUTREC
parameter of the OUTFIL control statement are provided in “Chapter 3. How to Use MFX’s
Data Utility Features”.
For century window processing, data conversion is determined by the century window
defined by the CENTWIN parameter.
Example 1
A 2-digit year field in character format at position 20 in the input record could be expanded
with the following specification:
Note that the expansion of the year data from 2 to 4 digits increases the output record
length by 2 bytes compared to the input record length.
The CENTWIN setting determines the century of the 2-digit year field. If CENTWIN=1980,
then a year field in the input record would be converted as follows:
Example 2
Consider the following packed decimal date field at position 20 in the input record:
yymmdd = X'0yymmddC'
Suppose you want to output a displayable 4-digit year in character format in the form
mm/dd/yyyy
The 4-digit year output from the input year field (20,2,Y2P) depends on the CENTWIN set-
ting. The following sample of input and output data shows the case for CENTWIN=1980:
Example 3
To expand a 3-byte packed decimal date field of the form X'yyddds', at position 20 in the
input record, to a 4-byte packed field of the form X'yyyyddds' that contains a prefixed cen-
tury value, specify an OUTREC control statement such as the following:
Note that in the above example the output record length will be 1 byte larger than the
input record length. The following sample of input and output data shows the effect for
CENTWIN=1980:
Example 4
To expand a 4-byte packed decimal date field of the form X'0yymmdds', at position 20 in the
input record, to a 5-byte field of the form X'0yyyymmdds' that contains a prefixed century
value, specify an OUTREC control statement such as the following:
As with Y2ID conversion, the output record length will be 1 byte larger than the input
length. The following sample of input and output data shows the effect for
CENTWIN=1980:
Example 5
Consider a 2-byte character or zoned decimal field that may contain either valid numeric
year data or characters that identify the record as a header or trailer. Header records in the
example are identified by zeros (X'00') or a blank (X'40') in the first byte of the year field,
while trailer records are identified by binary ones (X'FF') in the first byte of the field. The
Y2S format will treat the valid year data normally, in the same way as the Y2C or Y2Z for-
mats would treat the data, but the year fields of header and trailer records will be con-
verted to a 4-digit form padded on the left with data identical to the data in the first byte of
the input field.
Typically this type of conversion is needed when a Y2S SORT or MERGE field is used to
collate the records so that header/trailer records in the output remain at the start or end of
the file. An OUTREC control statement such as the following could be used.
As with Y2C or Y2Z, the output record length will be 2 bytes larger than the input record
length.
• MFX is invoked by a program passing either a 24-bit or 31-bit extended parameter list
and using an in-memory E15 or E32 exit routine.
F
RECORD TYPE= [,LENGTH=(l1 ,l 2 ,l 3 ,l 4 ,l 5 ,l 6 ,l 7 )]
V
The TYPE parameter can be used to indicate the record format. TYPE=F indicates fixed-
length records; TYPE=V indicates variable-length records. TYPE=FB or TYPE=VB can be
specified but the 'B' is ignored.
TYPE should be specified if SORTIN is VSAM. If TYPE is not provided, the SORTOUT
RECFM will be examined to determine the SORTIN TYPE. If no SORTOUT RECFM is
found, TYPE=V will be assumed if SORTOUT is VSAM and TYPE=F if there is no
SORTOUT or SORTOUT is non-VSAM.
Note: If the TYPE specification differs from the RECFM DCB parameter for the
SORTIN/SORTINnn DD statement, the latter takes precedence.
The LENGTH parameter, usually optional, is required whenever the RECORD control
statement is required.
The LENGTH parameter specifies the length of the record at various points during the pro-
cessing of the application.
The number of length values can vary from 1 to 7. Only the l1, l2 and l3 values should be
specified for fixed-length records and for merge or copy applications. All seven length val-
ues can be specified for variable-length sorts. If l1 is the only value specified, parentheses
are optional. If l1 and additional length values are specified, they all must be enclosed in
parentheses.
The length values are positionally dependent. An extra comma must indicate a missing
length value between any two that are specified. Commas need not follow the final length
value specified. For example, if LENGTH=(l1,,,l4) is specified, the omitted values are under-
stood to be l2 and l3.
l1 The maximum record input length of the logical records. For variable-
length records, this is the length of the longest logical record plus the 4-byte
Record Descriptor Word. The 4-byte RDW must be included, even if the
input is a VSAM file. The maximum record length cannot exceed 32,760 for
fixed-length records and 32,767 for variable-length records. An LRECL
value specified on the SORTIN/SORTINnn DD statement or the data set
label will override the l1 value for fixed-length records. For variable-length
records, the higher value (LRECL or l1) is used. This is ignored in a join
application.
l2 The maximum length of the logical records after E15 processing. An omit-
ted l2 value defaults to the l1 value and indicates that the maximum record
length has not been changed by an E15 exit. If there is no E15 exit, an l2
value which is smaller than the l1 value or the LRECL specified on the
SORTIN/SORTINnn DD statement or data set label will truncate the
records. This truncation will occur after the record is read from SORTIN.
This is ignored in a join application.
l3 The maximum length of the logical records after E35 processing. If the l3
value is omitted, the default is either the l2 value, or, if an INREC and/or
OUTREC control statement is specified, the record length after
INREC/OUTREC processing. Note that it is not necessary to specify an l3
value to reflect a length change due to INREC or OUTREC processing; the
revised record length is calculated automatically. However, it is necessary
to specify an l3 value if exit E35 has altered the record length.
The l3 value is ignored if there is no E35 exit, so it is not possible to use the
l3 value to truncate or pad the records.
l4 The minimum length of the variable-length logical records plus the 4-byte
Record Descriptor Word. An omitted l4 value defaults to the length from the
beginning of the record to the end of the last field referenced by any control
statement.
l5 The most frequent record length of the variable-length records. Specify this
length value to optimize the size of the segment, i.e., the fixed-length block
of main storage, used to contain variable-length records.
• All length values for variable-length records must include 4 bytes for the Record
Descriptor Word.
• The l1, l2, and l3 values must represent the maximum record lengths and the l4 value
must represent the minimum record length. If MFX encounters a record which exceeds
the maximum length or is shorter than the minimum length, the application will either
terminate abnormally or produce unpredictable results.
RECORD TYPE=F,LENGTH=(80,,60)
• A comma represents the omitted l2 value because an E15 exit does not change the
record length.
• The record length after INREC/OUTREC and/or E35 processing is 60 bytes. The
SORTOUT LRECL should either be specified as 60 or omitted. If it is omitted, MFX
will automatically supply the correct value.
RECORD TYPE=V,LENGTH=(400,300,250,l20,200,280,230)
• The file contains variable-length records. All length values include 4 bytes for the
Record Descriptor Word.
• The maximum record length after INREC/OUTREC and/or E35 processing is 250 bytes.
• The average work space required for each record is 280 bytes, as reported by the
HISTOGRM utility program.
In the above example, the l4, l5, l6 and l7 values will be ignored if the application is a merge
or copy.
Use the REFORMAT control statement to specify which fields from the SORTJNF1 and
SORTJNF2 files are to be included in each record created by the join operation.
If a REFORMAT control statement is not provided and ONLY the unpaired records from
both join inputs are requested, the resultant records will be variable-length, regardless of
the record formats of the join input data sets, and the record length will be the maximum of
any fixed-length input file record length plus four (for an RDW) and any variable-length
input file record length.
The FIELDS parameter specifies fields to be included in the record produced by the join
function.
Each data field specified in the FIELDS parameter is identified by the file it originates
from Fn, its position p and length l.
Fn: The Fn value indicates the input file from which the data field should be copied.
Code ‘F1’ for SORTJNF1 and ‘F2’ for SORTJNF2. This field is optional after the
first field specification. By default, the file of the prior field specification will be
used to determine the current field specification.
If your join application requests only the unpaired records from one join input
through the JOIN statement, then you may not reference the other join input
file in the FIELDS parameter, since no records from that file will ever be
p The position value indicates the first byte of the field relative to the beginning
of the input record.
? This symbol is used to place a one-byte indicator in the reformatted record that
indicates whether the reformatted record is a paired or an unpaired joined
record. The indicator will be set to one of three different printable values:
? may only be used once in the FIELDS parameter. If it is followed by any p,l
fields, you must specify the Fn: subparameter. If a variable-length reformatted
record is created , ? must be placed before any field specifying the variable part
of the record.
If the REFORMAT statement only defines p,l fields and/or a ? field, then the output of the
join will be a fixed-length record. If a variable-length record format is desired when one or
both input files are variable-length, then the first p,l REFORMAT field must be 1,4 (from
either SORTJNFn input file) to define the RDW. This p,l specification of 1,4 must reference
an Fn that is a variable-length file. The variable portion of the record must then be
specified as the last REFORMAT field by coding a position p without a length l. If both files
are variable-length, then the variable portion from each of the variable-length input files
may be specified once at the end of the REFORMAT statement.
REFORMAT FIELDS=(F1:1,4,F1:10,10,F2:25,3,?,F1:40,F2:50)
The FILL parameter defines a fill byte to be used for any missing p,l field bytes. The format
of the FILL parameter is illustrated below (f specifies the fill byte):
FILL=f
f can be specified as either a character or hexadecimal value. Specify either C'x' where x is
a single EBCDIC character or X'hh' where hh represents a hexadecimal digit pair (00-FF).
The need for a fill byte can arise from two conditions:
• A JOIN UNPAIRED was used and the REFORMAT FIELDS specification requires a
field from the file that is not being used to generate the current joined record.
The default FILL character is a blank. Binary zeros will be used instead of the FILL char-
acter for the first four bytes of a variable-length record requiring FILL processing. This
indicates that a record was not present for the REFORMAT due to JOIN UNPAIRED.
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:10,10,F2:12,5),FILL=C'0'
In this example, if a record is found in SORTJNF1 that does not match a record in
SORTJNF2, the unpaired record will be included in the join output and would look as fol-
lows:
Position Value
11-15 Filled with 0s since SORTJNF2 does not participate in building this
record.
For more examples, see “Joining Records from Multiple Files” on page 3.15.
Either a SORT control statement or a MERGE control statement is required for every
application.
Cultural environment support allows you to choose an alternative set of collating rules
based on a specified national language. The alternative collating applies to SORT/MERGE
and INCLUDE/OMIT processing.
0
,CKPT
,CENTWIN= s
f ,CHKPT
d
nn,mm
,DYNALLOC = (d,n (,RETRY= OFF ,SC=s )
OFF
,EQUALS n n
,FILSZ= ,SIZE=
,NOEQUALS En En
,SKIPREC=n ,STOPAFT=n
List the control fields in order of greatest to least priority, with the primary control field
listed first, followed by progressively less significant fields. You can specify up to 128 con-
trol fields; however, if fields are complex, the limit for a particular execution may be less
than 128.
Each field specified in the FIELDS parameter is identified by its position (p), length (l), for-
mat (f) and order (o).
p The position value indicates the first byte of the field relative to the beginning of
the input record after INREC and/or E15 processing, if specified, have completed.
Binary control fields can begin on any bit of a byte. When a binary field does not
begin on a byte boundary, you must specify the bit number (0-7). For example, a
position value of 21.3 refers to the 4th bit of the 21st byte of the record.
l The length value indicates the length of the control field. The length value must be
an integer number of bytes except for the length of a binary control field which can
be specified in bits. For example, a length value of 0.5 refers to a binary control field
5 bits long.
For signed fields, the length value must include the area occupied by the sign.
f The format value indicates the data format. For a list of valid formats, refer to the
table in the next section, “Valid Formats for Sort Control Fields.” If all the control
fields have the same format, you can specify the format value once by using the
FORMAT=f subparameter. If you specify both the individual f values and the
FORMAT subparameter, the individual f values will be used for fields where they
are specified.
• A=Ascending order
• D=Descending order
The following chart lists the valid formats for sort control fields.
Field Length
Code Data Format
(bytes)
ASL Leading separate sign. An ASCII + or - precedes numeric field. One 2 to 256
digit per byte.
AST Trailing separate sign. An ASCII + or - trails numeric field. One 2 to 256
digit per byte.
CLO Leading overpunch sign. Hexadecimal F,C,E, or A in the first 4 bits 1 to 256
OL of your field indicates a positive number. Hexadecimal D or B in the
first 4 bits indicates a negative number. One digit per byte.
CMP=CLC is forced.
Field Length
Code Data Format
(bytes)
PD0 Packed decimal. 2-8-byte packed decimal data with the first digit 2-8
and trailing sign ignored. The remaining bytes are treated as
packed decimal digits. Typically PD0 is used with century window
processing and Y2P format; Y2P processes the year, while PD0 pro-
cesses month and day.
SFF Signed free format. Decimal digits (0-9) are extracted from right to 1 to 44
left to form a number value. A character of – or ) found within the
field will cause the value to be treated as a negative number. All
other non-decimal digit values in the field are ignored.
UFF Unsigned free format. Decimal digits (0-9) are extracted from right 1 to 44
to left to form a number value. All non-decimal digit values in the
field are ignored.
Y2B Binary. 2-digit, 1-byte binary year data treated as a 4-digit year by 1
CENTWIN (century window) processing.
Y2D Packed decimal. 2-digit, 1-byte packed decimal year data treated as 1
a 4-digit year by CENTWIN (century window) processing.
Y2P Packed decimal. 2-digit, 2-byte packed decimal year data. Of the 2
four packed digits contained in the 2 bytes, the first digit and trail-
ing sign are ignored; the two inner digits are treated as a 4-digit
year by CENTWIN processing.
Field Length
Code Data Format
(bytes)
Y2X
Y2Y
Y2Z Zoned decimal. 2-digit, 2-byte zoned decimal year data treated as a 2
4-digit year by CENTWIN (century window) processing. The zones
are ignored. Processing is identical to Y2C fields.
ZD Zoned decimal. Trailing overpunch in the first 4 bits of the right- 1 to 256
CTO most byte gives the sign. Hexadecimal F,C,E, or A indicates a posi-
OT tive number. Hexadecimal D or B indicates a negative number. One
digit per byte. CTO forces CMP=CLC.
For information on the year data formats (Y2B, Y2C, Y2D, Y2P, Y2S, and Y2Z) plus the
related data format PD0 and the full-date formats, see “CENTWIN Parameter (Optional)”
on page 2.237, “Converting Year Data with Century Window Processing on INREC, OUT-
REC, or OUTFIL OUTREC” on page 2.160, and “Specifying Field-to-Field Standard Com-
parisons for Year Fields” on page 2.35.
• For fixed-length records, all control fields and the sum of their lengths cannot exceed
4092 bytes. When EQUALS is in effect, the number is reduced 4 bytes to 4088 bytes.
EXTCOUNT also reduces the number by 4 bytes. Thus, if both EQUALS and
EXTCOUNT are in effect, the number is reduced to 4084 bytes.
• For variable-length records, all control fields must be located within the first 32750
bytes and the sum of their lengths cannot exceed 4084 bytes. When EQUALS is in
effect, all control fields must be located within the first 32746 bytes and the sum of
their lengths cannot exceed 4080 bytes.
• Remember that for variable-length records, the first 4 bytes are reserved for the Record
Descriptor Word, so the first byte of the data portion of the record is byte 5.
• If the output file is a key-sequenced VSAM cluster, the VSAM key must be the first
control field specified.
The CMP PARM determines how PD and ZD control fields will be compared. When
CMP=CPD is in effect, the Compare Decimal (CP) instruction may be used under certain
circumstances for the compare. ZD fields are packed and then compared. This method has
performance advantages. However, invalid PD data may cause a system 0C7 abend and
program termination. Moreover, the integrity of ZD fields is only guaranteed when they
contain valid ZD data. The CMP=CPD method will not be used for control fields that exceed
16 bytes or for variable-length merges when an even value (0, 2, 4, or 6) is specified for the
VLTEST PARM.
When CMP=CLC is in effect, no data validation is performed and the integrity of the out-
put is maintained, even if the sign for a PD or ZD field is invalid. This method will be used
if any control field exceeds 16 bytes or for variable-length merges when an even value is
specified for the VLTEST PARM.
The CENTWIN run-time or installation option acts on 2-digit year data. CENTWIN gener-
ates a century window (for example, 1950 through 2049) that determines the century to
which a 2-digit year belongs. At run-time, CENTWIN can be specified as either a PARM
option or a SORT/MERGE control statement parameter. CENTWIN ensures that year data
spanning centuries will be sequenced correctly. Without CENTWIN processing, an ascend-
ing sort would sequence the year 01 before the year 98. With CENTWIN processing, the 01
field could be recognized as a twenty-first century date (2001) and would thus be sequenced
after 98 (1998).
For more information on specifying the CENTWIN option, see “CENTWIN” on page 5.6.
CENTWIN SORT/MERGE processing only applies to data defined as year data formats:
Y2B, Y2C, Y2D, Y2P, Y2S, Y2Z, and the full-date formats (Y2T, Y2U, Y2V, Y2W, Y2X, and
Y2Y). These data formats enable MFX to process 2-digit year fields as 4-digit years. A
related data format, PD0, can be used to process the month and day portions of packed
decimal date fields. To correctly specify date fields for CENTWIN SORT processing, you
should be familiar with the CENTWIN-related data formats.
The following describes each of the year data formats and provides SORT control statement
examples:
This format is used to sequence 2-digit, 1-byte binary year data with CENTWIN process-
ing. The binary values are converted to decimal, and the two low order digits are used as
year data. Thus, while binary and decimal values range from 00 to 255, year values range
from 00 to 99. The relationship between binary, decimal and year values is shown in the fol-
lowing table:
These formats represent 2-digit, 2-byte year data in either character (Y2C) or zoned deci-
mal (Y2Z) format. Either Y2C and Y2Z formats can be used with data of the form
X'xyxy'
where y is a hexadecimal year digit 0-9 and x is hexadecimal 0 through F. Y2C and Y2Z
ignore the x digits, leaving yy, the 2-digit unsigned year representation.
Suppose you have a character or zoned decimal date field mmddyy that begins at byte 20.
You can use either Y2C or Y2Z to process the yy field. As the following example indicates,
you could specify three sort keys to correctly sort this date:
The yy field (24,2) will be processed according to the century window setting. For example,
if CENTWIN=1945, the field yy=45 will be sequenced as if it were 1945, and yy=44 would
be sequenced as if it were 2044. Thus, for an ascending sort, 44 would follow 45.
This format is used to sequence 2-digit, 1-byte packed decimal year data with CENTWIN
processing. Use Y2D to extract the year data yy from packed decimal date fields. For exam-
ple, consider a 3-byte packed decimal data field defined as
X'yyddds'
This field has the year yy in the first byte and the day ddd in bytes 2 and 3. The packed dec-
imal sign s would be in the last digit (half byte) of the third byte. To sort this date field,
which begins at byte 20, with 4-digit year processing, use the following SORT control state-
ment:
This format is used to sequence 2-digit, 2-byte packed decimal year data with CENTWIN
processing. Use Y2P to extract the year data yy from packed decimal date fields spanning 2
bytes. For example, a packed decimal date of the form yymmdd would be stored as 4 bytes:
yymmdd = X'0yymmddC'
where the trailing C (sometimes F) is a positive sign and the leading 0 pads the field on the
left to make an even number of digits.
0y ym md dC
Y2P handles this condition by ignoring the first and last half bytes of the 2-byte field speci-
fication. Thus, Y2P processes 0yym as yy, ignoring the leading digit (0) and the trailing digit
m that is part of the month.
The following example uses Y2P to sort the year portion of the date field, which begins at
byte 20:
The field specification 20,2,Y2P treats X'0yym' as X'yy', and CENTWIN processing sorts yy
as a 4-digit year yyyy.
The PD0 format, described below, can assist Y2P by processing month and day data that
overlap year data in the original field.
This format is used to sequence 2-digit, 2-byte character or zoned decimal data. The Y2S
format is identical to Y2C and Y2Z for valid numeric data, but Y2S treats data that begin
with X'00', X'40', or X'FF' as non-year data. Thus, the Y2S format can distinguish records
that have non-year data in the first byte of the year field, allowing such records to be sorted
differently from other records.
• Data with binary zeros (X'00') or a blank (X'40') in the first byte will not have century
window processing applied to it. Instead, such data will be collated in sequence, before
valid numeric year data for ascending order or after the year data for descending order.
• Data with all binary ones (X'FF') in the first byte will also not have century window
processing applied to it. Instead, such data will be collated after valid year numeric
data for ascending order or before the year data for descending order.
• Zones are ignored, as for Y2C and Y2Z, except for data where the first byte begins with
X'00', X'40', or X'FF'.
As an example, suppose you want to preserve the input order of header and trailer records
at the start or end of the file, and your header/trailer records are identified by binary zeros
(X'00'), a blank (X'40'), or binary ones (X'FF') in the first byte of the date field.
The Y2S format allows CENTWIN to identify the header/trailer records and treat them dif-
ferently from other records. Presuming the year data begin in column 20, you would use the
following sort key specification:
The yy field (20,2) will be processed according to the century window setting. For
CENTWIN=1945, data with header and trailer records would be sorted as follows:
X'F9F6' X'0000'
X'4001' X'4000'
X'F4F4' X'4001'
X'4000' X'F5F1'
X'0000' X'F9F6'
X'F5F1' X'F4F4'
X'FF03' X'FF03'
Note that if the above data were sorted as Y2C or Y2Z format, the output order would be
different because the records starting with X'00', X'40', and X'FF' would be interpreted as
numeric years. For example, suppose the fields in the above list were defined as Y2Z and
sorted with EQUALS:
SORT FIELDS=(20,2,Y2Z,A),EQUALS
X'F9F6' X'F5F1'
X'4001' X'F9F6'
X'F4F4' X'FF03' (invalid numeric data)
X'4000' X'4000' (invalid numeric data)
X'0000' X'0000' (invalid numeric data)
X'F5F1' X'4001' (invalid numeric data)
X'FF03' X'F4F4'
The header and trailer records are sequenced as year data according to the CENTWIN set-
ting (CENTWIN=1945), and they lose their position at the start and end of the file.
This format is used to sequence 2-8 byte packed decimal data. PD0 ignores the first digit
and trailing sign during processing. PD0 is normally used in conjunction with the Y2P data
format. The Y2P format is used to process the 2-digit year portion of a packed decimal date
field, while the PD0 format is used to process the month and day portion of the field.
Although PD0 is typically used with Y2P, the PD0 format itself is not affected by
CENTWIN processing.
Consider the packed decimal date field used in the example above:
yymmdd = X'0yymmddC'
where the trailing C (sometimes F) is a positive sign and the leading 0 pads the field on the
left to make an even number of digits.
0y ym md dC
The following SORT control statement can be used to sort the entire date with CENTWIN
processing:
Full-Date Formats
Full-date formats can be used to sort or merge various date fields, processing dates ending
or starting with year digits. They also process non-date data that are used with dates. For a
full description of full-date formats, see the following section.
MFX’s full-date data formats enable you to sort or merge a variety of date fields. The full-
date formats are Y2T, Y2U, Y2V, Y2W, Y2X, and Y2Y. These date formats can process dates
ending or starting with year digits:
The full-date formats also process non-date data commonly used with the dates. MFX inter-
prets two-digit years (yy) according to the century window specified by the CENTWIN
option. CENTWIN processing does not apply to non-date data.
In most cases, for CH, ZD, and PD date fields the full-date data formats are easier to use
than the 2-digit date formats. The 2-digit formats can be more difficult because you must
divide the date into its components. This requires care, particularly for PD dates, where
date components (q, dd, mm, or yy) may span bytes or occupy only part of a byte. The full-
date formats, on the other hand, process such dates automatically.
The table below describes the full-date formats. For date forms not in the table, use the
2-digit year formats or the non-year formats.
yyxx yymm 4
yyxxx yyddd 5
yyxxxx yymmdd 6
yyxxx yyddd 3
(X'yyxxxs')
yyxxxx yymmdd 4
(X'0yyxxxxs')
xxyy mmyy 4
xxxyy dddyy 5
xxxxyy mmddyy 6
xxxyy dddyy 3
(X'xxxyys')
xxxxyy mmddyy 4
(X'0xxxxyys')
The table indicates the full-date formats that can be used with character (CH), binary (BI),
or packed decimal (PD) data. Note the recognized non-date values:
The following two examples illustrate how you might use Table 39 (“Full-Date Formats”) on
page 2.244:
• Suppose you have a packed decimal (PD) date field of the form mmyy. To sort this field
correctly, you would use the Y2Y 3-byte format from the table. Thus, if the field starts
in position 30, you would specify the following SORT control statement to sort in
descending order:
SORT FIELDS=(30,3,Y2Y,D)
Any PD fields of all PD zeros or all PD nines will be processed automatically as non-
date data.
• Suppose you have a character (CH) date field of the form yymmdd. To sort this field
correctly, you would use the Y2T 6-byte format from the table. Thus, if the field starts
in byte 40, you would specify the following SORT control statement to sort in ascending
order:
SORT FIELDS=(40,6,Y2T,A)
Any CH zeros, CH nines, BI zeros, blanks, and BI ones will be processed automatically
as non-date data.
For full-date formats, the yy component is always sorted first (treated as primary key). This
is so even when the yy is physically at the rightmost end of the field, as for Y2W, Y2X, and
Y2Y. For example, a 6-byte Y2W field has the form xxxxyy. This is collated with the yy as
the primary key and xxxx as the secondary key. Because MFX automatically collates the
year character first, you don’t have to deal with yy manually, for example by using PD0 and
Y2D.
• If yyxxxx is actually yymmdd, you will be sorting first by year, then month, then day.
• If yyxxxx is actually yyddmm, you will sorting by year, then day, then month. In most
cases, sorting in this way would not be what you intended.
To correctly collate a date, the date components must be in an order suitable for collating.
For example, mmddyy and yymmdd will collate correctly, but ddmmyy or yyddmm will not.
For date forms that will not collate correctly, you must use one of the 2-digit year formats
(Y2B, Y2C, Y2D, Y2P, Y2S, and Y2Z).
The following table shows the order for ascending collation when using full-date formats
with the CENTWIN option:
Y2U PD PD zeros
Y2V Lower century dates (e.g. 1980)
Y2X Higher century dates (e.g. 2010)
Y2Y PD nines
Other date formats (non-full-date), with the exception of Y2S, do not process non-date
data; their sort sequence for ascending sorts is simply lower century dates than higher
century dates.
Example 1 (Y2W)
The following SORT control statement sorts a C'mmddyy' date field in ascending order,
with the previously set fixed century window 1984-2083:
The Full-Date Formats table above indicates that the 6-byte Y2W form is appropriate for a
CH input field of the form xxxxyy. As shown in the following table, the output will be col-
lated as C'yyyymmdd', with the non-date data (zeros) appearing correctly at the beginning
of the sorted output.
Example 2 (Y2T)
The following SORT control statement sorts a Z'yyddd' date field in descending order, with
the previously set fixed century window 1921-2020:
The Full-Date Formats table above indicates that the 5-byte Y2T form is appropriate for a
ZD input field of the form yyddd. As shown in the following table, the output will be col-
lated as Z'yyyyddd', with the non-date data (nines and zeros) appearing correctly at the
beginning and end of the sorted output.
Example 3 (Y2Y)
The following SORT control statement sorts a P'mmddyy' (X'0mmddyys') date field in
ascending order, with the previously set fixed century window 1921-2020:
The Full-Date Formats table above indicates that the 4-byte Y2Y form is appropriate for a
PD input field of the form xxxxyy. As shown in the following table, the output will be col-
lated as P'yyyymmdd', with the non-date data (zeros and nines) appearing correctly at the
beginning of the sorted output. Note that the first two columns are in hexadecimal.
Use FIELDS=COPY to copy one or more input files. Multiple files can be copied if they are
concatenated to the SORTIN DD statement. Other control statements such as INREC,
INCLUDE/OMIT, OUTREC, and OUTFIL may be specified in conjunction with a copy
application, allowing you to edit and reformat the file(s) without sorting them.
The SUM or DUPKEYS control statement and an E32 exit cannot be specified with
FIELDS=COPY. All Phase 3 exits can be used.
d
,DYNALLOC = ( d,n ,RETRY = nn,mm [,SC = s )
OFF
OFF
DYNALLOC requests the dynamic allocation of SORTWK data sets on device type d.
Specify the device type either as a decimal number (e.g., 3390) or by the system generic
name (e.g., SYSDA). Any disk device accepted for a SORTWK DD statement can be
specified. Note that if VIO is specified it will be ignored, and the installation default for the
DYNALLOC device type will be used in its place.
Note that the DYNALLOC parameter may be used alone, without any subparameters. In
this case, the DYNALLOC installation default settings are used.
For MAXSORT applications, n is the number of SORTWK data sets that will be allocated.
As many as 32 SORTWK data sets can be specified. The default for n is 3.
For non-MAXSORT applications, n can be 1 through 255. This value specifies the number
of SORTWK data sets that can potentially be allocated. For values of n that are 31 or less,
MFX can automatically raise the number to 32 if the application requires it. When n is 33
through 255, this value specifies the maximum number of SORTWK data sets that can be
allocated.
Normally for both MAXSORT and non-MAXSORT applications, any SORTWK data sets
provided in the JCL will contribute towards the value of n. For instance, if n was set to 40
in a non-MAXSORT application and 30 SORTWKs were provided in the JCL, DYNALLOC
could obtain 10 additional SORTWKs if needed. Note that there is an installation option to
disable DYNALLOC if SORTWKxx DD statements are present.
MFX uses the value specified in the RETRY parameter to request automatic DYNALLOC
retry. This facility attempts to avoid a sortwork capacity exceeded condition when disk
space is not immediately available to satisfy a DYNALLOC request. MFX will
automatically retry a specified number of times and wait a prescribed interval between
DYNALLOC requests.
The nn in the first position designates the number of times MFX will retry a failed
DYNALLOC request. The minimum allowed is 0 and the maximum is 16. The mm in the
second position designates the number of minutes MFX waits between each DYNALLOC
request. The minimum allowed is 0 and the maximum is 15. A value of 0 can be used to
request an immediate retry. RETRY=OFF or an nn of 0 can be specified to override a
RETRY=ON installation default.
In an environment where DFSMS manages temporary work data sets, the SC subparame-
ter specifies a storage class s for MFX to use when dynamically allocating SORTWORK
data sets. The storage administrator at your installation defines the names of the storage
classes you can specify. Note that an installation written automatic class selection (ACS)
routine can override the storage class you specify. If SMS is not installed or active to man-
age temporary work data sets, the d device specification will be used in the SORTWORK
dynalloc request.
The EQUALS parameter insures that the original order of equal-keyed records is pre-
served. These records will be in the same order in the output file as they were in the input
file. NOEQUALS, the default, specifies that equal-keyed records may not be written in
their original input order.
If EQUALS is in effect in an application with SORTMInn data sets, the order of equal-
keyed records within each SORTMInn file will be preserved. In addition, equal-keyed
records from the lowest-numbered SORTMInn file will be written before those from the sec-
ond SORTMInn file, and so on.
When the EQUALS parameter is used with the SUM or DUPKEYS control statement, the
first of the equal-keyed records is retained with the sum or DUPKEYS function value; all
other records are deleted after the specified field(s) have been calculated.
The FILSZ parameter specifies the actual (FILSZ=n) or estimated (FILSZ=En) decimal
number of records to be sorted. This number should reflect any changes produced by
INCLUDE/OMIT, E14 and/or E15, SKIPREC and STOPAFT processing.
If FILSZ=n is specified, MFX will terminate unless exactly n records are processed.
FILSZ can also be specified as a PARM option on the EXEC statement. If this option is
specified both on the SORT control statement and as a PARM option, the PARM specifica-
tion takes precedence.
The SIZE parameter specifies the actual (SIZE=n) or estimated (SIZE=En) decimal number
of records read from the input file. Unlike the FILSZ parameter, this number should not
reflect any changes produced by INCLUDE/OMIT or exit processing, but should reflect
SKIPREC and STOPAFT processing.
If the FILSZ parameter is not specified and SIZE=n is specified, MFX will terminate unless
exactly n records are processed. If the FILSZ parameter is specified, the SIZE value is con-
sidered an estimate whether or not it is preceded by an E.
The SKIPREC=n parameter instructs MFX to skip a decimal number of records before the
input file is sorted or copied. The n records skipped are deleted from the input file before
E15 and INCLUDE/OMIT processing, if specified, take place.
If SKIPREC is specified as a PARM option as well as on the SORT control statement, the
PARM specification takes precedence.
The STOPAFT=n parameter specifies the number of records to be sorted or copied. These
will be the first n records after E15, INCLUDE/OMIT and SKIPREC processing, if speci-
fied, have completed.
If STOPAFT is specified as a PARM option as well as on the SORT control statement, the
PARM specification takes precedence.
SORT FIELDS=(2.3,2,BI,D,8,2.4,BI,A,25,10,CH,A,15,10,LS,D)
• The first, or primary, field begins in bit 4 of byte 2, is 2 bytes long, is in binary format
and is to be sorted in descending order.
• The second control field begins in byte 8, is 2 bytes 4 bits long, is a binary format and is
to be sorted in ascending order.
• The third control field begins on byte 25, is 10 bytes long, is in character format and is
to be sorted in ascending order.
• The fourth control field begins on byte 15, is 10 bytes long, is an EBCDIC numeric field
with a leading separate sign and is to be sorted in descending order.
SORT FIELDS=(20,5,A,5,10,D,30,5,A),FORMAT=CH,CKPT
• There are three control fields. Because all three fields have the same data format (in
this case, character), the FORMAT=CH subparameter is specified so that the CH value
does not have to be specified for each of the fields.
• The first control field begins on byte 20, is 5 bytes long and is to be sorted in ascending
order.
• The second control field begins on byte 5, is 10 bytes long and is to be sorted in
descending order.
• The third control field begins on byte 30, is 5 bytes long and is to be sorted in ascending
order.
SUM FIELDS=NONE can be used to delete all but one of the records with equal keys with-
out doing any summing.
SUM can also be specified on the DUPKEYS control statement to perform the same func-
tion. The DUPKEYS statement provides additional functions for equally-keyed records
such as providing AVG, MAX and MIN values.
The SUM control statement should not be used and will be ignored when FIELDS=COPY is
specified on the SORT or MERGE control statement.
The FIELDS parameter defines the numeric fields to be summed when the control fields of
two or more records are equal. Specify FIELDS=NONE to reduce the sorted data to one
record per sort key without summing any numeric fields.
Each field specified in the FIELDS parameter is identified by its position p, length l and
format f.
p The position value indicates the first byte of the field relative to the begin-
ning of the input record after INREC and/or E15 processing, if specified,
have completed. The field must begin on a byte boundary.
l The length value indicates the length of the field. The length must be an
integer number of bytes. Refer to Table 41 on page 2.254 for the permissible
lengths.
f The format value indicates the data format. Table 38 lists the valid data
formats for SUM fields. If all the summed fields have the same format, you
can specify the format value once by using the FORMAT=f subparameter. If
both the individual f values and the FORMAT subparameter are specified,
the individual f values will be used for fields where they are specified.
FORMAT
PERMISSIBLE LENGTH
CODE
BI 2, 4, or 8 bytes
FD* 4, 8, or 16 bytes
FI 2, 4, or 8 bytes
FL 4, 8, or 16 bytes
PD 1 to 16 bytes
ZD 1 to 31 bytes
Specify the XSUM parameter if you want records deleted by SUM processing to be written
to a data set defined by the SORTXSUM DD statement. These records will be written to
SORTXSUM at the time of SUM processing. The records will not undergo OUTREC, E35,
and OUTFIL processing because such processing occurs after SUM processing.
The DCB BLKSIZE of the SORTIN data set will not be used to determine the BLKSIZE of
the SORTXSUM data set. System determined blocksize will be used when enabled and
appropriate. Unblocked output will be generated if system determined blocksize has been
disabled and an explicitly specified blocksize has not been provided in the JCL.
The XSUM file will be sequenced in the same order as the SORTOUT file.
• Adding XSUM to an existing sort application may result in an increase in the amount
of SORTWORK space required. This occurs because XSUM delays all summing until
Phase 3.
• XSUM may require additional main memory. Specify a region size of 512K or more.
• A sort or merge control field cannot be summed. A portion of a control field cannot be
included in a sum field.
• Non-sum fields remain unchanged and are retained from the record which contains the
sum.
• If arithmetic overflow or underflow occurs during the summing of two records, those
records are not summed and neither record is deleted. Further processing is
determined by the option selected at installation through the SUMOVFL parameter or
the run-time parameter OVFLO. If the RC16 option of this parameter has been
selected, processing will terminate with a WER049A critical error. For the RC0 (the
delivered default) or the RC4 option, sum processing will continue and a WER049I
message will be issued (only for the first occurrence). If a subsequent pair of records
with equal control fields can be summed without causing overflow or underflow, they
will be summed. To avoid arithmetic overflow, use the INREC control statement to
insert zeros of the proper format immediately before the sum field. For example, for a
PD field, use nZ to insert binary zeros.
• Remember that the first 4 bytes of variable-length records are reserved for the Record
Descriptor Word, so the first byte of the data portion of the record is byte 5.
• SUM is incompatible with an incore sort. If you specify the SUM control statement,
allocate SORTWKxx data sets in the JCL or use the DYNALLOC feature for dynamic
SORTWK allocation. If no JCL SORTWKs are provided and DYNALLOC is disabled by
default, SUM will cause DYNALLOC to be enabled.
• When FL fields are summed, user-issued SPIE macros are not permitted and exit
routines must not produce exponent overflow or underflow. Because of the numeric
rounding performed by the hardware, the exact sum depends on the order in which
fields are summed. Thus, the sum may vary slightly for different executions.
• By default, the sign byte of a positive summed ZD field will be converted to printable
format. If you want to disable this action, use the NZDPRINT PARM option. Refer to
“ZDPRINT” on page 5.34.
The following SUM control statement eliminates equal-keyed records without summing
numeric fields. The XSUM option causes the eliminated records to be written to a data set
defined on the SORTXSUM DD statement.
SUM FIELDS=NONE,XSUM
Records with equal control fields will be eliminated from SORTOUT or SORTOFnn data
sets so that only one record is retained.
The following SUM control statement sums two numeric fields on records with equal con-
trol fields.
SUM FIELDS=(20,4,32,4),FORMAT=PD
When the control fields are equal, this SUM control statement sums the numeric data in
the fields beginning in bytes 20 and 32. Because both fields are in packed decimal format,
the FORMAT=PD subparameter is used so that the PD value does not have to be specified
for each field.
Comprehensive examples illustrating the SUM control statement are provided in “Chapter
3. How to Use MFX’s Data Utility Features”.
Introduction
This chapter assumes that you already know how to sort records and are ready to use
MFX’s Data Utility features for any or all of the following:
• Selecting only those input records and data fields that are needed for an application.
• Consolidating records into a single record that contains the sum of any numeric data
fields.
• Joining records.
• Generating several output files and reports with a single pass of the sort.
The following examples show how you can accomplish these tasks with MFX. Each example
is self-contained and provides coding instructions for both the required JCL and the neces-
sary control statements. Use them as starting points for your own applications. For details
of control statement syntax see “Chapter 2. MFX Control Statements”.
To specify the conditions for selecting records, use the INCLUDE/OMIT control statement.
For complete syntax, and examples of bit level criteria in record selection, see “INCLUDE/
OMIT Control Statement” on page 2.27
When processing variable-length records, by default all fields specified must be contained
within the record. If an application is expected to reference fields not completely contained
within the record, see “VLTESTI” on page 5.33. VLTESTI provides for processing of records
that do not contain all fields.
Example: A school board requires a list of all students performing below their grade level
on standardized exams. (The record layout is given in Figure 152 and a sample record is
given in Figure 153.)
Explanation: In this application, two comparisons are necessary to identify the records
needed for the list: the Grade field (25,2) has to be compared to the student’s Reading Score
field (27,2) and to the Mathematics Score field (29,2). All numeric fields on the student
records are in packed-decimal (PD) format.
The two-clause INCLUDE statement (see Figure 154) guarantees the selection of the
needed records from the file. The first clause (29,2,LT,25,2) guarantees that records with
Math Scores less than the Grade field are INCLUDED. The second clause (27,2,LT,25,2)
guarantees that records with Reading Scores less than the Grade field are also
INCLUDED. The OR connecting the two clauses guarantees that if either or both of the
scores are less than the Grade field, the record is selected. Finally, since all the fields are in
packed-decimal format (PD), FORMAT=PD is specified.
The sample record shown above will be INCLUDED because the student’s Math Score
(047F) is lower than the Grade level (050F).
Example: Records that have an Invoice Status Code of F (fully paid) are to be omitted in
preparing a list of only those customers with outstanding payments. (The input record lay-
out is given in Figure 155 and a sample input record is given in Figure 156.)
To produce this list of customers selected from the masterfile, the following is coded.
The OMIT statement’s condition, 80,1,CH,EQ,C'F', (see Figure 157) guarantees that invoice
records, like the sample record shown above, with the Invoice Status Code 'F' are omitted
from the sort.
MFX’s Data Utility features allow you to select only those record fields that contain neces-
sary data and to eliminate those that do not. More important, MFX enables you to do this
editing before the records are sorted. As a result, the sort has fewer bytes to handle and
processing is more efficient.
For complete syntax of the INREC control statement, see “INREC Control Statement” on
page 2.50.
INREC FIELDS=(p1,l1[,p2,l2,...,pn,ln])
p,l Specify the beginning position and length in bytes of the input record’s rele-
vant fields. When specifying contiguous fields, or fields that directly follow
one another, you can simply indicate the starting position of the first field
together with the combined length of the fields that are contiguous.
Example: A school wants to rank the entire student body by grade point index. This appli-
cation simply requires selecting the two relevant fields out of all the fields in the student
records and, then, sorting on the Grade Point Index field. (The Input Record layout is given
in Figure 159.)
To include only the relevant fields and generate the ranked list of students, the following is
coded:
Explanation: Specifying the two relevant data fields--the Social Security Number (1,9) and
the Grade Point Index (74,2)--on the INREC statement provides the sort with necessary
data for the application and eliminates the fields that are not relevant to the application.
INREC processing thus shortens each record to just a little under 14% of its original size.
Example: For an inventory list, the price code on the masterfile records is not necessary.
(The masterfile record layout is given in Figure 162.)
To eliminate the Price Code field and generate the inventory list, the following is coded.
Explanation: Specifying only those fields that are necessary eliminates those that are not
necessary for the application. The Price Code field (18,1) has not been specified on the
INREC statement; it will be deleted from the input records before the records are sorted by
item number for the list.
Example: For each volume in its collection, a library requires the catalog number and any
information concerning translations, other volumes in a series, additional copies on file,
and so on. The catalog file consists of variable-length records, and except for the catalog
To include only the relevant fields on the input records and to generate this list, the follow-
ing is coded.
Explanation: When selecting fields on variable-length records, you must observe these two
restrictions: (1) The position of the RDW cannot be affected; and (2) at least one byte from
the fixed-length portion of the record, in addition to the RDW, must be specified. On the
above INREC statement, the first 14 bytes of each record – the 4-byte RDW and the fixed-
length Catalog Number field – are retained unchanged. The next field – which contains
more information, as required – is indicated only by position (98) since it is of variable-
length. This causes the entire variable-length portion of the record (beginning with byte 98)
to be included after the initial 14 bytes of the post-INREC record. MFX automatically
adjusts the RDW to reflect the new record length.
The SUM control statement allows you to combine records in this way. For SUM control
statement syntax, see “SUM Control Statement” on page 2.253.
Example: For an inventory list, a company requires a single record for each product, indi-
cating its item number, warehouse code, and the total quantity in stock. (Figure 168 gives
the sample record layout.)
To combine those inventory records with identical item numbers and warehouse codes and
to produce the required list, the following is coded.
Explanation: The list is generated by sorting on the Warehouse Code field (6,1,CH) and the
Item Number field (1,5,ZD). Records that have identical information in both these fields are
combined into a single record that contains the sum or total of those records’ Quantity
fields (7,12,PD). That is, the single record will show how many items with the same number
are in each warehouse.
Example: A mailing list is being prepared from an invoice file. To eliminate duplicate
entries, any multiple invoice records for the same customer are combined into a single
record. (Figure 170 gives the sample record layout.)
To combine multiple invoice records and generate the mailing list, the following is coded.
Explanation: To prepare the customer mailing list, the only information required from the
invoice records is located in the Company Name field (17,23) and the Address field (40,5),
which are selected by the INREC statement. Sorting these records in ascending order by
company name generates an alphabetical list. Then, because the file contains a record for
every transaction, the SUM statement is used to avoid duplicate listings of customers who
have had more than one transaction. Note that because none of the fields contains numeric
data to be summed, the FIELDS=NONE parameter is used.
Joining Records
Example: A bank wants to join three separate files to produce a report that shows recent
transactions by customers, sorted by outstanding balance. The final report shows transac-
tion information from a transaction file, customer name and address data from a master
file containing basic customer information, and the outstanding balance from a third file
containing such information. The record layout for the transaction file is contained below in
Figure 172.
R T
N
BE U N R
M O O BE
U M I
T M
N A C U
N N A N
I O IO S
T T N ER
C C A M
SA SA TR TO
A
N
A
N TE S
A U
TR TR D C
1 78 15 16 26 27
CH CH CH ZD
1 31
ER S
M E ES
O M R
S T A D
U R N D
C BE A
ER ER
T ER UM M M
O
A
S N
ST S TO
M U U
C C
1 67 20 21
ZD CH CH
1 22
These two files can be joined on the transaction customer number from the first file and the
master customer number from the second file. These numbers are in zoned decimal (ZD)
format, but because all of the zones are the same in every record, these fields can be used as
character data for the join function.
Figure 174 contains the JCL and control statements to join these two files.
E
C
ER N
M LA
O
ST R BA
U G
C BE IN
R
E UM D
N
ST N TA
A
M TS
U
O
1 67
ZD CH
1 15
//**********************************************************
//*SECOND STEP:
//*JOIN INTERMEDIATE OUTPUT WITH OUTSTANDING BALANCE FILE FOR FINAL
//* REPORT.
//* THE REPORT WILL PRESENT THE DATA WITH HEADINGS INDICATING
//* THE FIELDS PROVIDED.
//*
//SORT2 EXEC PGM=SYNCSORT
//* INTERMEDIATE OUTPUT FILE (FIELDS IN DIFFERENT LOCATION, SO NEED
//* RENAMING)
//*DATE_TEMP,TRAN#_TEMP,TRANAMT_TEMP,TCUSTNO_TEMP,CUSTNAME_TEMP,
//*CUSTADDRESS_TEMP
//SORTJNF1 DD DSN=&&TEMP,DISP=(OLD,DELETE)
//*
//* OUTSTANDING BALANCE FILE
//*MCUSTNO OUTSTANDINGBALANCE
//SORTJNF2 DD *
7654C 00000.00
2111A 09876.54
2178I 00100.00
2123D 13555.22
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
*
*JOINKEYS FILE=F1,FIELDS=(TCUSTNO_TEMP)
*JOINKEYS FILE=F2,FIELDS=(MCUSTNO)
*REFORMAT FIELDS=(F1:DATE_TEMP,TRAN#_TEMP,TRANAMT_TEMP,TCUSTNO_TEMP,
* CUSTNAME_TEMP,CUSTADDRESS_TEMP,F2:OUTSTANDINGBALANCE)
*SORT FIELDS=(OUTSTANDINGBALANCE_RELOCATED)
*OUTREC FIELDS=(DATE_TEMP_RELOCATED,3X,OUTSTANDINGBALANCE_RELOCATED,3X,
* TRAN#_TEMP_RELOCATED,3X,TRANAMT_TEMP_RELOCATED,3X,
* TCUSTNO_TEMP_RELOCATED,3X,CUSTNAME_TEMP_RELOCATED,3X,
* CUSTADDRESS_TEMP_RELOCATED)
*
JOINKEYS FILE=F1,FIELDS=(27,5,ZD,A)
JOINKEYS FILE=F2,FIELDS=(1,5,ZD,A)
REFORMAT FIELDS=(F1:1,49,F2:7,8)
SORT FIELDS=(50,8,CH,A)
OUTREC FIELDS=(1,11,3X,50,8,3X,12,7,3X,19,8,3X,27,6,3X,33,14,3X,47,3)
OUTFIL FILES=OUT,HEADER2=('DATE ',3X,'OUTSTBAL',3X,
'TRAN# ',3X,'TRANAMT ',3X,
'CUST# ',3X,'CUSTOMER NAME ',3X,'ADD')
Example: A bank wants to produce a report of inactive customer accounts. These are
accounts for which there have been no recent transactions. The record layout for the trans-
action file was described previously in Figure 96 and the record layout was described in
Figure 97.
This can be done by doing the same join as detailed in Figure 100, but only retaining the
unpaired records from the master file (SORTJNF2) through the use of the JOIN control
statement. This is known as a “right outer join.”
INACTIVE CUSTOMERS
Example: In addition to the Inactive Customers report in the previous example, the bank
can produce an exception report of all transactions for which there is no master file cus-
tomer record, all within the same MFX execution. This is done by also including the
unpaired records from the transaction file (a “full outer join”). The output from the join
operation consists of records that either have data from the unpaired records in the trans-
action file or the data from the records in the master file. The missing data will be blanks in
each record. These records can then be reformatted and directed into two separate output
file reports, as follows.
Example: File 1 is a master file with an LRECL of 3400 and contains 140 million fixed-
length records. There is a unique 15-byte printable account number that appears in column
22 and you want to copy a large number of these records to a separate output file for further
processing. All records in this file are in account number sequence.
File 2 has an LRECL of 15 and contains 285,000 fixed-length records. The only field in
these records is a 15-byte printable account number. This file is also in account number
sequence.
Using join processing, you can execute an application where File 1 is the master file and
File 2 is your “finder” file. Join processing will create a new output file that will “copy” only
those records with account numbers that exist in File 2.
Note that the “SORTED” parameter has been added to each JOINKEYS control statement,
because the files are already in the desired sequence. If either file were not in account num-
ber sequence, the application would terminate with an error message. To address this prob-
lem, you would have to remove the applicable “SORTED” parameter from the
corresponding JOINKEYS control statement.
Example: This is a variation of the previous example. If you wanted to copy all of the
records in the master file except those with matching account numbers in the second file,
just add the following control statement to the JCL for that example:
JOIN UNPAIRED,F1,ONLY
After processing, you will probably want to edit this data so that it is easy to read. This is
bound to entail one or more of the following tasks:
• using masks or edit patterns to insert dollar signs, decimal points, slashes, and the like
Example: A data center has decided to reorder the positions of the data fields in masterfile
records after sorting them. (Figure 189 gives the layout for the masterfile record.)
To sort the records alphabetically by product name and reposition the data fields, the fol-
lowing is coded:
Explanation: After the records are sorted alphabetically by product name (7,15,CH),
OUTREC processing moves the Product Code field (22,3) to the first byte of the record, the
Product Name field (7,15) to the fourth byte, the Region field (1,2) to the nineteenth byte,
the Month’s Sales field (25,4) to the twenty-first byte, and the Sales to Data field (3,4) to
the twenty-fifth byte.
Example: The central office of a commercial bank requires that each branch present its
masterfile at the end of every month in the format outlined in Figure 192. Branch A, how-
ever, has formatted its masterfile records as outlined in Figure 193.
To reformat its masterfile records to conform to central office specifications, a bank branch
codes the following. Since the records do not require sorting, the MFX copy feature is used.
Figure 195 shows the effect of OUTREC processing on the output record.
Explanation: After the records are copied, OUTREC specifies two types of reformatting: (1)
repositioning data fields and (2) inserting blanks between fields. As shown in Figure 195,
two fields have been repositioned: the Account Type field now begins on the twenty-first
byte as opposed to the fifth byte, and the Account Number field begins on the fifth byte
rather than on the eighth. Also, blanks have been inserted using the nX entry to specify the
number (n) of blanks. Six blanks have been inserted after the Account Number field and a
single blank after the Account Type field. Since the Balance field and Interest field are con-
tiguous, they are treated as a single field in this application.
Example: A manufacturing firm has decided to expand its product line. However, because
the Item Number field on its inventory records is too small, the records must be reformat-
ted to allow for more columns for the new products. The Item Number is kept in packed-
decimal (PD) format, and the firm wants to add 4 bytes to the current 2 byte field. The new
bytes are to precede the current two bytes. Figure 196 gives the input record layout.
To copy the records and insert the 4 bytes of binary zeros, the following is coded.
Explanation: The records are copied, and OUTREC processing adds 4 bytes of binary zeros
(4Z) to the beginning of the Item Number field (21,2). To allow for the 4 additional bytes,
the original Item Number field and the fields following it are all copied after the 4 inserted
bytes of zeros.
Example: For a file of invoice records sorted by company name, the Invoice Amount,
Amount Paid, and Balance Due fields are to be converted from packed-decimal to printable
format. In addition, any leading zeros will be suppressed and both commas and decimal
points will be inserted. (Figure 199 gives the input record layout.)
The effect of OUTREC processing on the input record is shown in Figure 201 below.
Explanation: First the records are sorted alphabetically by company name (1,23,CH). Then,
three fields--the Invoice Amount (24,4,PD), the Amount Paid (28,4,PD), and the Balance
Due (32,4,PD)--are converted from packed-decimal (PD) into readable format and editing
by an MFX editing mask (M2) that suppresses the printing of leading zeros and inserts the
appropriate commas and decimal points. The number-colon entries (c:) that precede each of
the four fields assign a new starting position or, when printing, column for each of the four
fields. For example, the Company Name field, which originally began in byte 1 for a length
of 23 bytes, now begins in byte 17; the Invoice Amount field, which began in byte 24, begins
Example: A bank has discovered that some errors were made in recording the Account
Numbers of some of its customers. Specifically, on the transaction records, some Account
Number fields, which should contain only packed-decimal, PD, data, appear to contain data
that is not valid packed-decimal. Figure 202 shows the input record layout.
The effect of OUTREC processing on the input record is shown in Figure 204.
Explanation: The records are copied, and OUTREC processing reformats the output record
to contain the Customer Name field (1,30) followed in column 36 by the Account Number
field converted to hexadecimal format (31,12,HEX). Blanks are automatically inserted in
the unspecified columns (31,5). Note that converting the Account Number data to printable
hexadecimal expands the original 12-byte field to 24 bytes. The bank can now read the
Account Number field in hexadecimal format to determine which records contain invalid
data.
Example: For an Outstanding Payments report, the packed-decimal Amount Due field on a
company’s invoice records is converted to printable format and edited with a floating dollar
sign, commas, and a decimal point. In addition, to make the output easy to read, ten blanks
are inserted between the Company Name field and the Amount Due field. (Figure 205 gives
the input record layout.)
To sort the records and accomplish the conversion and editing, the following is coded.
Figure 207 shows the effect of OUTREC processing on the input record.
Explanation: First the records are sorted alphabetically by Company Name (1,23,CH).
Next, OUTREC processing inserts 10 blanks (10X) between the Company Name field (1,23)
and the Balance Due field (24,4,PD). OUTREC processing also converts this packed-deci-
mal field to printable format and edits it with the user-provided pattern specified on the
EDIT subparameter, EDIT=($II,IIT.TT). This pattern provides for a floating dollar sign as
well as the appropriate comma and decimal point. The Is indicate that leading zeros should
not be printed and the Ts indicate that zeros in those positions should be printed. Note that
this conversion and editing of the data cause the length of the Balance Due field to increase
from its original length of four bytes to ten bytes.
Example: The date field on insurance-policy records is stored in zoned-decimal format but
without slashes separating the month, day, and year. After the records are sorted, these
slashes will be inserted and the date will appear in the standard mm/dd/yy format. (Figure
208 gives the input record layout.)
To sort the records and format the date field with the required slashes, the following is
coded.
Explanation: The records are sorted alphabetically by Member Name (1,23,CH). The
OUTREC statement repositions the Effective Date field (24,6,ZD) and the Policy Number
field (30,8,ZD) in columns 30 and 45 respectively, leaving blanks between each of the three
fields. In addition, the OUTREC statement edits the Effective Date field with an M9
editing mask that places slashes between the month, date, and year. Note that editing the
Date field increases its size from six to eight bytes.
Example: In this example, there are three output files. The first is variable and the remain-
ing two are fixed-length format. The variable output file is the standard output file from
the sort. In order to convert the output from variable to fixed-length format, you should
specify CONVERT on the OUTREC parameters of each of your OUTFIL control state-
ments. The following are the JCL and control statements to effect this result.
Example: In this example, five input record fields, shown in Figure 212, are copied to an
output file with each field printed as a separate output line.
Multiple output lines are created by specifying a new line character, i.e. / (slash), in the
OUTREC parameter of an OUTFIL control statement. As shown in Figure 213, the new
line character follows the specification of each input field’s starting position and length.
Once MFX has printed the data in the COMPANY NAME field, it starts a new output line,
prints on it the data in the next field, CUSTOMER NAME, starts a new line, and so forth.
After printing the contents of the last field (CITY, STATE AND ZIP), MFX creates two new
lines (2/).
Figure 214 provides an excerpt from the output file where the input record is formatted on
multiple lines. A blank line appears in the second and third set of multiline output because
the corresponding input record fields (i.e. CUSTOMER TITLE and CUSTOMER NAME)
were blank.
To divide output into sections, use the SECTIONS parameter on the OUTFIL control state-
ment. For complete syntax of the SECTIONS parameter, see “SECTIONS Parameter
(Optional)” on page 2.115.
Example: A personnel roster is to be divided into sections by Department. (Figure 215 pre-
sents the layout for the input record.)
To sort the records and generate a list that is divided by Department, the following is
coded.
Explanation: After the records are sorted alphabetically by Department (15,5) and
Employee Name (1,14), they are divided into sections by department. That is, every time
there is a change in the Department field (15,5 in the input record) the printer skips 5 lines
(5L) before printing the next record. (Note, in the Sample Output above, the five-line break
that occurs between ACCTG and PRSNL.) The OUTREC parameter is used to reposition
the record fields and to leave blanks between them.
To generate Headers and/or Trailers, use the HEADER and TRAILER parameters of the
OUTFIL control statement. For complete syntax, see “HEADER1/HEADER2 Parameters
(Optional)” on page 2.94 and “TRAILER Parameters (Optional)” on page 2.101
Example: Marketing wants a title page for its monthly departmental sales report. The
three-line title will begin on line 16 and three blank lines will separate each line of the title.
The three lines will start printing in columns 49, 59, and 63, respectively.
Figure 219 shows the header that is generated by the above HEADER1 parameter:
D E P A R T M E N T A L S A L E S
F E B R U A R Y
2 0 0 4
Explanation: The HEADER1 parameter produces a header that will print on a separate
page, with no page number, at the beginning of the report. The first number-slash (n/) entry,
15/, causes the printer to skip 15 lines before printing. The following number-colon entry (c:),
49:, specifies the column in which the literal string 'D E P A R T M E N T A L S A L E S'
begins to print. Note that the literal string prints exactly as it is entered between the single
quotes, with a space between each letter and a double space between the words.
The next entry, 4/, causes the printer to skip 3 more blank lines before starting to print the
literal string 'F E B R U A R Y' in column 59.
Finally, three more lines are left blank (4/) and the literal string '2 0 0 4' begins printing in
column 63.
Example: Marketing wants the first line of every page of its departmental sales report to
contain the program number, report title, page number, and date. They want the third line
of every page to contain an identifying label for each column of data. Each of these lines will
begin printing in column one.
Figure 221 shows a representation of the header that is generated by the above HEADER2
parameter.
DEPARTMENT SALES MANAGER SALES REP SALES THIS PERIOD SALES YEAR TO DA
TE
Explanation: The HEADER2 parameter produces the page header shown above. Because
no forward spacing is specified, the page header begins on the first line of every page. Each
of the HEADER2’s number-colon entries (c:), for example, 1:, indicates the column in which
the entry following the colon begins to print. Thus, the literal 'PGM NUMBER 5' is printed
beginning in column 1, and so on. The &DATE and the &PAGE entries generate a current
date and a consecutive page number, respectively. The date and the page number appear
after the labels DATE: and PAGE:, which are specified like the other literals.
The double slashes (//) following the &PAGE entry direct the printer to forward space two
lines, that is, to leave one blank line, before printing the next group of literals that consti-
tute the labels for the columns of data.
Example: Marketing wants each section of its departmental sales report to have its own
heading. The heading will consist of one line containing an identifying label for each col-
umn of data. The heading will begin printing in column one.
Figure 223 shows the header that is generated by the above HEADER3 subparameter.
DEPARTMENT SALES MGR. SALES REP SALES THIS PERIOD SALES YEAR TO DATE
Example: Rather than repeat the department name and sales manager, which are identical
for every record included in a section of the departmental sales report, marketing wants
this information to appear only once-within the section headers of the report. Therefore,
the section headers’ first two entries (Department and Sales Manager) will be drawn
directly from the first data record in each section.
Figure 225 shows the header that is generated by the above HEADER3 subparameter.
OVER COUNTER CASEY SALES REP SALES THIS PERIOD SALES YEAR TO DATE
075 $14,000.00 $27,000.00
093 $13,550.00 $32,000.00
084 $11,755.00 $24,850.00
090 $12,250.00 $25,000.00
095 $13,075.00 $26,180.00
SURGICAL KILDARE SALES REP SALES THIS PERIOD SALES YEAR TO DATE
003 $11,750.00 $25,320.00
007 $14,300.00 $24,900.00
009 $11,110.00 $30,850.00
004 $13,375.00 $27,505.00
. . .
. . .
. . .
Figure 225. Sample Sections with HEADER3 Including Data from Input Record
Example: The final page of marketing’s departmental sales report will contain a note say-
ing that February sales figures include residual 1992 sales not previously recorded. This
note will begin on the 21st line of the page and start printing in the 33rd column of the
page.
Figure 123 shows the trailer that is generated by the above TRAILER1 parameter.
Explanation: The TRAILER1 parameter produces a report trailer or summary that consti-
tutes the final page of a report. Unless otherwise specified, it begins on the first line of the
page. The TRAILER1’s initial number-slash (n/) entry, 20/, directs the printer to forward
space 20 blank lines before printing on the 21st line. The next entry, a number-colon (c:)
entry, is used to center the literal string that follows it by having the string of characters
begin printing in the appropriate column. It specifies column 33 as the beginning position
for printing the literal string, 'FEBRUARY SALES FIGURES INCLUDE RESIDUAL 1992
SALES NOT PREVIOUSLY RECORDED'.
Example: Marketing wants the last line on every page of its departmental-sales report to
contain a note identifying the information as confidential. This line will begin printing in
column one.
Figure 229 shows the trailer that is generated by the above TRAILER2 parameter.
Explanation: The TRAILER2 coded above provides a trailer that appears at the bottom of
every logical page. The first entry, 5'*', a literal enclosed in single quotes (in this case an
asterisk) and a repetition factor (5), specifies that 5 asterisks should be printed. Because no
column was specified, the trailer begins in column one. The next entry, 'C O N F I D E N T I
A L I N F O R M A T I O N ', specifies that the literal string enclosed in the single quotes
should directly follow the asterisks. Note that the literal string is printed exactly as it is
coded within the quotation marks. That is, there is a blank between every letter and two
blanks between each word. The trailer’s other entries specify the printing of another five
asterisks followed by the literal string 'C O N F I D E N T I A L I N F O R M A T I O N '
and finally another five asterisks.
To generated total and subtotals, use the TOTAL and SUBTOTAL entries of OUTFIL’s
TRAILER parameters and subparameter. For details of syntax, see “TRAILER Parameters
(Optional)” on page 2.101
Example: The departmental sales report’s final page will be a summary containing both the
total for the sales this period and the total for the sales to date. The trailer will begin on the
21st line of the page and each total will have an identifying label.
Figure 231 shows the trailer that is generated by the above TRAILER1 parameter.
Explanation: The TRAILER1 parameter produces a report trailer or summary that consti-
tutes the final page of a report. Unless otherwise specified, it begins on the first line of the
page. This TRAILER1’s initial number-slash(n/) entry, 20/, directs the printer to forward
space 20 blank lines before printing. The next entry, a number-colon (c:) entry, is used to
center the literal string that follows it by having the string of characters begin printing in
the appropriate column. It specifies column 40 as the beginning position for the literal
string 'SALES THIS PERIOD:' that labels the numeric data following it. This TRAILER’s
other number-colon plus literal-string entry functions the same way.
The two TOT entries, TOT=(....), generate the trailer’s totals. These entries specify the
numeric data used and its format. Thus the four bytes of packed-decimal data that begin in
byte 24 (24,4,PD) and the four bytes that begin in byte 28 (28,4,PD) of the input record are
converted to printable format. This data is then edited by the EDIT pattern ($II,IIT.TT),
which suppresses the printing of leading zeros and inserts a floating dollar sign as well as a
necessary comma and decimal point. The pattern uses an I to indicate those zeros in the
total that should not be printed and a T to indicate those that should.
Example: The page trailer for a report listing invoices is to contain the totals for the
Amount Paid and the Balance Due fields of the invoice records printed up to and including
that page. These totals will appear directly below the columns of figures and be separated
from them by strings of hyphens. An identifying label, TOTALS:, will appear on the same
line as the totals and will begin in column 40.
Explanation: The above TRAILER2 provides for totaling the figures in the Amount Paid
field (46,4,PD) and the Amount Due field (54,4,PD) on the invoice records. Because the SUB
(SUBTOTAL) entry is specified, the totals that appear at the bottom of each page represent
running totals, that is, the totals for all the records that have been printed up to and includ-
ing that page. The TRAILER2 also generates the identifying label TOTALS: (40:'TOTALS:')
and strings of hyphens at the bottoms of the columns to be totaled (65:10'-', 86:10'-').
The totaled data for each field is converted to printable format and, after being edited,
begins printing in the columns specified with the two number colon entries (c:), 65: and 86:.
The data is edited by the EDIT pattern, ($II,IIT.TT), which suppresses the printing of lead-
ing zeros and inserts a floating dollar sign as well as the necessary comma and decimal
point. The pattern uses an I to indicate the zeros in the total that should not be printed and
a T to indicate those that should.
Example: The section trailer for an accounts receivable report sectioned by month is to con-
tain the totals for the Amount Paid and the Balance Due columns of each section. These
totals will appear directly below the columns of figures and be separated from them by
strings of hyphens. An identifying label, TOTALS:, will appear on the same line as the
totals and will begin in column 40.
Figure 235 shows the section trailer, with totals, that is produced.
The totaled data for each field is converted to printable format and, after being edited,
begins printing in the columns specified with the two number colon entries (c:), 65: and 86:.
The data is edited by the EDIT pattern, ($II,IIT.TT), which suppresses the printing of lead-
ing zeros and inserts a floating dollar sign as well as the necessary comma and decimal
point. The pattern uses an I to indicate the zeros in the total that should not be printed and
a T to indicate those that should.
Example: The section trailers for an accounts receivable report sectioned by data group
(AAA, BBB, etc.) are to contain six edited numeric values for a 6-byte field that begins at
byte 8 (8,6). The values to be printed are the following:
Each value will be preceded, on the same line, by appropriate identifying text. Two columns
of data will be printed.
The following shows two sections from the report, with the resulting values for submini-
mums, minimums, submaximums, maximums, subaverages and averages:
01 38.42
01 923.12
01 8,756.33
02 9,723.63
02 67.43
02 175.66
03 645.83
03 673.41
03 23.71
GROUP BBB
SECTION VALUE
01 0.01
01 456.11
01 874.01
02 4,354.00
02 2,583.54
02 3.57
03 809.01
03 934.53
03 853.21
Explanation: The SECTION parameter generates a section break on field 1,3, which identi-
fies data groups (AAA, BBB, etc.). The HEADER3 parameter defines section headers that
print the label "GROUP" followed by the data group identifier. HEADER3 also defines two
The TRAILER3 subparameters are SUBMIN, MIN, SUBMAX, MAX, SUBAVG and AVG.
They specify the six values to appear in the section trailer. The values are all derived from
the same field (8,6) and are suitably edited with mask M2 (8,6,ZD,M2).
The OUTREC parameter places the two data fields (5,2 and 8,6) in the report and edits the
8,6 field in the same way as for the six values in the section trailer (8,6,ZD,M2). The blank
space placed at position 80 (80:1X) ensures that the output record is long enough to contain
the header records.
To generate these counts, use the COUNT and SUBCOUNT subparameters (or COUNT15
and SUBCOUNT15). These subparameters can be used in conjunction with all other
TRAILER entries. For syntax of COUNT and SUBCOUNT (as well as COUNT15 and
SUBCOUNT15), see “TRAILER Parameters (Optional)” on page 2.101.
Example: Marketing wants a count of the total number of customers with outstanding pay-
ments included in the summary of its outstanding invoices report.
To get this record count and print it as part of the report summary, the following is coded.
Explanation: Since each record in the report represents an individual customer, coding the
COUNT entry in the TRAILER1 will provide the total number of customers with outstand-
ing payments. This TRAILER1 produces a report trailer, or summary, that constitutes the
final page of a report. It will print on the 21st line of the page (20/) and begin printing the
literal string 'NUMBER OF CUSTOMERS WITH OUTSTANDING PAYMENTS: ' in col-
umn 40.
Example: For an outstanding invoices report sectioned by month, marketing wants a cumu-
lative, or running, count of invoices to date at the end of each section as well as a total
count of each month’s invoices included as section trailers.
. . . .
. . . .
. . . .
RIBBIT TECHNOLOGIES 2/15/91 360.00 21.60
RICE FEATURES 12/15/91 750.00 75.00
SIDNEY COLLEGE 12/15/91 5,000.00 300.00
SNAP FEATURES 12/15/91 750.00 75.00
WEBB BROS CORP 12/15/91 600.00 36.00
WELLINGTON IMPORTS 12/15/91 750.00 45.00
WINIFRED INDUST 12/15/91 350.00 26.00
Figure 241. TRAILER3 Containing Record Counts and Cumulative Record Counts
Explanation: The trailer’s first / entry causes the printer to leave one blank line after the
data records and before printing the trailer. The second / entry indicates the end of the
Note: All the output files will be sequenced in the same way, as specified on the SORT or
MERGE statement. If you need to sort the output files differently, you should use MFX
PipeSort, a Syncsort product that works with MFX to reduce total elapsed time by generat-
ing multiple, differently sequenced output files from a single read of the input data.
To generate multiple output files, code the OUTFIL statement. For syntax of the OUTFIL
control statement, see “OUTFIL Control Statement” on page 2.82.
Example: Marketing wants three output files of customer records. The first will contain a
list of U.S. and European customers. The second will contain a list of U.S. customers only,
and the third will contain a list of European customers only.
Explanation: Creating the three requested output files requires coding three SORTOFxDD
statements in the JCL: SORTOF1, SORTOF2, and SORTOF3 as well as three OUTFIL
statements. Each of the OUTFIL statements is connected by a FILES parameter to one of
the output files defined in the JCL. Specifying 1 on the FILES parameter connects its
OUTFIL statement with the output file defined by the SORTOF1 DD statement in the JCL.
Likewise, specifying 2 connects its OUTFIL statement with the output file defined by
SORTOF2, and so on. The first output file will contain all the records from the input file
(INCLUDE=ALL). The second output file will include only those records that contain the
character string 'USA' beginning in byte 67, (INCLUDE=(67,3,CH,EQ,C'USA')), which
indicates that these records are for USA customers. And similarly, the third output file will
include only those records that contain the character string 'EUR' beginning in byte 67,
which indicates that these records are for European customers.
Example: Personnel wants a printed copy of its updated masterfile as well as copies on disk
and on tape.
To generate these three copies of the same file on different devices, the following is coded.
Explanation: Creating the three copies of the updated masterfile requires coding only one
OUTFIL statement with a FILES parameter. The FILES parameter instructs MFX to look
for multiple output files defined in the JCL and to send its output to the devices specified in
the SORTOFxx statements. Thus, the output that has been sorted as specified on the SORT
statement (1,40,CH,A) will be sent to the printer specified in the SORTOFPR statement, to
the tape volume specified in the SORTOFTP statement, and to the disk data set specified
in the SORTOFDS statement.
The OUTREC parameter of each OUTFIL reformats the input records to add spacing
between fields and reformats a ZD field as a dollar amount. HEADER2 and TRAILER2
parameters add a page header and trailer with a date and total amount.
On the following pages, Figure 244 contains the JCL and control statements required to
produce the generated PDF report in Figure 245.
MFX’s job control statements follow the standard operating system conventions described
in the z/OS job control language manuals. Each program application therefore requires a
JOB statement, an EXEC statement, and a DD (data definition) statement for every data
set used. (The single exception to this is the dynamic allocation of work files via DYNAL-
LOC or DYNATAPE.) The inclusion and coding requirements of particular job control
statements depend on such factors as whether MFX is program-invoked or initiated
directly, whether any exits are coded, and, of course, whether the sorting technique
requested is Disk Sort, MAXSORT, or PARASORT.
All aspects of program initiation which are specific to the sort/merge (such as the dedicated
DD names SORTIN and SORTOUT) are documented in this chapter. For complete coding
instructions, refer to a z/OS MVS JCL reference manual.
EXEC Statement
The EXEC statement is required in order to indicate to the operating system that the job is
a sort/merge application. For a Disk Sort, the format of the EXEC statement is as follows.
To use a sort cataloged procedure, omit PGM= and specify the appropriate procedure name.
PGM=SYNCSORT
PGM=SORT
//stepname EXEC PGM=IERRCO00 [,PARM='...']
PGM=IGHRCO00
PGM=ICEMAN
The PARM parameter may be used to pass the sort/merge program a variety of keyword
parameters, modifying it to meet the needs of the individual application.
STEPLIB/JOBLIB DD Statement
If MFX has been installed in a private user library or in a test library, a STEPLIB or
JOBLIB DD statement is required. The sample DD statement below instructs the operat-
ing system to look for the sort in a partitioned data set named SYNCTEST.
//STEPLIB DD DSN=SYNCTEST,DISP=SHR
SYSOUT DD Statement
This defines the data set for MFX messages.
//SYSOUT DD SYSOUT=A
SORTIN DD Statement
The SORTIN DD statement defines the data set(s) to be sorted or copied. (The input files
for a merge application are defined by the SORTINnn DD statement.) It is required for all
sorts except those where an E15 exit (COBOL Input Procedure) provides all the input
records or where the MULTIIN facility or join facility is used. The MULTIIN facility is used
to combine VSAM and non-VSAM data sets as input to a SORT or COPY, and SORTMInn
DD statements are used in place of SORTIN. The join feature joins records from two input
files that are specified on the SORTJNF1 and SORTJNF2 DD statements.
The SORTIN file must have physical sequential or extended sequential organization or be a
member of a partitioned data set or PDSE. It may reside on any device supported by BSAM
or VSAM and if it is a VSAM data set, may be key-sequenced, entry-sequenced or relative
record. SORTIN data sets may also be BatchPipes or z/OS pipes or they may be HFS data
sets. DCB information need not be supplied for a disk or standard labeled tape file. Any of
the information accessed from a standard label can be overridden by coding the appropriate
DCB parameter in the JCL.
The maximum record lengths supported are 32,760 bytes for fixed-length records and
32,767 bytes for variable-length records.
By default MFX does not accept an uninitialized SORTIN data set and will terminate pro-
cessing with a WER400A message. An uninitialized data set is one that has been newly cre-
ated but never successfully closed. The UNINTDS PARM or installation option can be used
to change MFX’s default mode of processing to accept an uninitialized input data set and
process it as an empty file. See “UNINTDS” on page 5.30.
In this example, the data set to be sorted/copied is named SALESIN. It resides on one reel
//SORTIN DD DSN=SALESIN,DISP=(OLD,KEEP),
// UNIT=TAPE,VOL=SER=123456
of tape whose volume serial number is 123456. SALESIN is the first data set on that tape
and has a standard label.
To access a SORTIN data set that resides in hiperbatch use the HBSI PARM. For more
information about HBSI see “Chapter 5. PARM Options”.
Note: RLS mode (RLS=CR and RLS=NRI) or Linear VSAM data sets are not supported for
input or output.
The SORTIN file may consist of concatenated data sets, up to the limit supported by the
operating system. (Note: If you want to combine VSAM and non-VSAM files as input to a
SORT or COPY, use the MULTIIN facility described in Chapter 12.)
MFX must determine one set of DCB characteristics to use for reading all data sets in the
concatenation. The following rules apply to the DCB characteristics:
• When the first data set is fixed-length (RECFM=F, FB, FBS), all subsequent data sets
must be fixed-length and have the same LRECL.
• When the first data set is variable-length (RECFM=V, VB, VS, VBS), all subsequent
data sets must be variable-length.
• For variable-length data sets, the LRECL of the first data set is used except for the
following situations:
• The LRECL of a subsequent data set is used if that LRECL is the largest found and
is available at sort initialization. An LRECL is available at initialization if it is
specified on a SORTIN DD statement or exists in the label of a SORTIN disk data
set.
• A record length specified via the l1 value on the RECORD control statement is used
if it is the largest record length found.
• For both fixed and variable-length data sets, the BLKSIZE of the first data set is used
unless the BLKSIZE of a subsequent data set is the largest found and is available at
sort initialization. A BLKSIZE is available at initialization if it is specified on a
SORTIN DD statement or exists in the label of a SORTIN disk data set.
The following shows sample JCL for concatenating input data sets:
Figure 250. Sample Disk and Tape Data Set Concatenation to SORTIN
In the preceding example, one disk and two tape data sets have been concatenated. Any one
of these data sets could be presented first. Position is not dependent upon BLKSIZE or
LRECL. If the LRECL or BLKSIZE cannot be determined at SORT initialization, the first
data set must carry the largest LRECL or BLKSIZE of the concatenation. Typically the
LRECL or BLKSIZE cannot be determined when the input consists of concatenated tape
data sets and the JCL lacks a DCB specification.
The MAXSORT technique is recommended for sorting very large amounts of data when
disk work space is limited. With this technique, SORTWK requirements are independent of
SORTIN size; thus, regardless of the size of the file, it can be sorted by one sort program
using disk work files. MAXSORT’s breakpoint/restart capability breaks the overlarge sort-
ing application into smaller individual sorts; high priority jobs can execute between these
smaller sorts without forcing any data to be resorted. See “Chapter 9. MAXSORT”.
The PARASORT technique can be used to improve elapsed time performance of sorts that
use multi-volume or concatenated tape SORTIN data sets. (See “Chapter 10. PARASORT”.)
All input data sets must have the same record format (fixed or variable), and the records in
each input file must already be in the desired sequence.
By default, MFX does not accept an uninitialized SORTINnn or SORTINn data set and will
terminate processing with a WER400A message. An uninitialized data set is one that has
been newly created, but never successfully closed. The UNINTDS PARM or installation
option can be used to change MFX’s default mode of processing to accept an uninitialized
input data set and process it as an empty file. (See “UNINTDS” on page 5.30.)
//SORTIN17 DD DSNAME=BRANCHA.FICA,VOL=SER=131313,
// DISP=OLD,UNIT=3480
//SORTIN01 DD DSNAME=BRANCHC.FICA,VOL=SER=242424,
// DISP=OLD,UNIT=3390
//SORTIN24 DD DSNAME=BRANCHB.FICA,VOL=SER=121212,
// DISP=OLD,UNIT=3400-3,LABEL=(,NL),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=400)
In this example, the DCB information for the first two of the three files to be merged is sup-
plied by the file labels. In order for the merge to execute, these files must have a RECFM of
F or FB, as indicated by the third file’s RECFM value.
//SORTJNF1 DD DSNAME=BRANCHA.FICA,VOL=SER=131313,
// DISP=OLD,UNIT=3480,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
//SORTJNF2 DD DSNAME=MASTER.FICA,VOL=SER=121212,
// DISP=OLD,UNIT=3390,
// DCB=(RECFM=VB,LRECL=200,BLKSIZE=27800)
//SORTOUT DD DSN=MASTER.OUT,UNIT=SYSDA,
// DISP=(NEW,KEEP),SPACE=(TRK,10),
// VOL=SER=DSK002
//SORTOF01 DD DSN=REPORT.OUT,UNIT=SYSDA,
// DISP=(NEW,KEEP),SPACE=(TRK,10),
// VOL=SER=DSK002
In the preceding example, the missing DCB parameters except BLKSIZE will default to
those assigned to SORTIN or (for a merge application) to those assigned to the last
SORTINnn in the JCL stream. The DCB BLKSIZE, if missing, will be determined via
system-determined blocksize when it is active or from SORTIN if SORTOUT and SORTIN
LRECLs are the same, otherwise MFX will select an appropriate BLKSIZE.
If a sort or a merge has an LRECL specified in the output DD JCL that is found to be
smaller than the internally processed record length (determined from SORTIN, the
LENGTH values of a RECORD statement, or an INREC statement), MFX processing will
If RECFM is specified and the report writing features of the OUTFIL control statement are
being used, the RECFM of the output file must include the 'A' subparameter, except when
the REMOVECC parameter is in use.
For a COPY or MERGE, the output file must not be the same as any of the input files.
Note: The TYPE parameter on the RECORD control statement should be specified if
SORTIN is VSAM. If TYPE is not provided, the SORTOUT RECFM will be examined to
determine the SORTIN TYPE. If no SORTOUT RECFM is found, TYPE=V will be assumed
if the SORTOUT is VSAM and TYPE=F if the SORTOUT is non-VSAM.
Note: RLS mode (RLS=CR and RLS=NRI) or Linear VSAM data sets are not supported for
input or output.
Secondary Allocation
If the automatic secondary allocation option was enabled at installation time, requesting
secondary allocation on the output DD statements is not required. This feature automati-
cally provides output space for each of the output files.
To place a SORTOUT data set into hiperbatch so that subsequent job steps can access it,
use HBSO. For more information about HBSO see the PARM Option chapter in this man-
ual.
You can specify 3380 and/or 3390 disk devices. When device types are mixed, each device is
used to full capacity. Note that although SORTWK space can be allocated in blocks, tracks,
or cylinders, allocating in cylinders will yield optimal performance. The CONTIG option of
the SPACE parameter should be avoided since it may delay allocation and offers no perfor-
mance advantage.
//SORTWK02 DD UNIT=3390,SPACE=(CYL,20)
Secondary Allocation
There is no need to specify RLSE and a secondary allocation value on the SORTWKxx DD
statement at installations that have set these defaults at MFX installation time.
SORTWKxx DD statements are not used for merge or copy applications. They are not
required for sorts executed using the DYNALLOC option. Provided neither DYNALLOC
nor FIELDS=COPY is in effect, it will be necessary to include SORTWK data sets when-
ever any of these conditions holds:
• Checkpoint-Restart is specified.
• The criteria for an incore sort are not met. (See the discussion of incore sorts in
“Chapter 14. Performance Considerations”.)
Note: Sort applications that use SUM, DUPKEYS, OUTREC, OUTFIL or VSAM
SORTOUT and do not provide JCL SORTWORKs may have DYNALLOC automatically
enabled. This will allow the completion of a sort that would have terminated for lack of
required SORTWORK space.
//SYSIN DD *
SORT FIELDS=(5,3,CH,A)
OMIT COND=(12,6,PD,EQ,0)
END
/*
$ORTPARM DD Statement
The data set defined by the $ORTPARM DD statement may contain PARM parameters and
any of the sort control statements.
Parameters and control statements passed via the $ORTPARM DD statement generally
override all others passed, whether the sort/merge is called from a program or initiated
through job control language.
The $ORTPARM DD record format must be F or FB, and the record length must be 80
bytes. Labels are not allowed on $ORTPARM card images. Leading blanks are not required
on a PARM card image, but at least one leading blank must precede a sort control state-
ment keyword.
The $ORTPARM data sets must be formatted in accordance with the following rules:
• PARM specifications included in the $ORTPARM data sets must be specified before any
sort control statement specifications.
• PARMS must be specified without the keyword PARM= and without quotation marks.
• A comma in columns 2-70 of a PARM card image followed by a blank, or a comma alone
in column 71, may be used to indicate that the next record is part of the current
statement. However, if the PARM specification is present through column 71, a
continuation character must be specified in column 72 to indicate continuation.
The following example of a $ORTPARM data set illustrates the conventions for defining the
$ORTPARM data set.
//$ORTPARM DD *
BMSG,STOPAFT=500,
EQUALS
SORT FIELDS=(1,8,PD,A)
The $ORTPARM data set in the previous example overrides the options set in the associ-
ated invoking program (or job control stream) to sort 500 records from the input file. These
will be the first 500 records that meet whatever criteria have been set by the original appli-
cation (which might include, for example, the INCLUDE/OMIT control statement). BMSG
turns on the WERnnnB message set, so that the processing accorded these 500 records is
fully documented. EQUALS preserves the order of equal-keyed records from input to out-
put.
//$ORTPARM DD *
BMSG,STOPAFT=500,
EQUALS
SUM FIELDS=(12,4,30,8,38,8),
FORMAT=PD
SORT FIELDS=(1,8,PD,A)
The preceding example illustrates how to include control statements more than 80 bytes
long; continuation card images are indicated by a blank field following an operand-comma
combination.
In this example, the OUTFIL control statement in $ORTPARM overrides the OUTFIL con-
trol statement in SYSIN for file 3, and adds OUTFIL specifications for files 4 and 5.
The $ORTPARM DD facility is particularly useful for COBOL sorts requiring century win-
dow processing of year data with MFX’s year data formats. The year data formats are not
supported by COBOL. Therefore, when a data format specification needs to be changed for
century window processing, it is necessary to override SORT control statements generated
by COBOL. The override can be accomplished with a $ORTPARM DD statement. The fol-
lowing example shows a $ORTPARM DD used for this purpose.
//$ORTPARM DD *
SORT FIELDS=(10,2,Y2Z,A),CENTWIN=1980
In this example, the 2-digit year field (10,2) will have century window processing applied to
it via the Y2Z year data format and the CENTWIN option.
As described in the previous section, multiple sort invocations by the same COBOL pro-
gram would require multiple $ORTPARM DD statements, each with the FREE=CLOSE
parameter.
When MFX is to be invoked more than once in the same job step, you may need different
$ORTPARM DD control data sets for each invocation. For multiple control data sets, define
each one in the JCL stream, in the desired order, as a disk data set (or partitioned data set
member) with the FREE=CLOSE parameter added. FREE=CLOSE will cause the first sort
//$ORTPARM DD DSN=SORT.OPTIONS(SORT1),DISP=SHR,FREE=CLOSE
//* WILL BE USED BY FIRST SORT EXECUTION
//$ORTPARM DD DSN=SORT.OPTIONS(SORT2),DISP=SHR,FREE=CLOSE
//* WILL BE USED BY SECOND SORT EXECUTION
.
.
//$ORTPARM DD DSN=SORT.OPTIONS(SORTn),DISP=SHR,FREE=CLOSE
//* WILL BE USED BY THE nTH SORT EXECUTION
Processing will proceed from top to bottom of this $ORTPARM data set list. This sequence
must be maintained in the JCL so that the multiple sorts can read the $ORTPARM data
sets in the correct order.
Multiple $ORTPARM data sets are available only in a JES2 environment. JES3 does not
support the specification of multiple DD statements for the same DDNAME.
SORTCKPT DD Statement
This DD statement is only used when the CKPT/CHKPT option is set on the
SORT/MERGE control statement, requesting the Checkpoint-Restart feature. See “The
Coding and Use of Checkpoint-Restart” on page 14.8 for an explanation of this feature.
SORTMODS DD Statement
The partitioned data set defined must be large enough to contain all the exit routines
entered in SYSIN. For exits not entered in SYSIN, it is necessary to supply DD statements
defining the libraries in which the routines reside.
//SORTMODS DD SPACE=(CYL,(2,,4)),UNIT=SYSDA
The SYSLIN DD statement defines the temporary data set that will contain the linkage
editor control statements created by MFX for the exit routine(s).
//SYSLIN DD DSN=&&TEMP,UNIT=SYSDA,SPACE=(TRK,1)
SYSLMOD DD Statement
The SYSLMOD DD statement defines the temporary data set that will contain the link-
edited exit module(s).
//SYSLMOD DD DSN=&&TEMP2,UNIT=SYSDA,
// SPACE=(TRK,(10,5,2))
SYSPRINT DD Statement
The SYSPRINT DD statement defines the message data set for the link-editing of sort
exits.
//SYSPRINT DD SYSOUT=A
STDOUT DD Statement
The STDOUT DD statement defines the informational message data set used by Java dur-
ing the creation of PDF, RTF and HTML files via the OUTFIL OUTPUT facility.
//STDOUT DD SYSOUT=*
STDERR DD Statement
The STDERR DD statement defines the error message data set used by Java during the
creation of PDF, RTF and HTML files via the OUTFIL OUTPUT facility.
The PARASORT technique is initiated by means of the PARASORT PARM and utilizes
additional PARASORT DD statements (SORTPAR1, SORTPAR2, SORTPAR3,
SORTPAR4). PARASORT requires disk SORTWK devices. This technique can improve the
elapsed time of sorting applications that have multi-volume tape SORTIN data sets. See
“Chapter 10. PARASORT”.
The DB2 Query Support technique is initiated by means of the DB2 Query Support PARM
and utilizes the DB2 Query Support DD statement SORTDBIN. This technique allows DB2
data to be passed directly into a SORT or COPY operation, without the use of setup steps or
the need for user-written E15 exits. See “Chapter 11. MFX DB2 Query Support”.
The MULTIIN facility is initiated by means of the MULTIIN PARM and utilizes SORTMInn
DD statements. This facility allows the combination of VSAM and non-VSAM files as input to a
SORT or COPY operation. See “Chapter 12. Multiple Input Files”.
Example 1
//SORTOMIT JOB 1
//SORT1 EXEC PGM=SYNCSORT,PARM='STOPAFT=1000' 2
//STEPLIB DD DSN=SORT.RESI.DENCE,DISP=SHR 3
//SYSOUT DD SYSOUT=A 4
//SORTIN DD DSN=INPUT,UNIT=3490, 5
// VOL=SER=012345,DISP=(OLD,KEEP),
// DCB=(LRECL=100,RECFM=FB,
// BLKSIZE=32700),LABEL=(1,SL)
//SORTOUT DD DSN=OUTPUT,VOL=SER=543210, 6
// UNIT=3490,DISP=(NEW,KEEP),
// DCB=(LRECL=100,RECFM=FB,
// BLKSIZE=0),LABEL=(1,SL)
//SORTWK01 DD SPACE=(CYL,(20)),UNIT=SYSDA 7
//SORTWK02 DD SPACE=(CYL,(20)),UNIT=SYSDA
//SORTWK03 DD SPACE=(CYL,(20)),UNIT=SYSDA
//SORTWK04 DD SPACE=(CYL,(20)),UNIT=SYSDA
//SORTWK05 DD SPACE=(CYL,(20)),UNIT=SYSDA
//SYSIN DD * 8
SORT FIELDS=(1,8,CH,A) 9
OMIT COND=(1,8,CH,EQ,C'JOHN DOE') 10
END 11
/* 12
3. The STEPLIB DD statement instructs the system to look for MFX in the library named
SORT.RESI.DENCE. The DISP indicates that this library may be shared.
4. The SYSOUT DD statement assigns the MFX messages to the output device associated
with SYSOUT class A.
5. The SORTIN DD statement gives INPUT as the input data set name, specifies a 3490
tape unit with the volume serial number 012345. The data set is already in existence.
The DCB parameter shows an LRECL of 100 bytes, a fixed blocked RECFM, and a
32700-byte BLKSIZE. The LABEL parameter shows that INPUT is the first data set on
the tape, and that it has a standard label.
The DCB parameter for SORTOUT specifies the same LRECL and RECFM as
SORTIN. The BLKSIZE will be selected by System Determined BLKSIZE (SDB) if
active or by MFX if SDB is not active.
7. The five SORTWKxx DD statements reserve space on direct access devices for
intermediate storage. Twenty cylinders are allocated for each of the five SORTWKxx
data sets.
8. The SYSIN DD * statement marks the beginning of the system input stream that
includes the sort control statements.
9. The SORT control statement specifies that one control field will be sorted on. It begins
on byte 1 of the record, is 8 bytes long, contains character data, and is to be sorted in
ascending order.
10. The OMIT control statement eliminates any record with JOHN DOE in its first eight
bytes (i.e., in the sort control key). JOHN DOE records are not sorted and are not
included in the STOPAFT figure. The EXEC statement’s STOPAFT PARM terminates
the sort after 1,000 (non-JOHN DOE) records have been put into the proper sequence.
11. The END control statement marks the end of the control statements.
12. The delimiter statement marks the end of the SYSIN input stream.
//SUMSORT JOB 1
// EXEC PGM=SYNCSORT,PARM='EQUALS' 2
//STEPLIB DD DSN=SORT.RESI.DENCE,DISP=SHR 3
//SYSOUT DD SYSOUT=A 4
//SORTIN DD DSN=FEB92,EMPLOYEE.MASTER, 5
// UNIT=3490,VOL=SER=135790,
// DISP=(OLD,KEEP)
// DD DSN=FEB92.EMPLOYEE.UPDATE,
// UNIT=3490,VOL=SER=999999,
// DISP=(OLD,KEEP)
//SORTOUT DD DSN=MAR92.EMPLOYEE.MASTER, 6
// UNIT=3490,VOL=SER=246809,
// DISP=(NEW,KEEP)
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,20) 7
//SYSIN DD * 8
SORT FIELDS=(1,9,ZD,A,10,2,BI,A) 9
SUM FIELDS=(12,4,PD) 10
/* 11
3. The STEPLIB DD statement instructs the system to look for MFX in the library named
SORT.RESI.DENCE. The DISP shows the library may be shared.
4. The SYSOUT DD statement assigns the MFX messages to the output device associated
with class A.
5. The SORTIN DD statements define the input to be copied: two concatenated data sets
— FEB92.EMPLOYEE.MASTER and FEB92.EMPLOYEE.UPDATE. They are found
on standard labeled 3490 tape units (volume serial numbers 135790 and 999999,
respectively). These data sets are already in existence.
8. The SYSIN DD statement marks the beginning of the system input stream that
includes the sort control statements.
9. The SORT control statement specifies that two control fields will be sorted on. The
major control field begins on byte 1 of the record, is 9 bytes long, contains zoned decimal
data, and is to be sorted in ascending numerical order. The second, less significant,
control field is found in the next two bytes of the record (bytes 10 and 11), is in
(unsigned) binary format, and is to be sorted in ascending order.
10. Whenever two records have equal control fields, the sort will attempt to sum them. If
the result of summing the packed decimal data found in the 4-byte field beginning at
byte 12 can be contained in four bytes, one of the two records will be retained, the sum
stored in bytes 12-15, and the other record will be deleted. The EQUALS PARM
guarantees that the first of the two records will be preserved; thus, if a record from the
FEB92.EMPLOYEE.MASTER file has the same key as one from the
FEB92.EMPLOYEE.UPDATE file, it is the master record which is retained in the
output file, containing their sum.
11. The delimiter statement marks the end of the SYSIN input stream.
//SORTSKIP JOB 1
// EXEC PGM=SYNCSORT 2
//$ORTPARM DD * 3
STOPAFT=100
//STEPLIB DD DSN=SORT.RESI.DENCE,DISP=SHR 4
//SYSOUT DD SYSOUT=A 5
//SORTIN DD DSN=EXPORT.SHIPPING.VOL6, 6
// UNIT=TAPE,VOL=SER=112233,
// DISP=(OLD,KEEP)
//SORTOUT DD DSN=RECENT.MAJOR.EXPORTS, 7
// UNIT=TAPE,VOL=SER=332211,
// DISP=(NEW,KEEP)
//SORTWK01 DD SPACE=(CYL,20),UNIT=SYSDA 8
//SORTWK02 DD SPACE=(CYL,20),UNIT=SYSDA
//SORTWK03 DD SPACE=(CYL,20),UNIT=SYSDA
//SYSIN DD * 9
SORT FIELDS=(19,5,CH,A), 10
EQUALS,SKIPREC=1000
INCLUDE COND=(37,4,BI,GE,X'50') 11
/* 12
3. The $ORTPARM DD statement is used here to initiate a test run of the SORTSKIP job
by supplying the STOPAFT PARM to MFX. It instructs MFX to terminate after sorting
the first 100 of the records INCLUDE selects from the SKIPREC-edited input file.
4. The STEPLIB DD statement instructs the system to look for MFX in the library named
SORT.RESI.DENCE. The DISP indicates that this library may be shared.
5. The SYSOUT DD statement assigns the MFX messages to the output device associated
with SYSOUT class A.
8. The three SORTWKxx DD statements reserve space on direct access devices for
intermediate storage. Twenty cylinders are allocated for each SORTWK data set.
9. The SYSIN DD statement marks the beginning of the system input stream that
includes the sort control statements.
10. The SORT control statement specifies that one control field will be sorted on. It begins
on byte 19 of the record, is 5 bytes long, contains character data, and is to be sorted
according to ascending order. The EQUALS parameter preserves the SORTIN order of
records with identical data in these five bytes. The SKIPREC parameter eliminates the
first 1,000 records of the SORTIN file from consideration; these records are eliminated
before the INCLUDE statement takes effect.
11. The INCLUDE statement compares the 4 bytes beginning with byte 37 of the record to
the hexadecimal literal, which will be padded on the right with binary zeros to the
indicated (4 byte) length. The record is eliminated from the sort unless the binary data
in that field is at least as great as the padded constant. The INCLUDE/OMIT
statement takes effect after SKIPREC but before STOPAFT.
12. The delimiter statement marks the end of the SYSIN input stream.
Example 4
//EDITMERG JOB 1
//MERGE1 EXEC PGM=SYNCSORT 2
//STEPLIB DD DSN=SORT.RESI.DENCE,DISP=SHR 3
//SYSOUT DD SYSOUT=A 4
//SORTIN08 DD DSN=SALES91,UNIT=TAPE, 5
// VOL=SER=123456,DISP=(OLD,KEEP)
//SORTIN12 DD DSN=SALES92,UNIT=TAPE,
// VOL=SER=654321,DISP=(OLD,KEEP)
//SORTIN03 DD DSN=SALES93,UNIT=3390,
// VOL=SER=DISK11,DISP=SHR
//SORTOUT DD DSN=SALES.PATTERN,UNIT=3390, 6
// VOL=SER=DISK08,DISP=(NEW,KEEP),
// SPACE=(CYL,5),
// DCB=(LRECL=20,RECFM=VB,
// BLKSIZE=27980)
//SYSIN DD * 7
MERGE FIELDS=(5,4,ZD,A) 8
RECORD TYPE=V,LENGTH=(100,,20) 9
INREC FIELDS=(1,8,29,6,12,6) 10
/* 11
3. The STEPLIB DD statement instructs the system to look for MFX in the library named
SORT.RESI.DENCE. The DISP shows the library may be shared.
4. The SYSOUT DD statement assigns the MFX messages to the output device associated
with SYSOUT class A.
5. Three data sets are to be merged: SALES91, SALES92 and SALES93. SALES91 and
SALES92 are found on standard labeled tapes with the volume serial numbers 123456
and 654321, respectively. The DD statement for SALES93 specifies a 3390 disk device
with the volume serial number DISK11. These three data sets are already in existence,
and the disk data set SALES93 may be shared. They are assigned distinct SORTINnn
numbers, as required.
6. The SORTOUT DD statement assigns the name SALES.PATTERN to the output data
set and specifies a 3390 disk device with the volume serial number DISK08. Five
7. The SYSIN DD statement marks the beginning of the system input stream that
includes the sort control statements.
8. The MERGE control statement specifies one control field. It begins on byte 5 (the first
data byte of the record since TYPE=V is specified on the RECORD statement) and is 4
bytes long. This field contains zoned decimal data and is to be merged in ascending
order.
9. The RECORD statement indicates that variable-length records are being merged and
indicates the record length at various processing stages. The maximum input record
length is specified as 100 bytes. Since there is no E15, the post-E15 length value is not
coded and so defaults to this figure. The INREC statement reduces this maximum
record length to just 20 bytes.
10. According to the RECORD control statement, the input record may be 100 bytes long.
The INREC statement reduces each record to the 20 bytes crucial to this application:
the 4-byte RDW and 4-byte merge control field (i.e., the first 8 bytes of the record), the
6-byte field beginning at byte 29 (the 25th data byte) and the 6-byte field beginning at
byte 12 (the 8th data byte). As required, the RDW remains in the first four bytes. The
records to be merged are no more than 20 bytes long and contain three fields following
the RDW.
11. The delimiter statement marks the end of the SYSIN input stream.
Example 5
//COPYNYC JOB 1
//COPY1 EXEC PGM=SYNCSORT 2
//STEPLIB DD DSN=SORT.RESI.DENCE,DISP=SHR 3
//SYSOUT DD SYSOUT=A 4
//SORTIN DD DSN=USA.OUTLETS,UNIT=TAPE, 5
// VOL=SER=149200,DISP=(OLD,KEEP)
//SORTOUT DD DSN=NYC.OUTLETS,UNIT=3390, 6
// VOL=SER=DISK08,SPACE=(CYL,5),
// DISP=(NEW,KEEP)
//SYSIN DD * 7
SORT FIELDS=COPY 8
INCLUDE COND=(56,3,CH,EQ,C'NYC') 9
/* 10
3. The STEPLIB DD statement instructs the system to look for MFX in the library named
SORT.RESI.DENCE. The DISP shows the library may be shared.
4. The SYSOUT DD statement assigns the MFX messages to the output device associated
with SYSOUT class A.
5. The SORTIN DD statement indicates the file to be copied. The data set name is
USA.OUTLETS, and it is found on the standard labeled tape with the volume serial
number 149200. The data set is already in existence.
6. The SORTOUT DD statement names the copied file NYC.OUTLETS, and specifies a
3390 disk device with the volume serial number of DISK08. Five cylinders of primary
space have been allocated on this volume. The data set does not yet exist, but is to be
kept whether or not the job terminates normally. The DCB RECFM and LRECL
parameters for SORTOUT default to that of the first SORTIN file. The BLKSIZE will
be selected by System Determined BLKSIZE (SDB) if active or by MFX if SDB is not
active.
7. The SYSIN DD statement marks the beginning of the system input stream that
includes the sort control statements.
9. The INCLUDE control statement edits the USA.OUTLETS input file, eliminating all
records which do not have the character string NYC in bytes 56-58. Only 'NYC' records
will be copied.
10. The delimiter statement marks the end of the SYSIN input stream.
Example 6
//ONE#EXIT JOB 1
//STEP1 EXEC PGM=SYNCSORT,PARM='MSG=SC' 2
//STEPLIB DD DSN=SORT.RESI.DENCE,DISP=SHR 3
//SYSOUT DD SYSOUT=A 4
//MODLIB DD DSN=EXIT.E15,DISP=SHR 5
//SORTIN DD DSN=INPUT,UNIT=3390, 6
// VOL=SER=ABCDEF,DISP=(SHR)
//SORTOUT DD DSN=OUTPUT,UNIT=3390, 7
// VOL=SER=GHIJKL,SPACE=(CYL,10)
// DISP=(NEW,KEEP,DELETE)
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,20) 8
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,20)
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,15)
//SORTWK04 DD UNIT=SYSDA,SPACE=(CYL,15)
//SYSIN DD * 9
SORT FIELDS=(10,25,CH,A,40,10,ZD,D), 10
FILSZ=9000
RECORD TYPE=V,LENGTH=(1024,,,44,192) 11
MODS E15=(E15,600,MODLIB,N) 12
END 13
/* 14
2. The EXEC statement identifies SYNCSORT as the program to be executed. The MSG
PARM option requests that all messages be routed to the SYSOUT DD statement but
only critical messages be routed to the console.
3. The STEPLIB DD statement instructs the system to look for MFX in the library named
SORT.RESI.DENCE. The DISP shows the library may be shared.
4. The SYSOUT DD statement assigns the MFX messages to the output device associated
with SYSOUT class A.
5. The MODLIB DD statement defines the library in which the exit routine resides;
MODLIB is referenced in the MODS control statement. The data set name of the
library is EXIT.E15, and the DISP shows that the library may be shared.
7. The SORTOUT DD statement gives OUTPUT as the output data set name and
specifies a 3390 disk with the volume serial number GHIJKL. Ten cylinders of primary
space have been allocated on this volume. The DISP parameter shows that this data set
is not yet in existence.
8. The four SORTWK statements reserve space on four temporary data sets for
intermediate storage. Twenty cylinders are to be reserved on the first two data sets,
fifteen on the second two data sets.
9. The SYSIN DD statement marks the beginning of the input stream that includes the
sort control statements.
10. The SORT control statement specifies two sort control fields. The first begins on byte 10
(data byte 6) of the record, is 25 bytes long, contains character data, and is to be sorted
in ascending order. The second control field begins on byte 40 (data byte 36) of the
record, is 10 bytes long, has zoned decimal data, and is to be sorted in descending order.
FILSZ instructs MFX to terminate abnormally unless the post-E15 file contains exactly
9,000 records.
11. The RECORD control statement shows that variable-length records are being sorted.
The first LENGTH value reports that the maximum length of records in the SORTIN
data set is 1024 bytes. The comma coded for the second LENGTH value shows that this
maximum length is not altered by the exit routine. The comma coded for the third
LENGTH value shows that this maximum length is not affected by an E35 or the
INREC/OUTREC statements. The fourth LENGTH value shows that the smallest
record in the input data set is 44 bytes long. The fifth LENGTH value shows that the
record length that occurs most frequently in SORTIN is 192 bytes. (This value will be
used to determine segment size.)
12. The MODS control statement states that the exit-type is E15. The name of the actual
exit routine included at this exit is also E15. The routine requires 600 bytes of memory
and resides in a library defined on the MODLIB DD statement. Finally, the N indicates
that link-editing of the routine has already been performed.
13. The END control statement marks the end of the control statements.
14. The delimiter statement marks the end of the SYSIN input stream.
Example 7
//LINKEXIT JOB 1
//STEP EXEC PGM=SYNCSORT 2
//SYSOUT DD SYSOUT=A 3
//SORTIN DD DSN=IN.FILE.JANUARY, 4
// UNIT=TAPE,VOL=SER=135790,
// DISP=OLD,DELETE),
// DCB=(LRECL=200,RECFM=FB,
// BLKSIZE=4000),LABEL=(2,SL)
//SORTOUT DD DSN=OUT.FILE.FEBRUARY, 5
// UNIT=TAPE,VOL=SER=097863,
// DISP=(NEW,KEEP),LABEL=(1,SL)
//SORTMODS DD DSN=A.PART.DATA.SET,DISP=OLD 6
//MODLIB DD DSN=EXIT.NO.ONE,DISP=SHR 7
//SYSLMOD DD DSN=&&LINK,UNIT=SYSDA, 8
// SPACE=(CYL,(1,1,1))
//SYSLIN DD DSN=&&TEMP,UNIT=SYSSQ, 9
// SPACE=(TRK,1)
//SYSPRINT DD SYSOUT=A 10
//SYSIN DD * 11
SORT FIELDS=(20,30,CH,A), 12
DYNALLOC=(SYSDA,6)
RECORD TYPE=F,LENGTH=200 13
MODS E15=(EXIT1,600,MODLIB,N), 14
E35=(EXIT2,500,SYSIN)
SUM FIELDS=(1,10,ZD) TOTAL BALANCE 15
END ACCOUNTS FOR JANUARY BEGIN FEBRUARY 16
.
.
.
Object deck EXIT2 for E35 exit routine 17
.
.
.
/* 18
4. The SORTIN DD statement gives IN.FILE.JANUARY as the input data set name, and
specifies a tape unit with the volume serial number 135790. The DISP parameter
shows that the data set is already in existence.
The DCB parameter shows an LRECL of 200 bytes, a fixed blocked RECFM, and a
4000-byte BLKSIZE. The LABEL parameter shows that IN.FILE.JANUARY is the sec-
ond data set on the tape, and that it has a standard label.
The DCB RECFM and LRECL parameters for SORTOUT default to that of the first
SORTIN file. The BLKSIZE will be selected by System Determined BLKSIZE (SDB) if
active or by MFX if SDB is not active. The LABEL parameter shows that
OUT.FILE.FEBRUARY is to be the first data set on the tape, and will have a standard
label.
6. The SORTMODS DD statement defines the partitioned data set that will contain the
exit routine object module that has not been link-edited and is being included in the
SYSIN data stream. The DISP shows the data set may not be shared.
7. The MODLIB DD statement defines the partitioned data set in which the already link-
edited exit routine resides. (Note MODLIB is referenced on the MODS control
statement.) The data set name of the exit library is EXIT.NO.ONE. The DISP shows
the data set may be shared.
8. The SYSLMOD DD statement defines a temporary data set called &&LINK that will
contain the exit routine after it has been link-edited. A direct access device will be used
with 1 cylinder reserved for primary space allocation, 1 cylinder for secondary space
allocation, and 1 directory block.
9. The SYSLIN DD statement defines the temporary data set that will contain the linkage
editor control statements that MFX will use when link-editing the exit. The name of
this data set is &&TEMP. It is to be on any sequential-access device with 1 track
reserved if the data set is allocated to disk.
10. The SYSPRINT DD statement defines the data set on which the linkage editor will
write its messages. Whatever device is assigned to SYSOUT=A will be used.
11. The SYSIN DD statement marks the beginning of the input stream that includes the
sort control statements and also the object deck of the exit routine to be link-edited.
The DYNALLOC parameter specifies that 6 direct access areas are to be reserved for
sortwork data sets.
13. The RECORD control statement shows that fixed-length records are being sorted. The
LENGTH parameter gives 200 bytes as the length of the records at input time, and, by
not specifying values for l2 and l3, implicitly states that the length of these records will
not be changed during the sort.
14. The MODS control statement shows that the first exit-type is E15. The name of the
routine for this exit is EXIT1. It will take 600 bytes in main storage, resides in a library
defined on the MODLIB DD statement, and has already been link-edited.
The second exit-type is E35. The name of the routine for the exit is EXIT2, and it will
take 500 bytes in main storage. The object deck for the routine is to be included in the
SYSIN portion of the job stream, and, because of the absence of a letter in the last sub-
parameter position for this group, the sort assumes that the routine requires link-edit-
ing and will be link-edited together with any other routines for this phase.
15. The SUM control statement’s FIELDS parameter identifies one summed field. It begins
on byte 1 of the record, is 10 bytes long, and has zoned decimal data. The rest of the
statement is a comment.
16. The END control statement marks the end of the control statements and also contains
a comment.
17. The EXIT2 object deck to be link-edited is included after the END statement in the
SYSIN stream.
18. The delimiter statement marks the end of the SYSIN input stream for the sort.
Example 8
//MULTOUT JOB 1
// EXEC PGM=SYNCSORT 2
//STEPLIB DD DSN=SORT.RESI.DENCE,DISP=SHR 3
//SYSOUT DD SYSOUT=A 4
//SORTIN DD DSN=SALES.RECORDS, 5
// VOL=SER=DISK1,DISP=SHR
//SORTOUT DD DSN=SORTED.SALES.RECORDS, 6
// UNIT=TAPE,VOL=SER=112233,
// DISP=(NEW,KEEP)
//SORTOFDS DD DSN=DOMESTIC.SALES.RECORDS, 7
// VOL=SER=DISK8,DISP=(NEW,KEEP),
// SPACE=(CYL,40),UNIT=SYSDA
//SORTWK01 DD SPACE=(CYL,20),UNIT=SYSDA 8
//SORTWK02 DD SPACE=(CYL,20),UNIT=SYSDA
//SORTWK03 DD SPACE=(CYL,20),UNIT=SYSDA
//SYSIN DD * 9
SORT FIELDS=(10,12,BI,A) 10
OUTFIL FILES=OUT,INCLUDE=ALL 11
OUTFIL FILES=DS,OMIT=(62,3,CH,NE,C'USA') 12
/* 13
3. The STEPLIB DD statement instructs the system to look for MFX in the library named
SORT.RESI.DENCE. The DISP parameter shows that the library may be shared.
4. The SYSOUT DD statement assigns the MFX messages to the output device associated
with SYSOUT class A.
5. The SORTIN DD statement gives SALES.RECORDS as the input data set name, and
specifies a disk with the volume serial DISK1. The DISP parameter indicates that the
data set is already in existence and may be shared.
8. The three SORTWK DD statements reserve space on direct access devices for
intermediate storage. Twenty cylinders are allocated for each of the three SORTWK
data sets.
9. The SYSIN DD statement marks the beginning of the input stream that includes the
sort control statements.
10. The SORT control statement specifies that one control field will be sorted on. It begins
on byte 10 of the record, is 12 bytes long, contains unsigned binary (BI) data and is to
be sorted according to ascending order.
11. The first OUTFIL control statement is associated with the SORTOUT DD statement.
The INCLUDE parameter specifies that all input records are to be included in this
output file.
12. The second OUTFIL control statement is associated with the SORTOFDS DD
statement. The OMIT parameter specifies that records which do not contain “USA” in
bytes 62, 63 and 64 are not to be included in this file.
13. The delimiter statement marks the end of the SYSIN input stream.
PARM options can be specified to provide processing information and to override installa-
tion defaults for JCL-initiated and program-invoked applications.
For a JCL-initiated application, specify the PARM option(s) on the EXEC statement as fol-
lows:
PARM='option,...'
Precedence Rules
There are three ways in which options can be specified, though not all options can be speci-
fied in all three ways:
• As an installation specification
• As a PARM specification
When an option is specified in more than one way, the following precedence rules apply:
The PARM options in Table 42 are described in detail in the “MFX PARM Options” sec-
tion on page 5.6.
Additional PARMs
MAXSORT
The MAXSORT feature, designed for large sorting applications, is initiated by the
MAXSORT PARM. The following additional PARMs can be specified for a MAXSORT
application: BKPTDSN, DYNATAPE, MAXWKSP, MINWKSP, NODYNATAPE,
RESTART, SORTSIZE, SORTTIME, and TAPENAME. These PARMs are described in
“Chapter 9. MAXSORT”.
PARASORT
The PARASORT feature, designed to reduce elapsed time for multi-volume and/or con-
catenated tape SORTIN sort applications, is initiated by the PARASORT PARM. For
additional information on PARASORT, see “Chapter 10. PARASORT”.
DB2 Query Support, which allows DB2 data to be passed directly into a SORT or COPY
operation without the use of setup steps or the need for user-written E15 exits, is initi-
ated by the DB2 Query Support PARM. For additional information, see ”Chapter 11.
MFX DB2 Query Support” .
MULTIIN
The MULTIIN facility, which allows MFX to process multiple VSAM and non-VSAM
data sets for input, is initiated by the MULTIIN PARM. This facility is described in
”Chapter 12. Multiple Input Files” .
BALANCE
BALANCE
BALANCE optimizes overall performance by balancing among CPU time, sort elapsed
time, and I/O activity to SORTIN, SORTOUT and SORTWK. If you wish to emphasize one
performance measure at the possible expense of others, use CPU, ELAP, or IO. See CPU,
ELAP, and IO, below. Note that these options and BALANCE are all mutually exclusive.
BMSG
BMSG
BMSG enables class B messages. They will appear wherever the MSG PARM option indi-
cates informational messages are to be routed.
CENTWIN
0
CENTWIN = s
f
CENTWIN defines a sliding or fixed 100-year window that determines the century to which
2-digit year data belongs when processed by SORT, MERGE, INREC, OUTREC or OUTFIL
OUTREC control statements.
The 2-digit year data formats (Y2B, Y2C, Y2D, Y2P, Y2S and Y2Z) plus the full-date for-
mats (Y2T, Y2U, Y2V, Y2W, Y2X, and Y2Y) work with CENTWIN to treat a 2-digit year
value as a 4-digit year. The 2-digit and full-date year data formats can be specified on con-
trol statements as follows:
• Use SORT/MERGE control statements to correctly collate 2-digit years that span
century boundaries. For information on using the 2-digit and full-date data formats for
SORT/MERGE field specifications, see “CENTWIN Parameter (Optional)” on page 2.67
or on page 2.237.
In addition, two date formats, Y2ID and Y2IP, are provided for year conversion with
INREC/OUTREC and OUTFIL OUTREC. These formats work with CENTWIN to expand a
2-digit year in packed decimal format to a 4-digit year while maintaining the packed deci-
mal format in the output field.
CENTWIN ensures that year data spanning centuries will be sequenced correctly. For
example, without CENTWIN processing, an ascending sort/merge would sequence the year
01 before the year 98. With CENTWIN processing, the 01 field could be recognized as a
twenty-first century date (2001) and would thus be sequenced after 98 (1998) for an ascend-
ing sort.
The CENTWIN option generates either a sliding or fixed century window, depending on
which form of CENTWIN is used: CENTWIN=s or CENTWIN=f.
The variable s is a number 0 through 100. This value is subtracted from the current
year to set a century-window starting point. For example, in 1996 CENTWIN=20 would
create the century window 1976 through 2075. Ten years later in 2006, the century
starting year would slide to 1986 (2006 minus 20 = 1986) and the century window
would be 1986 through 2085.
The CENTWIN delivered default is s=0, which means the current year is the starting
year of a century window.
The variable f is a 4-digit year (yyyy) between 1000 and 3000. For example,
CENTWIN=1976 establishes a fixed starting year 1976 for the century window 1976
through 2075. This window will not change as the current year changes.
For example, consider the century window 1950 through 2049. The 2-digit year fields would
be processed as follows:
An ascending sort of the above sample data would produce output data in the following
sequence:
If CENTWIN has been specified on the SORT or MERGE control statement as well as in
the PARM field, the PARM specification has precedence.
CMP
CPD
CMP =
CLC
CMP specifies the kind of compare operation to be used for sort/merge control fields up to
16 bytes long, bearing the format code PD or ZD.
When CMP=CPD is used, ZD fields are PACKed and then compared. Invalid PD data may
cause a system 0C7 abend and program termination. The integrity of fields labelled “ZD” is
only guaranteed when they contain valid ZD data. Since the zone bits (the leftmost four
bits of each byte) are lost during packing, UNPKing the field later restores only valid ZD
CMP=CLC uses the compare logical instruction for all PD and ZD control fields. No data
validation is done and the integrity of the output is maintained.
CMP=CPD is the delivered default for the PARM. The delivered default for VLTEST is 1,
and is consistent with this default. Changing the VLTEST default from 1 to any even num-
ber forces the use of CMP=CLC when sorting variable-length records.
For more detailed information and sample comparisons, see the section “Comparing PD
and ZD Control Fields” on page 2.66.
COMMAREA
COMMAREA(n,x)
COMMAREA(n)
COMMAREA(,x)
COMMAREA
NOCOMMAREA
COMMAREA instructs MFX to provide an area for communication between exit programs.
The size of this area is given as a decimal number n of bytes; x, a character string at most n
bytes long, designates the initial value to be stored in this area. Regardless of the value of
n, which may be between 1 and 256, x may not exceed 89 bytes in length. (Whenever x has
fewer than n characters, it will be right-padded with blanks to a length of n.) If COM-
MAREA is specified via the EXEC statement, blanks may be included within the string x.
However, if COMMAREA is specified via the $ORTPARM DD statement, intervening
blanks are not allowed. In neither case is a right parenthesis permitted since it delimits the
COMMAREA parameter.
Both n and x are optional. If either subparameter is specified, it will determine the other: n
defaults to the length of x, x defaults to n blanks. If neither x nor n is specified, n defaults to
80 bytes, x to 80 blanks.
NOCOMMAREA is the program default: no area for communication between exit programs
is provided, although exit routines may still use the 19th word of the save area.
Exit program access to this communication area is described in the discussion of exit pro-
grams, see “The Exit Communication Area” on page 7.4.
CORE
n
nK
nM
CORE
= MAX
SIZE
MAX-n
MAX-nK
MAX-nM
CORE is used to override the installation default for the amount of memory the sort/merge
is allowed to use. To specify an amount of memory, choose one entry from each pair of
braces.
Note that CORE and SIZE are synonymous. Note also that memory specification may be a
decimal number of bytes (CORE=n), a decimal multiple of K, where K=1024 bytes
(CORE=nK), or a decimal multiple of M, where M=1048576 bytes (CORE=nM).
For simplicity, the following describes only CORE, specified in units of nK.
CORE=MAX Assigns to the sort/merge all the available memory above and
below the 16-megabyte line.
CORE=MAX-nK Assigns to the sort/merge all the available memory above and
below the 16-megabyte line less nK bytes, which is reserved
below the 16-megabtye line.
CPU
CPU
CPU minimizes the CPU time of each sort at the expense of sort elapsed time and I/O activ-
ity. See BALANCE, ELAP and IO. Note that these options and CPU are all mutually exclu-
sive.
DEBUG
DEBUG
DEBUG produces an MFX SNAP dump in the event that a critical error forces the sort to
terminate. A SNAP dump produced in this way is of use to an MFX analyst in debugging
complex problems. See “Diagnostics and Technical Support” on page 18.1. Note that the
PSW AT ENTRY TO SNAP and general registers are useless for debugging.
DIAG
DIAG
DIAG turns on both the IOERR=ABE and the RC16=ABE options (see these options for
explanations).
d
(nn,mm)
DYNALLOC = (d, n ,RETRY = OFF [,SC=s])
5 3
OFF
DYNALLOC requests the dynamic allocation of SORTWK data sets on device type d.
Specify the device type either as a decimal number (e.g., 3380) or by the system generic
name (e.g., SYSDA). Any disk device accepted for a SORTWK DD statement can be
specified. Note that if VIO is specified it will be ignored, and the installation default for the
DYNALLOC device type will be used in its place.
Note that the DYNALLOC parameter may be used alone, without any subparameters. In
this case, the DYNALLOC installation default settings are used.
For non-MAXSORT applications, n can be 1 through 255. The value n specifies the number
of SORTWK data sets that can potentially be allocated. For values of n that are 31 or less,
MFX can automatically raise the number to 32 if the application requires. When n is 33
through 255, this value specifies the maximum number of SORTWK data sets that can be
allocated.
For MAXSORT applications, n is the number of SORTWK data sets that will be allocated.
As many as 32 SORTWK data sets can be specified for MAXSORT applications.
SORTWK data sets allocated by the DYNALLOC parameter normally supplement any
SORTWK data sets allocated by SORTWKnn DD statements; however, note that there is
an installation option to disable DYNALLOC if SORTWKnn DD statements are present.
MFX uses the value specified in the RETRY parameter to request automatic DYNALLOC
retry. This facility attempts to avoid a sortwork capacity exceeded condition when disk
space is not immediately available to satisfy a DYNALLOC request. When RETRY is
specified, MFX will automatically retry a specified number of times and wait a prescribed
interval between DYNALLOC requests.
The nn in the first position designates the number of times MFX will retry a failed
DYNALLOC request. The minimum allowed is 1 and the maximum is 16. The mm in the
second position designates the number of minutes MFX waits between each DYNALLOC
In an environment where DFSMS manages temporary work data sets, the SC subparame-
ter specifies a storage class s for MFX to use when dynamically allocating SORTWORK
data sets. The storage administrator at your installation defines the names of the storage
classes you can specify. Note that an installation written automatic class selection (ACS)
routine can override the storage class you specify. If SMS is not installed or active to man-
age temporary work data sets, the d device specification will be used in the SORTWORK
dynalloc request.
If DYNALLOC has been specified on the SORT control statement as well as in the PARM
field, the PARM specification will take precedence.
E15
E15=COB
E15 specifies the E15=COB option in order to include an E15 exit written in COBOL with-
out coding C on the MODS control statement.
E35
E35=COB
E35 specifies the E35=COB option in order to include an E35 exit written in COBOL with-
out coding C on the MODS control statement.
ELAP
ELAP
ELAP minimizes the elapsed time (wall clock time) of each sort at the expense of CPU time
and I/O activity. See BALANCE, CPU and IO. Note that these options and ELAP are all
mutually exclusive.
EQUALS
NOEQUALS
EQUALS insures that the original order of equal-keyed records is preserved. These records
will be in the same order in the output file as they were in the sort input file. For a merge,
equal-keyed records from the lowest-numbered SORTINnn file are written before those
from the second input file, and so on. With NOEQUALS, there is a random element to the
order in which records with identical control fields will appear in the output. With or with-
out EQUALS, MERGE preserves the order of equal-keyed records within any one data set.
If EQUALS is in effect in an application with SORTMInn data sets, the order of equal-
keyed records within each SORTMInn file will be preserved. In addition, equal-keyed
records from the lowest-numbered SORTMInn file will be written before those from the sec-
ond SORTMInn file, and so on.
When used in conjunction with SUM or DUPKEYS, EQUALS indicates which of the equal-
keyed records will be preserved, containing the sum or DUPKEYS minimum, maximum, or
average values: the record occurring first in SORTIN (for a sort), or drawn from the SORT-
INnn data set with the lowest nn number (for a merge) will contain the calculated fields.
The EQUALS option can also be specified on the SORT/MERGE control statement. The
specification on the control statement takes precedence over the specification in the PARM
field.
EXTCOUNT
EXTCOUNT
By default, the internal limit on the number of records that can be sorted for variable-
length data or for a sort application that uses the EQUALS option is 4,294,967,295 records.
Specifying EXTCOUNT increases the internal limit to 140,737,488,355,327 records. Fixed-
length sorts without EQUALS, and all merges and copies, have automatic support for the
maximum number of records allowed by the EXTCOUNT parameter.
Note that additional SORTWK space may be required when specifying the EXTCOUNT
parameter with a VL sort or a fixed-length sort with EQUALS. The additional SORTWK
Performance will usually be improved if the EXTCOUNT option is not in effect. Therefore,
EXTCOUNT should be used only when appropriate to the application.
If the record limit is exceeded, MFX will issue a critical error message and terminate the
application.
FILSZ
n
FILSZ =
En
FILSZ indicates the actual (FILSZ=n) or estimated (FILSZ=En) decimal number of records
to be sorted, taking into account all record additions and deletions due to an E14 or E15
exit routine, the INCLUDE/OMIT control statement, the SUM or DUPKEYS control state-
ment and the SKIPREC and STOPAFT parameters.
FILSZ=n instructs MFX to terminate with an error message unless exactly n records are to
be sorted. Since the number of records deleted by SUM or DUPKEYS processing in Phase 1
is indeterminate and may not be reproducible, much less predictable, only the estimated En
value should be used if a SUM or DUPKEYS control statement is present.
The FILSZ option can also be specified on the SORT control statement. The specification in
the PARM field will take precedence over that on the control statement.
FLAG
FLAG(I)
FLAG(U)
NOFLAG
FLAG controls the routing of output messages. The MSG option, which handles messages
more comprehensively, is explained later in this section. The format of the FLAG option is
given below.
Specify FLAG(U) to route critical messages only to both the data set specified by the
SYSOUT DD statement and the console. (This is the same as the MSG=CB PARM.)
Specify NOFLAG to route critical messages only to the console, no messages to the data set
specified by the SYSOUT DD statement. (This is the same as the MSG=CC PARM.)
HBSI
HBSI
HBSI turns on hiperbatch processing for SORTIN data sets. To benefit from hiperbatch
processing, the SORTIN data set should already reside in hiperbatch. Although hiperbatch
does provide significant improvements in elapsed time, it causes some degree of degrada-
tion in other system resources. If you use HBSI and the SORTIN data set does not reside in
hiperbatch, you may experience some system degradation while not realizing any of the
benefits that accompany hiperbatch processing.
HBSO
HBSO
HBSO turns on hiperbatch processing for SORTOUT data sets. HBSO benefits only subse-
quent job steps that utilize hiperbatch to access this data set.
IO
IO
IO minimizes the I/O activity of each sort at the expense of sort elapsed time and CPU
time. See BALANCE, CPU and ELAP. Note that these options and IO are all mutually
exclusive.
IOERR=ABE
NOIOERR
IOERR=NOSNAP
IOERR specifies IOERR=ABE to receive user abend 999 if an I/O error should occur. This
abend will cause the job step to terminate, producing a diagnostic dump.
NOIOERR is the program default. If this option is in effect, MFX will, in the event of an I/O
error, terminate with either a return code of 16 or a user abend 16, depending on the RC16
option that is used.
Specify IOERR=NOSNAP to receive a user abend 999 if an I/O error should occur. This
abend will cause the step to terminate, but no diagnostic dump will be produced, unless the
DEBUG option is in effect.
JPn
JPn is used to establish dictionary_names for symbolic substitution in MFX control state-
ments. JCL SET and PROC symbols, system symbols and text strings may all be used in
the JPn PARM to establish up to 10 character string dictionary_names. See “Using JCL
SET and PROC Symbols to Create Dictionary_Names” on page 13.28 for a complete
description.
L6
L6=n
L6 indicates the average number of bytes of work space each record will need, overriding (if
present) the l6 parameter of the RECORD control statement. The decimal value n of the
optional L6 parameter is provided by the HISTOGRM utility program. If neither L6 nor l6
is provided, MFX will estimate this value.
L6 is only used for sorting variable-length records. It is ignored by merge, and copy applica-
tions.
L7=n
L7 indicates the segment length that MFX should use for maximum sorting efficiency. The
decimal value n of the optional L7 parameter is provided by the HISTOGRM utility pro-
gram. (A segment is a fixed-length area used to contain all or part of a variable-length
record.) The L7 value overrides (if present) the l7 parameter of the RECORD control state-
ment. If neither L7 nor l7 is provided, MFX will estimate this value.
L7 is only used for sorting variable-length records. It is ignored by merge, and copy applica-
tions.
LIST
LIST
NOLIST
LIST, the default for the sort/merge program, causes header lines and control statements to
be listed with the SYSOUT data set (in all likelihood, at the printer) for both JCL- and pro-
gram-initiated executions. If NOLIST is specified, the control statements and header lines
will not appear with this data set.
LOCALE
NONE
LOCALE = CURRENT
name
MFX employs the callable services of IBM’s Language Environment for z/OS to collate data
in a way that conforms to the language and conventions of a selected locale. A locale defines
NONE, the default setting for LOCALE, results in normal EBCDIC collating.
CURRENT directs MFX to use the locale active when MFX begins.
name is the name of a supplied or user-defined locale that is to be active during MFX pro-
cessing. A locale name may be up to 32 characters and is not case sensitive. The locale
active just before MFX processing begins will be restored when MFX processing completes.
The following is a list of locales provided with the IBM National Language Resources Fea-
ture of LE/370.
Notes:
1. Make sure the JCL gives MFX access to the library that contains the loadable locale
routines. For the supplied locales, these are the dynamically loadable routines in the
2. If locale processing is used for fields specified in a SORT or MERGE control statement,
VLTEST=1 will be forced on in addition to any other VLTEST options in effect.
VLTEST=1 will cause MFX to terminate if a variable-length input record does not
contain all SORT/MERGE control fields.
5. Locale processing requires additional main storage to support the use of the IBM
Language Environment facilities. For those jobs that use locale, the below-the-line
region size should be increased by 1000K to accommodate the storage needs of the
Language Environment modules.
MSG
AB
AC
AP
CB
CC
MSG =
CP
NO
PC
SC
SP
MSG indicates where MFX messages are to be routed. The MSG codes assume that the
printer is specified for the message data set; if a device other than the printer is specified
for this data set, messages described as routed to the printer will be routed to this other
device instead.
AB causes all messages to be routed both to the printer and to the console.
CB causes only critical messages to be routed to the printer and to the console. (This is
the same as the FLAG(U) option.)
CC causes only critical messages to be routed to the console, no messages to the printer.
(This is the same as the NOFLAG option.)
CP causes only critical messages to be routed to the printer, no messages to the console.
SC causes only critical messages to be routed to the console, all messages to the
printer. (This is the same as the FLAG(I) option.)
SP causes only critical messages to be routed to the printer, all messages to the con-
sole.
MSGDD
SYSOUT
MSGDD =
xxxxxxxx
The program default for the DD name of the message data set is SYSOUT. To assign a dif-
ferent DD name, substitute any valid DD name for xxxxxxxx.
NOTMTOUT
RC0
NOTMTOUT= RC4
RC16
NOTMTOUT specifies the action to be taken when SORTOUT in a sort, merge, or copy
application contains at least one data record.
RC0 The delivered default instructs MFX to issue a return code of 0 if not overridden by
a higher return code set for another reason.
RC16 Instructs MFX to issue a WER495A message and terminate processing with a
return code of 16.
NULLOUT
RC0
NULLOUT = RC4
RC16
NULLOUT specifies the action to be taken when SORTOUT in a sort, merge, or copy appli-
cation contains no data records.
RC0 The delivered default instructs MFX to issue a return code of 0 if not overridden by
a higher return code set for another reason.
RC4 Instructs MFX to issue a WER461I warning message and continue processing. A
return code of 4 will be issued if not overridden by a higher return code set for
another reason.
RC16 Instructs MFX to issue a WER461A message and terminate processing with a
return code of 16.
OVFLO
RC0
OVFLO = RC4
RC16
OVFLO specifies the action to be taken if a summed or averaged field overflows or under-
flows during SUM, DUPKEYS SUM, or DUPKEYS AVG processing.
RC4 Instructs MFX to issue a WER049I warning message and continue processing. A
return code of 4 will be issued if not overridden by a higher return code set for
another reason. The WER049I will only be issued on the first occurrence of the
overflow or underflow.
RC16 Instructs MFX to issue a WER049A message and terminate processing with a
return code of 16.
PAD
RC0
PAD = RC4
RC16
PAD specifies the action to be taken if the LRECL defined in the JCL for a non-OUTFIL
SORTOUT is larger than the SORTIN/SORTINnn LRECL or the internally processed
record length when the SORTIN/SORTINnn LRECL is modified by features.
RC0 The delivered default instructs MFX to issue a WER462I message, pad fixed-length
output records with binary zeros, and issue a return code of zero.
RC4 Instructs MFX to issue a WER462I message and pad fixed-length output records
with binary zeros. A return code of 4 will be issued if not overridden by a higher
return code set for another reason.
RC16 Instructs MFX to issue a WER462A message and terminate processing with a
return code of 16.
Note that for a BetterGener application PAD will be ignored. The installation parameter
SOPADGN will control processing for these applications.
PRINT121
PRINT121 changes MFX’s DCB default for the message data set to the following:
DCB=(LRECL=121,BLKSIZE=121,RECFM=FA)
This PARM is useful when the application includes a COBOL exit which uses DISPLAY,
EXHIBIT, or TRACE instructions. (These macros will otherwise cause conflicts between
program and sort/merge messages.) An alternative is provided by the MSGDD parameter,
used to change the name of the MFX message data set.
The MFX program default for the message file’s DCB is:
DCB=(LRECL=125,BLKSIZE=882,RECFM=VBA)
RC16
RC16=ABE
NORC16
RC16=ABE will cause the sort to issue user ABEND 16 instead of return code 16. The sort
step is abnormally terminated without a dump and subsequent job steps are generally
flushed by the operating system. However, JCL may specify job step(s) to be executed only
in the event of an ABEND.
The delivered default is NORC16; unsuccessful completion of the sort causes a return code
of 16 to be passed to the operating system or the invoking program.
RELEASE
ON
RELEASE =
OFF
Specify RELEASE=OFF to instruct MFX to turn off the RLSE operand in the SPACE
parameter of the SORTWK DD statement. In this case, MFX will not release unused space
from the sortwork units during sort execution.
RESERVE
n
RESERVE = nK
nM
RESERVE sets aside a specified amount of memory below the 16-megabyte line for the
user. This parameter takes effect only when CORE=MAX is in effect.
The memory may be specified as a decimal number of bytes (RESERVE=n), a decimal mul-
tiple of K, where K=1024 bytes (RESERVE=nK), or a decimal multiple of M, where
M=1048576 bytes (RESERVE=nM).
RESERVEX
n
RESERVEX = nK
nM
RESERVEX reserves a specified amount of memory above the 16-megabyte line for the
user. This parameter takes effect only when CORE=MAX is in effect.
RESET
NORESET
RESET will prevent VSAM from treating output data sets as MOD data sets, if an output
VSAM file was created using the REUSE option.
RLSOUT
RLSOUT
NORLSOUT
RLSOUT releases all excess primary and secondary space from each output DASD file
when the parm is specified and DISP=NEW is specified on output data set statements.
NORLSOUT is the program default. In this case, MFX does not release any excess space on
these output files.
SDB
ON
OFF
YES
NO
DISKONLY
SDB = TAPEONLY
LARGE
SMALL
INPUT
LARGEONLY
INPUTONLY
SDB=ON or YES enables the use of system-determined blocksize for both tape and new or
previously allocated but unopened DASD output data sets except in the following condi-
tions:
• A blocksize is found in the JCL DCB BLKSIZE specification or, in the case of a
DISP=MOD tape data set, it is derived from an available tape label.
If the output data set is on DASD, the blocksize selected will be based upon the RECFM
and LRECL, either specifically provided or determined from the usual analysis of SORTIN
or RECORD statement attributes. For example, the blocksize selected for a blocked output
data set assigned to a 3380 or 3390 DASD device will represent a size as close to half-track
blocking as possible.
If the output file is a tape data set, the blocksize will be determined from the RECFM and
LRECL in conjunction with the following rules:
If SDB=OFF or NO is specified, MFX will not use system-determined blocksize. The block-
size, if unavailable, will be determined from SORTIN if the SORTIN and output data set
LRECLs are the same, otherwise MFX will select an appropriate blocksize.
If SDB=DISKONLY is specified, MFX will use system-determined blocksize only for disk
output data sets.
If SDB=TAPEONLY is specified, MFX will use system-determined blocksize only for tape
output data sets.
SDB=LARGE enables the use of system-determined blocksize for both tape and DASD out-
put data sets, as with SDB=ON. Additionally, SDB=LARGE enables selection of a system-
SDB=INPUT enables the use of system-determined blocksize for both tape and DASD out-
put data sets, as with SDB=ON. Additionally, if an input tape data set has a blocksize
greater than 32760, SDB=INPUT enables selection of a system-determined blocksize
greater than 32760 for eligible tape output data sets if not restricted by the system BLKS-
ZLIM value. SDB=INPUT is the default.
SDB=LARGEONLY enables the use of system-determined blocksize for tape output data
sets only, as with SDB=TAPEONLY. Additionally, SDB=LARGEONLY enables selection of
a system-determined blocksize greater than 32760 for eligible tape output data sets if not
restricted by the system BLKSZLIM value.
SDB=INPUTONLY enables the use of system-determined blocksize for tape output data
sets only, as with SDB=TAPEONLY. Additionally, if an input tape data set has a blocksize
greater than 32760, SDB=INPUTONLY enables selection of a system-determined blocksize
greater than 32760 for eligible tape output data sets if not restricted by the system BLKS-
ZLIM value.
SKIPREC
SKIPREC=n
SKIPREC=n instructs the sort to skip a decimal number n of records before sorting/copying
the input file. The records skipped are deleted from the input file before E15 and
INCLUDE/OMIT processing is begun.
If SKIPREC=n has been specified on the SORT/MERGE control statement as well as in the
PARM field, the PARM specification will take precedence.
STOPAFT
STOPAFT=n
The STOPAFT=n parameter specifies the number of records to be sorted or copied. These
will be the first n records after E15, INCLUDE/OMIT and SKIPREC processing, if speci-
fied, have completed.
TRUNC
RC0
TRUNC = RC4
RC16
TRUNC specifies the action to be taken if the LRECL defined in the JCL for a non-OUTFIL
SORTOUT is smaller than the SORTIN/SORTINnn LRECL or the internally processed
record length when the SORTIN/SORTINnn LRECL is modified by features.
RC0 The delivered default instructs MFX to issue a WER462I message, truncate the
output records, and issue a return code of zero.
RC4 Instructs MFX to issue a WER462I message and truncate the output records. A
return code of 4 will be issued if not overridden by a higher return code set for
another reason.
RC16 Instructs MFX to issue a WER462A message and terminate processing with a
return code of 16.
Note that for a BetterGener application TRUNC will be ignored. The installation parame-
ter SOTRNGN will control processing for these applications. TRUNC will be ignored in
applications in which the SORTIN/SORTINnn or SORTOUT is a VSAM data set.
UNINTDS
YES
UNINTDS =
NO
UNINTDS indicates how MFX should process a non-VSAM uninitialized DASD input data
set in a non-SMS environment. An uninitialized data set is one that has been created but
never successfully opened and closed for output. In an SMS environment, uninitialized
data sets are always processed as valid empty files.
UNINTDS=NO indicates that MFX should terminate with a WER400A critical message if
an uninitialized data set is provided as input.
VLTEST
,ON
n
VLTEST = ( ,OFF )
1
,OFF4
VLTEST allows you to do the following when variable-length records are processed:
Record length validity testing may be performed in all types of applications: sort, merge,
copy, and BetterGener. Segment sequence checking may only be done during sort and
merge applications.
The first subparameter of the VLTEST PARM is a number n that instructs MFX in the type
of validity testing to be performed on variable-length records. Choosing a validity test
instructs MFX to terminate with a critical error (outlined in WER027A, WER160A or
WER167A) in the event of an illegal condition.
A primary use of VLTEST instructs the sort/merge in the handling of “short” variable-
length records, i.e., records not long enough to contain all of the control fields specified in
the SORT/MERGE control statement. The delivered default for VLTEST is 1.
When VLTEST is set to an even number, MFX will accept short variable-length records,
padding them with binary zeros to the length of the sort key for the sort compare process.
In order to prevent system 0C7 abends due to the binary zero padding, the CMP PARM is
automatically set to CMP=CLC in these cases. The binary zeros are removed from the
record, restoring it to its original state, as the output record is being written.
1 If any input record does not contain all SORT/MERGE control fields, terminate.
This is the default.
2* If any input record is longer than the maximum LRECL or l2 value, terminate.
4* If any input record is longer than the output LRECL or l3 value, terminate.
6* If any input record is longer than the maximum input LRECL or l2 value, or
longer than the output LRECL or both, terminate.
The second subparameter allows you to specify whether or not MFX should verify that the
sequence of segments is correct in each variable-length spanned record during sort and
merge applications. ON is the delivered default and signals that the segment sequence
should be verified. If OFF is selected, all illogical record segments encountered in the input
file will be eliminated and message WER464I will be produced. If OFF4 is selected, the pro-
cessing described for OFF will occur, but in addition if an illogical segment is found, a
return code of 4 will be returned if not overridden by a higher return code set for another
reason.
The second subparameter does not apply during copy applications. In a copy application all
illogical record segments encountered in the input file will be eliminated.
Note: If an illegal condition is detected during a validity test and segment sequence check-
ing is on, message WER182A will be issued.
0
VLTESTI = 1
2
VLTESTI specifies to MFX how to process variable-length records that do not contain all
specified INCLUDE or OMIT fields. VLTESTI applies to the INCLUDE and OMIT control
statements as well as OUTFIL and JOINKEYS INCLUDE/OMIT processing. It does not
apply to the WHEN and KEYBEGIN subparameters of the IFTHEN parameter of the
INREC, OUTREC, and OUTFIL control statements. It also does not apply to the TRLID
subparameter of the IFTRAIL parameter of the OUTFIL control statement.
The delivered default of 0 instructs MFX to terminate if a record does not completely con-
tain all INCLUDE or OMIT fields. A WER250A critical error message is generated to indi-
cate this condition.
When VLTESTI=1 is specified, a record that does not completely contain all INCLUDE/
OMIT fields is treated as having failed the comparison. MFX will omit the record if
INCLUDE is being used or include the record if OMIT has been specified.
When VLTESTI=2 is specified, MFX will treat comparisons to fields not completely con-
tained within the record as false and decide a record’s status for inclusion or omission from
fields that are available. If all fields are not present, the record will be processed as having
failed the comparison. MFX will omit the record if INCLUDE is being used or include the
record if OMIT has been specified.
VSAMEMT
NO
VSAMEMT =
YES
If you specify VSAMEMT=YES, an empty VSAM data set will be processed as a legitimate
data set containing no records.
The delivered default, VSAMEMT=NO, instructs MFX to terminate with a WER254A criti-
cal error if an empty VSAM data set is specified for input.
ZDPRINT
NZDPRINT
The ZDPRINT option applies to the SUM, DUPKEYS SUM, and DUPKEYS AVG features.
This option determines whether the sign byte of a positive summed or averaged ZD field
will be converted to a printable format. More precisely, the option specifies whether the
zone of the last digit should be changed from a hexadecimal C to a hexadecimal F.
DD Statements
The DD statements included in the Table of DD Statements for Invoked Sort/Merge are
those which may be required when invoking the sort.
//SORTXDUP DD Output data set for records deleted When the XDUP parameter of the
by DUPKEYS. DUPKEYS control statement is not
used.
//SORTXSUM DD Output data set for records deleted When the XSUM parameter of the
by SUM. SUM control statement is not used.
//SYSOUT DD Message data set. When all messages are routed to con-
sole or are disabled.
Macro Instructions
The choice of macro determines the linkage relationship between the calling program and
the sort/merge load module. The linkage relationship established by ATTACH precludes
the use of the Checkpoint-Restart feature; do not code CHKPT/CKPT on the SORT/MERGE
control statement when invoking the sort/merge with the ATTACH macro. With XCTL,
The sort/merge DD statements are placed with the JCL of the job step that issues the
macro. The EP parameter is specified as SORT whether MFX is to be used for sorting,
merging, or copying. With ATTACH, the ECB or EXTR is usually required.
MFX control statements are introduced by the invoking programs as character operands in
DC operations. Although it is generally true that all control statements supported for a
JCL-initiated Disk Sort/MAXSORT are available to invoked applications, these exceptions
should be noted:
• A MODS control statement cannot be used for an E32 exit and is not required for an
E15 or E35 exit. (An E32, E15 and/or E35 exit routine may be coded in line with the
invoking program with their addresses passed to the sort in the parameter list. If the
31-bit parameter list is being used, an E18 and/or E39 exit routine address may also be
passed.)
The actual coding of the control statements is the same, except that:
• Continuation characters are not called for, since the statements are not in card-image
format.
For the 24-bit parameter list, each control statement DC instruction should be labeled and
followed by a DC C' ' instruction so that the beginning and ending addresses of the control
statement can be referenced in the parameter list.
Figure 325. Sample Control Statement Images for the 24-bit Parameter List
Note that the 24-bit invoking parameter list and pointer word, as well as the control state-
ment images, must be below the 16 megabyte line.
As in a JCL-initiated sort/merge, control statements must begin with at least one blank.
For the 31-bit invoking parameter list, the control statement images will be pointed to by
the first word of the parameter list and are organized like the control statement images for
a 24-bit parameter list. Note, however, that only the first DC instruction requires a label
since only the start and end of the list need be referred to. The control statements must be
separated by one or more blanks; that is, each control statement must be followed by a
blank. A blank before the first statement is optional; however, a blank after each statement
is required. Labels, comment statements, and comment fields must not be coded. Each con-
trol statement, except the last, must have at least one parameter.
CARDLEN DC 0H
DC Y(CARDEND-CARDBEG)
CARDBEG DC C'SORT FIELDS=(31,5,CH,A)'
DC C' '
DC C'RECORD TYPE=F,LENGTH=(80,,120)'
DC C' '
CARDEND EQU *
Figure 326. Sample Control Statement Images for the 31-bit Parameter List
In order to pass the parameter list, it is necessary to load the address of a fullword pointer
into Register 1. Code X'80' in the pointer’s first byte and the address of the parameter list’s
byte count in its last three bytes. The byte count must be located in the last 2 bytes of the
first fullword entry in the parameter list. It contains the hexadecimal number of bytes
remaining in the list -- do not include these 2 bytes in the count.
Note: Empty boxes indicate the contents are immaterial and not examined.
In this example, only the required seven entries appear in the parameter list. The invoked
sort skips the first 100 records in SORTIN, a data set of 80-byte fixed-length records, and
sorts the remainder in ascending sequence according to the character data in its first 16
bytes.
Additional parameter-list entries may appear in any order after these required seven; the
contents of the first byte of the word signals which optional parameter it is.
For invoked merge applications using the 24-bit parameter list, the number of input files
must be specified on either the X'04' entry or the FILES=n parameter on the MERGE con-
trol statement. However, when using the 31-bit parameter list, the number of input files for
a merge must be specified on the FILES=n parameter.
Optional Parameters
Code in
Contents of Bytes 2 - 4
Byte 1
X'00' Indicates how much main storage MFX is to use. Code C'MAX' or a
hexadecimal number of bytes.
Table 50. (Page 1 of 3) Optional Parameters for the 24-Bit Parameter List
Table 50. (Page 2 of 3) Optional Parameters for the 24-Bit Parameter List
Table 50. (Page 3 of 3) Optional Parameters for the 24-Bit Parameter List
Return Codes
When the sort terminates, returning control to the calling program, it places a return code
in Register 15:
The calling program typically tests the contents of Register 15, branching to the normal-
sort or sort-error end of job routine.
.
.
.
LA 1,PTRWORD Load address of parameter list pointer
LINK EP=SORT Initiate MFX
LTR 15,15 Test return code
BNZ SORTERR Branch on error condition
B SORTOK Branch to normal processing
CNOP 0,4 Fullword alignment for pointer
PTRWORD DC X'80' Indicates pointer to parameter list
DC AL3(PARMS) Address of parameter list
DS H Unused first 2 bytes of first parameter
PARMS DC Y(PARMSEND-PARMSBEG) Byte count of remaining parameters
PARMSBEG DC A(SORTBEG) Beginning address of sort statement
DC A(SORTEND) Ending address of sort statement
DC A(RECBEG) Beginning address of record statement
DC A(RECEND) Ending address of record statement
DC F'0' No E15/E32 exit routine
DC F'0' No E35 exit routine
DC X'03' Indicates SYSOUT DD name change
DC AL3(MSGNAME) Address of SYSOUT DD name replacement
DC X'08' Indicates INCLUDE/OMIT parameter
DC AL3(OMITBEG) Beginning address of OMIT statement
DC A(OMITEND) Ending address of OMIT statement
DC X'07' Indicates SUM parameter
DC AL3(SUMBEG) Beginning address of SUM statement
DC A(SUMEND) Ending address of SUM statement
DC X'0B' Indicates OUTFIL parameter
DC AL3(OUTBEG1) Beginning address of first OUTFIL statement
DC A(OUTEND1) Ending address of first OUTFIL statement
DC X'0B' Indicates OUTFIL parameter
DC AL3(OUTBEG2) Beginning address of second OUTFIL statement
DC A(OUTEND2) Ending address of second OUTFIL statement
PARMSEND EQU * End of parameter list
SORTBEG DC C' SORT FIELDS=(1,20,A,35,8,A),' Begin SORT statement image
DC C'FORMAT=CH' Continue SORT statement image
SORTEND DC C' ' End SORT statement image
RECBEG DC C' RECORD TYPE=F' Begin RECORD statement image
RECEND DC C' ' End RECORD statement image
OMITBEG DC C' OMIT COND=(21,8,PD,EQ,0)' Begin OMIT statement image
OMITEND DC C' ' End OMIT statement image
SUMBEG DC C' SUM FIELDS=(21,8,PD)' Begin SUM statement image
SUMEND DC C' ' End SUM statement image
OUTBEG1 DC C' OUTFIL FILES=1,' Begin first OUTFIL statement image
DC C' HEADER1=(50X,''CHANGES'
DC C' TO W-2 FORMS'',//,'
DC C'50X,''JANUARY THROUGH JUNE'
DC C' 1993'')'
OUTEND1 DC C' ' End first OUTFIL statement image
Figure 328. (Page 1 of 2) Sample Assembler Invocation Using 24-Bit Parameter List
Figure 328. (Page 2 of 2) Sample Assembler Invocation Using 24-Bit Parameter List
This example sorts fixed-length records by the character data in its first 20 bytes and,
where two records have identical data in this field, by the character data in bytes 35-42;
these fields are collated in ascending order. Note the continuation of the SORT statement
image using consecutive DC instructions. There is no special significance to the break after
the FIELDS parameter -- a control statement image can be divided at any point in this way.
The SORTIN file is edited by the OMIT statement, which will eliminate any records with
zero in bytes 21-28 before sorting begins; these 8 bytes constitute the SUM field. MFX mes-
sages are written to the data set specified by the MESSAGES DD name. Two OUTFIL
parameters have been specified, producing multiple output files. The first OUTFIL will
receive data from every sorted input record, producing a company-wide report. The second
OUTFIL will receive selected data only, as defined by the OMIT condition, producing a
departmental report.
Only the first word of the extended parameter list is required. The high order bit must be
zero to identify this as a 31-bit parameter list. The subsequent words of this list are
optional, and because there is no code in the high order byte, as in the 24-bit parameter list,
their positional order must be maintained. Thus, when coding the list be sure to code a full-
word of zeros when omitting one of the optional parameters. The last parameter word spec-
ified in the list must be followed by the 4-byte field X'FFFFFFFF'.
Bit
Bits 1 through 31
0
Address of halfword containing the length of
Required +0 0
control statement images (zeros if none)
+4 m Address of user E15 or E32 (zeros if none)
+8 m Address of user E35 (zeros if none)
+12 User exits address constant (zeros if none)
Optional
+16 d Address of ALTSEQ translation table (zeros if
none)
+20 d Address of STAE area field (zeros if no STAE
routine)
+24 m Address of user exit E18 (zeros if none)
+28 m Address of user exit E39 (zeros if none)
+32 Call identifier (C 'nnnn')
Required +36 X'FFFFFFFF' (required)
The following table provides an explanation of the contents of the extended parameter list.
Table 52. Explanation of the Contents of the 31-Bit Extended Parameter List
When the sort terminates, returning control to the calling program, it places a return code
in Register 15:
The calling program typically tests the contents of Register 15, branching to the normal-
sort or sort-error end of job routine.
The following examples demonstrate how to code an extended parameter list. In this exam-
ple, all exits reside below the 16-megabyte line and should be called with 24-bit AMODE
set, except the E35 exit, which should be called with 31-bit AMODE set.
.
.
.
LA 1,XLIST Point at Parameter List
LINK EP=SORT Initiate MFX
.
.
.
XLIST DC A(CNTLCARD) Address of Control Card Images
DC A(E15EXIT) Address of E15 Exit
DC A(E35EXIT+X'80000000') Address of E35 Exit
DC F'0' User Address Constant
DC A(ALTSEQ) Address of ALTSEQ
Translation Table
DC A(STAE) Address of STAE Area Field
DC A(E18EXIT) Address of E18 Exit
DC A(E39EXIT) Address of E39 Exit
DC X'FFFFFFFF' End of Parameter List
CNTLCARD DC 0H
DC Y(CNTLLEN)
CNTLCRD2 DC C' SORT FIELDS=(1,16,CH,A)'
DC C' RECORD TYPE=F,LENGTH=80'
CNTLLEN EQU *-CNTLCRD2
Figure 329. Sample Invoked Sort with Both 24-bit AMODE & 31-bit AMODE Set
This next example demonstrates how to code an extended parameter list in which all exits
reside above the 16-megabyte line and should be called with AMODE 31 set.
.
.
.
LOAD EP=E15EXIT Load E15 exit
ST R0,E15ADDR Store E15 AMODE+address
LA 1,XLIST Point at parameter list
LINK EP=SORT Initiate MFX
LTR R15,R15 Test return code
BNZ SORTERR Branch on error condition
B SORTOK Branch to normal processing
.
.
.
XLIST DC A(CARDLEN) Address of control statements
E15ADDR DC A(0) Address of E15 routine
DC A(0) No E35 routine
DC A(0) User exit address constant
DC X'FFFFFFFF' End of parameter list
CARDLEN DS 0H Control statement area
DC Y(CARDEND-CARDBEG) Length of character string
CARDBEG DC C'SORT FIELDS=(1,20,A,35,8,A),' Begin SORT image
DC C'FORMAT=CH' Continue SORT image
DC C'RECORD TYPE=F,LENGTH=80 ' RECORD image
DC C'OMIT COND=(21,8,PD,EQ,0) ' OMIT image
DC C'SUM FIELDS=(21,8,PD) ' SUM image
DC C'OUTFIL FILES=1,' First OUTFIL image
DC C'HEADER1=(50X,''CHANGES'
DC C' TO W-2 FORMS'',//,'
DC C'50X,''JANUARY THROUGH JUNE'
DC C'1992'')' End first OUTFIL image
DC C'OUTFIL FILES=2,' Second OUTFIL image
DC C'HEADER1=(19x,''EMPLOYEE'','
DC C'10X,''DEPARTMENT CODE'','
DC C'10X,''CHANGE'')'
DC C',OMIT=(29,4,PD,NE,0)' End second OUTFIL image
CARDEND EQU *
SORTERR DS 0H Error routine for unsuccessful sort
.
.
.
BR 14 Return
SORTOK DS 0H Normal processing for successful sort
.
.
.
BR 14 Return
This example sorts fixed-length records by the character data in its first 20 bytes and,
where two records have identical data in this field, by the character data in bytes 35-42;
these fields are collated in ascending order. Note the continuation of the SORT statement
image using consecutive DC instructions. There is no special significance to the break after
the FIELDS parameter - a control statement image can be divided at any point in this way.
The SORTIN file is edited by the OMIT statement, which will eliminate any records with
What Is an Exit?
The term program exits refers to the various points in the sort program’s executable code at
which control can be passed to a user-written routine. Most exit routines take control once
for every record being processed, increasing overall execution time and consuming main
storage that would otherwise be used by the sort. Exits should only be coded for tasks
which cannot be accomplished with MFX control statements.
Program exits are labeled with a 2-digit decimal number, e.g., E35. Except for E61, the first
digit (1, 2 or 3) refers to the sort/merge phase at which the routine will get control; an E61
routine can take control in Phase 1 or Phase 3. The second digit refers to the number of
that exit within the phase. Whenever possible, control passes directly from Phase 1 to
Phase 3, skipping the intermediate merge phase and its associated exits: E21, E25 and
E27.
As indicated in the following chart, the nature of the task determines the program exit to
be used.
Prepare for
other exit X X X
routines
Create
input
records for
X X
sort (Phase
1) and copy
(Phase 3)
Create
input
X
records for
merge
Add records X X X
Delete
X X X X X
records
Change
X X X X X
records
Sum
X X X
records
Choose
action if
intermedi- X
ate storage
insufficient
Close other
exit data X X X
sets
Process
X X
read errors
Process
X
write errors
Check
X X X
labels
Modify a
collating X X
sequence
* E15 in Phase 3 for copy only
Note that merge and copy are executed entirely in Phase 3 and are therefore restricted in
the exits which they can use. A merge application cannot use exits E11 through E27. A copy
application can use exit E15 but not exits E32 or E61.
Assemble each routine as a separate program and place it in a partitioned data set or in the
SYSIN input stream; MFX copies the SYSIN routines to the SORTMODS library for link-
age editing. (If a SYSIN module is to be used at more than one exit point, each exit must
have its own compiled copy of the module in SYSIN.) If MFX linkage edits an exit routine,
the module must have an entry point whose name is that of the MFX exit; for example, in
order to function as an E35 routine, MYEXIT must include an entry point or CSECT
labeled E35.
If a routine has already been link-edited, this can be indicated in the MODS statement.
When all the exits in a particular phase need to communicate with one another, the MODS
statement can be used to instruct the sort to link-edit them together.
Exit Conventions
The following conventions must be observed when using exits.
• Exits provided via the MODS control statement will be entered in the addressing mode
indicated by the linkage editor module attributes. Any exit linkage-edited by MFX will
be entered in 24-bit addressing mode, except a separately linkage-edited exit E11, E21,
or E31, which will be entered in the mode set by the compiler or assembler when the
module was compiled or assembled.
• Exit addresses provided via the 24-bit invoking parameter list format will be entered in
the 24-bit address mode.
• Exit addresses provided via the 31-bit invoking parameter list will be entered in the
address mode indicated in the exit address field. That is, if bit 0 of the exit address is 0,
the exit is entered in 24-bit mode; if bit 0 of the exit address is 1, the exit is entered in
31-bit mode.
• User exits may return to the sort in either 24- or 31-bit address mode.
• If an exit was entered in 24-bit address mode, the addresses passed to it will be 24-bit
values that have a clean high-order byte containing binary zeros (X'00'). Addresses
returned to the sort must also be 24-bit values with a high-order byte containing X'00'
even though the exit could return to the sort in the 31-bit mode.
Register Conventions
The standard operating system conventions apply to register usage. Exit routines must
save and restore Registers 0 and 2-14. The sort/merge places these contents in Register 1
and 13-15 for use by the exit routine when it takes control.
Register 13 The address of a 19-word area. The first 18 words can be used to
save registers, the 19th word to pass information between Assem-
bler exits.
Register 14 MFX’s return address, in the low-order address bits of the register.
The high-order bit(s) may have undefined contents.
Register 15 The address of the entry point of the exit routine, in the low-order
address bits of the register. The high-order bit(s) may have unde-
fined contents.
Figure 332. User Communication Area for Assembler Exit Using COMMAREA PARM
For COBOL or C exits, the address and length of this area are passed in the COBOL or C
program’s parameter list. In this case, there is no halfword preface – the address points
directly to the communication area.
Exits E11, E21, and E31 - Preparing for Other Exit Routines
These exits are unusual in that they are entered only once, at the beginning of their associ-
ated phase. Because of this, they may be separately link-edited and are efficiently used to
prepare for other exit routines (e.g., to open files or initialize variables). There are no
parameter lists or return codes for these exits.
Whenever the merge requires a new input record, MFX calls the E32 routine, passing it the
address of a two-word parameter list in Register 1.
PARAMETER LIST
The E32 routine must respond to three different cases: (a) MFX already has all the input
records; (b) the previous record finished an input file; and (c) there is at least one more
record to be added to the file with this file number. Only in the last case will the E32 supply
a record address to the merge, placing it in the second word of the parameter list. The E32
also places the appropriate return code in Register 15.
Return Codes
8 End of file. This tells MFX that a particular file has been completed and to
make no further request for records from that file.
12 Insert this record. This tells MFX to accept a new record from the input file
requested.
This exit is given control whenever MFX is about to add a record to an output sequence.
Since it does not take control before the first record of that sequence, the routine always
has access to a pair of sequenced records (e.g., for summation purposes). MFX passes the
exit program a two-word parameter list by loading its address into Register 1. The exit
must not destroy the contents of this parameter list. The first word, which is on a fullword
boundary, contains the address of the record about to be placed in an output sequence; the
second word contains the address of the record that has just been put into the output buffer.
There are two constraints on the type of processing the exit may accord this record pair:
• Sort control fields should not be changed since this may cause an out-of-sequence
condition.
After record processing is completed, the exit routine must place the appropriate return
code in Register 15. The exit must save and restore all registers except those used in link-
ing to the sort/merge.
Return Codes
0 Accept this record. This instructs MFX to accept the record whose address is
in the first word of the parameter list and place it in the output buffer. The
exit must also load the (work area) address of this record into Register 1
before returning control to the sort.
4 Delete this record. This instructs MFX to delete the record whose address is
in the first word of the parameter list. Do not place the address of this
record in Register 1. This return code might be employed, for example, after
using this record to update the previous (output) record. Assuming this
does not complete an output sequence for Phase 1, the next execution of the
E14 will find the same address in the second word of the parameter list.
When used in conjunction with an input file, this exit is given control every time a record is
brought into Phase 1 of a sort or Phase 3 of a copy. In passing control to the E15 exit rou-
tine, MFX places the address of a parameter list in Register 1. This parameter list is two
words long, aligned on a fullword boundary. In the first word, the first byte contains X'00';
the last 3 bytes contain the address of the record just brought into Phase 1. The first word
contains a zero address when there is no such record (i.e., when SORTIN end-of-file is
reached or when the input data set is empty).
PARAMETER LIST
• When the input data set consists of variable-length records, the first 4 bytes must
contain the Record Descriptor Word, giving the length of the record.
When the program has finished processing the record, it must place the appropriate return
code in Register 15.
When MFX is initiated from an ATTACH, LINK or XCTL macro, there are two ways to
include an E15 exit routine: (1) code the E15 exit routine in line with the invoking program
and specify the address of its entry point in the appropriate entry of the parameter list; or
(2) define the separately compiled routine in the MODS control statement. When the exit
routine is coded in line with the calling program, it must supply the entire input data set;
MFX will ignore a SORTIN DD statement, if present. Data set creation is done by supply-
ing the sort with one record at a time, placing its address in Register 1 and a return code of
12 in Register 15. After the last record has been submitted, the exit passes a return code of
8.
Return Codes
0 Accept this record. This instructs MFX to accept the record the exit has just
examined. Place the (work area) address of this record in Register 1. This
return code is used when selectively editing records from an input file; it
passes the (possibly altered) record back to the sort. The RECORD state-
4 Delete this record. MFX will delete the record just examined. There is no
need to load the address of this record into Register 1.
8 Do not return to this exit. This instructs MFX to close the exit for the
remainder of the sort application. This return code might be used at
SORTIN end-of-file (signalled by a zero address in the parameter list) to
indicate that extra records will not be added at this point. There is no need
to load a record address into Register 1 when passing a return code of 8. If
SORTIN is present, the current input record and all subsequent records
will be processed by MFX.
12 Insert a record. This tells MFX that the exit routine has located a record
which should be added to the input data set before the record whose
address appears in the parameter list. Load the address of the new record
into Register 1. When MFX returns control to the E15, the parameter list
will be unchanged. The exit routine can then add another record or process
the current one.
This return code can be used to add records to the end of the input data set
or to create the entire input data set. MFX returns to the exit routine, add-
ing records without changing the parameter list (in these cases, a zero
address) until a different return code (i.e., RC=8) is passed. When the input
data set is created in this way, the RECORD statement is required and
must specify both TYPE and LENGTH.
16 Terminate MFX. This tells MFX to terminate and return to the calling pro-
gram or the supervisor. MFX uses a completion code of 16 to indicate that
the sort was unsuccessful.
Like any other E15 exit routine, the COBOL E15 exit routine is called each time a record is
brought into Phase 1 of a sort or Phase 3 of a copy. Communication between MFX and the
COBOL exit takes place in the LINKAGE SECTION of the COBOL program. For example,
records are passed to the COBOL routine in the second definition (RECORD-UP) area of
the LINKAGE SECTION.
If the COBOL exit routine uses any verb (EXHIBIT, DISPLAY, TRACE) which results in
output to the SYSOUT DD statement, there is a potential conflict with MFX’s use of this
DD statement. It is therefore recommended that the user separate the output by using
either MFX’s MSGDD PARM option or the COBOL compiler’s SYSx parm.
The LINKAGE SECTION examples that follow show the parameters required for passing
fixed-length and variable-length records to the sort. The data-names and conditional
names used in the examples are arbitrary but each definition is required. The complete
programs from which the examples are taken follow the discussion of the exit.
LINKAGE SECTION.
01 EXIT-STATUS PIC 9 (8) COMPUTATIONAL.
88 FIRST-TIME VALUE 00.
88 MOST-TIME VALUE 04.
88 LAST-TIME VALUE 08.
01 RECORD-UP.
07 FILLER PIC 9(6).
07 R-SEQ2 PIC 9(2).
07 FILLER PIC X(92).
01 WORK PIC X(100).
01 DUMMY1 PIC X.
01 DUMMY2 PIC X.
01 DUMMY3 PIC X.
01 DUMMY4 PIC X.
01 DUMMY5 PIC X.
01 COMMUNICATION-AREA.
• For the first definition (EXIT-STATUS) specify PIC 9(8) COMPUTATIONAL. (This
area defines exit status codes.) When using 88 levels to define the exit status codes,
specify values 00, 04, and 08.
• For the third definition (WORK) define the record that will be passed to MFX. (This is
the "work area.")
• For the fourth through the eighth definitions define dummy areas.
LINKAGE SECTION.
01 EXIT-STATUS PIC 9 (8) COMPUTATIONAL.
88 FIRST-TIME VALUE 00.
88 MOST-TIME VALUE 04.
88 LAST-TIME VALUE 08.
01 RECORD-UP.
05 RU OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-RU PIC X.
01 WORK.
05 WK OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-WK PIC X.
01 IN-BUF PIC X(100).
01 DUMMY PIC X(4).
01 LEN-RU PIC 9(8) COMPUTATIONAL.
01 LEN-WK PIC 9(8) COMPUTATIONAL.
01 LEN-IB PIC 9(8) COMPUTATIONAL.
01 COMM-LEN PIC 9(4) COMPUTATIONAL.
01 COMMUNICATION-AREA.
05 COMM-AREA OCCURS 1 TO 256 TIMES
DEPENDING ON COMM-LEN PIC X.
• For the first definition (EXIT-STATUS) specify PIC 9(8) COMPUTATIONAL. (This
area defines exit status codes.)
• For the second definition (RECORD-UP) code an OCCURS clause with the
DEPENDING ON data-name option specifying (1) The minimum and maximum
number of bytes the variable SORTIN records contain (do not include 4 bytes for the
RDW) and (2) DEPENDING ON data-name PIC X. Data-name is defined in the sixth
definition in the LINKAGE SECTION.
• For the third definition (WORK) code an OCCURS clause with the DEPENDING ON
data-name option specifying (1) The minimum and maximum number of bytes for
variable-length records to be passed to MFX (do not include 4 bytes for the RDW) and
(2) DEPENDING ON data-name PIC X. Data-name is defined as the seventh definition
in the LINKAGE SECTION.
• For the sixth definition (LEN-RU) specify data-name PIC 9(8) COMPUTATIONAL.
This is where MFX passes the length of the SORTIN record to the COBOL exit.
• For the seventh definition (LEN-WK) specify data-name PIC 9(8) COMPUTATIONAL.
This is where the E15 routine passes the length of the work area record to MFX.
• For the ninth definition (COMM-LEN) specify PIC 9(4) COMPUTATIONAL. This area
defines the communication area length.
As always, the COBOL program must contain the entries required by the compiler for these
program divisions. Code the optional entries in these divisions according to the require-
ments of the application.
If the exit routine inserts records into the final merge and replaces records passed from
MFX, the insertion record and the replacement record may be defined in this section. These
records will be moved to the WORK area described in the LINKAGE SECTION, so be sure
that the PICTURE clause or the OCCURS clause in the WORK area is correct for these
records.
This section may also define the return codes as 77-level data items. Alternatively, these
codes can be specified as literals in the MOVE instruction. (MOVE literal to RETURN-
CODE.) Note that RETURN-CODE is the name of a predefined storage area in COBOL
used to pass return codes to the sort; RETURN-CODE should not be defined in the exit
routine.
Specify the USING option on the PROCEDURE DIVISION header. Each identifier
specified after USING must be the same as those described in the 01-level of the LINKAGE
The GOBACK statement is used to return control to MFX. Do not use the EXIT statement
as it will cause unpredictable results. Be sure that MFX receives a valid return code before
the GOBACK statement is executed.
00 First record. MFX uses this Code to indicate the first call to the COBOL exit
and that the first record from SORTIN is in the RECORD-UP area.
04 Most records. This is used for all calls except the first one when there are
records in the RECORD-UP area. After Code 00 has been issued, Code 04 is
passed to the exit until there is no record for the sort to pass to the
RECORD-UP area.
08 All records passed. This indicates that the last SORTIN record has already
been processed by the exit. Do not attempt to reference the record again. No
more records will be passed to the exit routine. Note that if the SORTIN
data set is empty, 08 will be passed every time including the first time.
0 Accept this record. This instructs MFX to accept the (unaltered) record in
the RECORD-UP area.
4 Delete this record. MFX will delete the current record in the RECORD-UP
area.
8 Do not return to this exit. This instructs MFX to close the exit for the
remainder of the sort application. This return code might be used at
SORTIN end-of-file (Exit Status Code 08) to indicate that extra records will
not be added at this point. If SORTIN is present, the current input record
and all subsequent records will be processed by MFX.
12 Insert a record. This instructs MFX to add the record in the WORK area to
the input data set just ahead of the current record in the RECORD-UP
area. When MFX returns control to the E15, the same record will be in the
RECORD-UP area. The exit routine can then add another record from the
WORK area or process the current record in RECORD-UP.
16 Terminate MFX. MFX will end its program and return to the calling pro-
gram or the Supervisor. MFX will issue a completion code of 16 to indicate
that the sort was unsuccessful.
To Change a Record
In order to change the record in the RECORD-UP area, first move it to the WORK area. All
changes are made to the WORK area copy, which replaces the record in RECORD-UP when
20 is moved to RETURN-CODE.
IDENTIFICATION DIVISION.
PROGRAM-ID. E15FL13C.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-370.
OBJECT-COMPUTER. IBM-370.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
I-O-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 EVEN-FLAG PIC 9(2) VALUE ZERO.
01 CHANGE-REC.
05 C-REC PIC X(6) VALUE 'CHANGE'.
05 C-INCR PIC 9(4) VALUE ZERO.
05 C-BLANK PIC X(90) VALUE ZERO.
01 INSRT-REC.
05 I-REC PIC X(6) VALUE 'INSERT'.
05 I-INCR PIC 9(4) VALUE ZERO.
05 I-BLANK PIC X(90) VALUE SPACES.
01 TOTAL.
05 BLANKS PIC X(10) VALUE ' E15'.
05 TITL PIC X(25) VALUE 'TOTAL RECORDS OUT'.
05 COUNTER PIC 9(8) VALUE 0.
01 RECORD-UP.
07 FILLER PIC 9(6).
07 R-SEQ1 PIC 9(2).
07 FILLER PIC X(92).
01 WORK PIC X(100).
IF R-SEQ1 EQUAL 6
MOVE 20 TO RETURN-CODE
MOVE CHANGE-REC TO WORK
GO TO RETURN-TO-SORT.
MOVE 0 TO RETURN-CODE.
RETURN-TO-SORT.
ADD 1 TO COUNTER.
IDENTIFICATION DIVISION.
PROGRAM-ID. E15VL19C.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-390.
OBJECT-COMPUTER. IBM-390.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
I-O-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 EVEN-FLAG PIC 9(2) VALUE ZERO.
01 CHANGE-REC.
05 C-REC PIC X(6) VALUE 'CHANGE'.
05 C-INCR PIC 9(4) VALUE ZERO.
05 C-BLANK PIC X(90) VALUE SPACES.
01 INSRT-REC.
05 I-REC PIC X(6) VALUE 'INSERT'.
05 I-INCR PIC 9(4) VALUE ZERO.
05 I-BLANK PIC X(90) VALUE SPACES.
01 TOTAL.
05 BLANKS PIC X(10) VALUE ' E15'.
LINKAGE SECTION.
01 EXIT-STATUS PIC 9(8) COMPUTATIONAL.
88 FIRST-TIME VALUE 00.
88 MOST-TIME VALUE 04.
88 LAST-TIME VALUE 08.
01 RECORD-UP.
05 RU OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-RU PIC X.
01 WORK.
05 WK OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-WK PIC X.
01 IN-BUF PIC X(100).
01 DUMMY PIC 9(8) COMPUTATIONAL.
01 LEN-RU PIC 9(8) COMP.
01 LEN-WK PIC 9(8) COMP.
IF NOT FIRST-TIME
ADD 1 TO COUNTER
MOVE 0 TO RETURN-CODE.
RETURN-TO-SORT.
IF LAST-TIME MOVE 8 TO RETURN-CODE
DISPLAY TOTAL.
GOBACK.
Like any other E15 exit routine, the C E15 exit routine is called each time a record is
brought into Phase 1 of a sort or Phase 3 of a copy. MFX and the C exit communicate
through arguments defined in the function header. For example, records are passed to the C
routine by the address presented in the second argument in the function parameter list. No
storage is reserved in the exit program because the records exist elsewhere.
The C E15 exit routine can be written using either the C370 V2R1 compiler with the V2R2
C370 Library, the SAA AD/Cycle C370 V1R2 Compiler and Library or using the C/C++ for
MVS/ESA V3R1.1 or higher Compiler and Library. When using the LE/370 run-time library
modules, it may be necessary to account for this additional storage by adjusting the b value
of the Exit-Name parameter on the MODS statement.
Exit Communication
The parameter list structure required for passing fixed-length and variable-length records
between the sort and the exit is detailed in the following section. The parameter names
used in the examples are arbitrary but each definition is required. Complete sample pro-
grams showing the use of the argument lists are presented following the discussion of the
exit interface.
00 First record. MFX uses this code to indicate the first call
to the C exit and that the first record from SORTIN is in
the record_up area. If the SORTIN is empty or does not
exist, a 08 status will be passed the first time.
dummy1 - dummy5 These parameters define unused place holders. They are used
with variable-length E15 and E35 communication. Their defini-
tion here allows a common parameter list for fixed-length and
variable-length C E15 and E35 exits.
dummy1 - dummy3 These parameters define unused place holders. They are used
with C E35 communication. Their definition here allows a com-
mon parameter list for C E15 and E35 exits.
The RETURN statement is used to return control to MFX. It must indicate one of the fol-
lowing return values to indicate the action to be taken by MFX.
0 Accept this record. This instructs MFX to accept the (unaltered) record in
the record_up area.
4 Delete this record. MFX will delete the current record in the record_up area.
8 Do not return to this exit. This instructs MFX to close the exit for the
remainder of the sort application. This return code might be used at
12 Insert a record. This instructs MFX to add the record in the work area to
the input data set just ahead of the current record in the record_up area.
When MFX returns control to the E15, the same record will be in the
record_up area. The exit routine can then add another record from the work
area or process the current record in record_up. When inserting a variable-
length record, insure that its length is indicated in the len_wk parameter.
16 Terminate MFX. MFX will end its program and return to the calling pro-
gram or the Supervisor. MFX will issue a completion code of 16 to indicate
that the sort was unsuccessful.
20 Replace current record. MFX will replace the current record in the
record_up area with the record in the work area. Be sure that the record in
the work area is valid before passing it to MFX. When replacing a variable-
length record, insure that its length is indicated in the len_wk parameter.
To change the record in the record_up area, first move it to the work area. All changes are
made to the work area copy, which replaces the record in record_up when the return value
from the exit is 20.
#define FIRST_TIME 0
#define MOST_TIME 4
#define LAST_TIME 8
#define ACCEPT_REC 0
#define DELETE_REC 4
#define END_EXIT 8
#define INSERT_REC 12
#define END_SORT 16
#define REPL_REC 20
typedef _Packed struct record {
char name[6];
char code[4];
int serial_no;
} t_ru;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int SMPE15FB(int* exit_status,t_ru* record_up,t_ru* work,int* dummy1,
int* dummy2,int* dummy3,int* dummy4,int* dummy5,int* comm_len,
void* communication_area)
{
static counter=0;
int icode,return_code;
char * text1="CHANGE";
char * text2="INSERT";
if (counter > 10) {return_code=ACCEPT_REC;
goto return_to_sort;}
if (*exit_status == LAST_TIME) {return_code=END_EXIT;
goto return_to_sort;}
#define FIRST_TIME 0
#define MOST_TIME 4
#define LAST_TIME 8
#define ACCEPT_REC 0
#define DELETE_REC 4
#define END_EXIT 8
#define INSERT_REC 12
#define END_SORT 16
#define REPL_REC 20
#define MAX_RLEN 104
typedef _Packed struct record1 {
char rec[6];
int incr;
char address[MAX_RLEN-14];
} t_ru1;
typedef _Packed struct record2 {
char title[10];
int number;
} t_ru2;
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
int SMPE15VB(int* exit_status,void* record_up,void* work,int* dummy1,
int* dummy2,int* len_ru,int* len_wk,int* dummy3,int* comm_len,
void* communication_area)
{
static counter=0,i_incr=0,i_number=0;
int return_code;
char *text1="CHANGE E15";
char *text2="INSERT E15";
t_ru1 * p_record1,*pwork1;
t_ru2 * p_record2,*pwork2;
p_record1 = (t_ru1 *)record_up;
pwork1 = (t_ru1 *)work;
p_record2 = (t_ru2 *)record_up;
pwork2 = (t_ru2 *)work;
if (*exit_status != FIRST_TIME) {counter++;
return_code=ACCEPT_REC;}
• The exit may not destroy the contents of the parameter list.
MFX will place the address of a 2-word parameter list in Register 1 each time it passes con-
trol to the E25 routine. The first word, which is on a fullword boundary, will contain the
address of the record about to leave Phase 2. The second word will contain the address of
the record that has already passed into the output area. Note that the first byte of each
word contains zeros.
In order to change the record leaving Phase 2, the E25 exit program must first move it to a
work area. (The record in the output area may be changed, but must be left where it is.) To
sum two records, place the sum in the output area record and delete the record leaving
Phase 2.
After the record pair has been processed by the E25, a return code is placed into Register 15
and control returns to MFX.
Return Codes
0 Accept this record. To instruct MFX to accept the record leaving Phase 2,
whether changed or unchanged, place return code 0 into Register 15. The
(work area) address of the record to be accepted must be placed into Regis-
ter 1.
4 Delete this record. This tells MFX to delete the record about to leave Phase
2. It is not necessary to place the address of this record in Register 1. The
next time MFX returns control to the exit program, the address of a new
record will be in word 1 of the parameter list but word 2 will be unchanged.
(This permits further summing, for example.)
16 Terminate MFX. MFX will end its program and return to the calling pro-
gram or the supervisor. MFX will give the user a completion code of 16 to
indicate that the sort was unsuccessful.
• The exit program may not destroy the contents of the parameter list.
When MFX is initiated from an ATTACH, LINK or XCTL macro, there are two ways to
include an E35 exit routine: (1) code the E35 exit routine in line with the invoking program
and specify the address of its entry point in the appropriate entry of the calling program’s
parameter list; or (2) define the separately compiled routine in the MODS control state-
ment. When the exit routine is coded in line with the invoking program, it must handle all
output processing; MFX will ignore a SORTOUT DD statement and an OUTFIL control
statement, if present.
This exit routine is given control each time MFX is about to place a record in the output
area after the final merge. In passing control to the E35 exit routine, MFX places the
address of a parameter list in Register 1. The parameter list starts at a fullword boundary
and is 3 words long; the first byte of each word contains binary zeros. The first word con-
tains the address of the record about to leave Phase 3; after the last record has been passed,
this word will contain zeros. The second word contains the address of the record already in
the output area; when the first record is passed, this word will contain zeros.
The third word contains the user address constant. It contains either the last value set in it
by an E15 exit routine or, if not modified by an E15 exit routine, the initial value from the
user exit address constant provided in the invoking parameter list. If the value was
obtained from the 24-bit invoking parameter list, it is limited to 24 bits with the high-order
byte set to X'00'.
If the user exit address constant was not provided or if MFX was JCL-invoked, it will con-
tain binary zeros. This word may be changed by the E35 exit routine whenever it is
entered, and it will remain the same on all subsequent entries to the E35 exit routine.
PARAMETER LIST
Return Codes
0 Accept this record. This instructs MFX to accept the record now leaving
Phase 3. Place the (work area) address of this record in Register 1. This
return code is used when selectively editing records for output; it passes the
4 Delete this record. MFX will delete the record leaving Phase 3. There is no
need to load the address of this record into Register 1. When MFX returns
control to the E35, the first word of the parameter list (the address of the
record leaving Phase 3) will refer to a new record, but the second word (the
address of the output area record) will be unchanged.
8 Disconnect E35. This instructs MFX to process any remaining records with-
out showing them to the E35 exit. Register 1 is ignored for processing this
return code. When this return code is used at end-of file (signalled by a zero
address in the first word of the parameter list), it indicates that E35 is also
finished and will not add additional records. When used before end-of-file, it
indicates that MFX should process the "current" record passed to the E35,
and any subsequent records, as if there were no E35 present. Note that
when MFX is not creating any output files (SORTOUT or SORTOFxx) and
E35 is the only "output", MFX terminates immediately, since any subse-
quent records will never be seen. Note that if an XSUM or XDUP data set
was being created, it will only contain records generated prior to the return
code of 8.
12 Insert a record. This tells MFX to add a record just before the record is
about to leave Phase 3. Load the address of the inserted record into Regis-
ter 1. When MFX returns control to the E35 exit routine, the first word of
the parameter list (the address of the record leaving Phase 3) will be
unchanged, but the second word (the address of the output area record) will
refer to the inserted record. The exit routine can then add another record or
process the current one.
16 Terminate MFX. This tells MFX to end its program and return to the calling
program or the supervisor. MFX uses a completion code of 16 to indicate
that the sort was unsuccessful.
Like any other E35 exit routine, the COBOL E35 is called each time a record is brought out
of Phase 3. Communication between MFX and the COBOL exit takes place in the LINK-
AGE SECTION of the COBOL program. For example, records are passed to the COBOL
routine in the second definition (RECORD-UP) area of the LINKAGE SECTION. No stor-
age is reserved in the exit program because the records exist elsewhere.
If the COBOL exit routine uses any verb (EXHIBIT, DISPLAY, TRACE) which results in
output to the SYSOUT DD statement, there is a potential conflict with MFX’s use of this
The LINKAGE SECTION examples that follow show the parameters required for passing
fixed-length and variable-length records to the sort. The data-names and conditional
names used in the examples are arbitrary but each definition is required. The complete
programs from which the examples are taken follow the discussion of the exit.
LINKAGE SECTION.
01 EXIT-STATUS PIC 9(8) COMPUTATIONAL.
88 FIRST-TIME VALUE 00.
88 MOST-TIME VALUE 04.
88 LAST-TIME VALUE 08.
01 RECORD-UP.
05 RU PIC X(100).
01 WORK.
05 WK PIC X(100).
01 IN-BUF.
05 IB PIC X(100).
01 COMMUNICATION-AREA.
The PICTURE and VALUE clauses for (1) the record passed from MFX, (2) the record
WORK area, and (3) the record in the output buffer are application-specific.
• For the first definition (EXIT-STATUS) specify PIC 9(8) COMPUTATIONAL. When
using 88 levels to define exit status codes, specify values 00, 04, and 08.
• For the second definition (RECORD-UP) define the record leaving Phase 3.
• For the fourth definition (IN-BUF) define the record in the output data set.
• For the fifth definition define a dummy area with PIC X(4).
• For the sixth through the eighth definition define dummy areas.
• For the ninth definition (COMM-LEN) specify PIC 9(4) COMPUTATIONAL. This area
defines the communication area length.
LINKAGE SECTION.
01 EXIT-STATUS PIC 9(8) COMPUTATIONAL.
88 FIRST-TIME VALUE 00.
88 MOST-TIME VALUE 04.
88 LAST-TIME VALUE 08.
01 RECORD-UP.
05 RU OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-RU PIC X.
01 WORK.
05 WK OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-WK PIC X.
01 IN-BUF.
05 IB OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-IB PIC X.
01 COMMUNICATION-AREA.
05 COMM-AREA OCCURS 1 TO 256 TIMES
DEPENDING ON COMM-LEN PIC X.
• For the first definition (EXIT-STATUS) specify PIC 9(8) COMPUTATIONAL. When
using 88 levels to define exit status codes, specify values 00, 04, and 08.
• For the third definition (WORK) code an OCCURS clause with the DEPENDING ON
data-name option specifying (1) the minimum and maximum number of bytes for
variable-length records you will pass to MFX (do not include 4 bytes for the RDW) and
(2) DEPENDING ON data-name PIC X. Data-name is defined as the seventh definition
in the LINKAGE SECTION. This area is used for the “work” area.
• For the fourth definition (IN-BUF) define records in the output area. Code an OCCURS
clause with the DEPENDING ON data-name option specifying (1) the minimum and
maximum number of bytes for variable-length records in the output data set (do not
include 4-bytes for the RDW) and (2) DEPENDING ON data-name PIC X. Data-name
is defined as the eighth definition in the LINKAGE SECTION.
• For the fifth definition define a dummy area with PIC X(4).
• For the sixth definition (LEN-RU) specify PIC 9(8) COMPUTATIONAL. MFX will pass
the length of the record leaving Phase 3 in this area.
• For the seventh definition (LEN-WK) specify PIC 9(8) COMPUTATIONAL. The E35
routine passes MFX the length of the record in the work area in this section.
• For the eighth definition (LEN-IB) specify PIC 9(8) COMPUTATIONAL. MFX passes
the length of the record in the output area in this section.
• For the ninth definition (COMM-LEN) specify PIC 9(4) COMPUTATIONAL. This area
defines the communication area length.
As always, the COBOL program must contain the entries required by the compiler for these
program divisions. Code the optional entries in these divisions according to the require-
ments of the application.
If the exit routine inserts records into the final merge and replaces records passed from
MFX, the insertion record and the replacement record may be defined in this section. These
records will be moved to the WORK area described in the LINKAGE SECTION, so be sure
This section may also define the return codes as 77-level data items. Alternatively, these
codes can be specified as literals in the MOVE instruction. (MOVE literal to RETURN-
CODE.) Note that RETURN-CODE is the name of a predefined storage area in COBOL
used to pass return codes to the sort; RETURN-CODE should not be defined in the exit rou-
tine.
Specify the USING option on the PROCEDURE DIVISION header. Each identifier
specified after USING must be the same as those described in the 01-level of the LINKAGE
SECTION. Taking for example the identifiers defined in the fixed-length record LINKAGE
SECTION shown here, they would appear as: PROCEDURE DIVISION USING EXIT-
STATUS, RECORD-UP, WORK, IN-BUF, DUMMY1, DUMMY2, DUMMY3, DUMMY4,
COM-LEN, COMMUNICATION-AREA.
The GOBACK statement is used to return control to MFX. Do not use the EXIT statement
as it will cause unpredictable results. Be sure that MFX receives a valid return code before
the GOBACK statement is executed.
00 First Record. MFX uses this Code to indicate the first call to the COBOL
exit and that the first record to leave Phase 3 is in the RECORD-UP area.
04 Most records. This is used for all calls except the first one when there are
records in the RECORD-UP area. After Code 00 has been issued, Code 04 is
passed to the exit until there is no record for the sort to pass to the
RECORD-UP area.
08 All records passed. This indicates that the last record has already been pro-
cessed by the exit. Do not attempt to reference the record again. No more
records will be passed to the exit routine. Note that if MFX is not passing
any records to Phase 3, 08 will be passed every time including the first
time.
0 Accept this record. This instructs MFX to accept the (unaltered) record in
the RECORD-UP area.
4 Delete this record. MFX will delete the current record in the RECORD-UP
area.
12 Insert a record. This instructs MFX to add the record in the WORK area to
the input data set just ahead of the current record in the RECORD-UP
area. When MFX returns control to the E35, the same record will be in the
RECORD-UP area. The exit routine can then add another record from the
WORK area or process the current record in RECORD-UP.
16 Terminate MFX. MFX will terminate and return to the calling program or
the Supervisor. MFX will issue a completion code of 16 to indicate that the
sort was unsuccessful.
20 Replace current record. MFX will replace the current record in the
RECORD-UP area with the record in the WORK area. Be sure that the
record in the WORK area is valid before passing it to MFX.
To Change a Record
In order to change the record in the RECORD-UP area, first move it to the WORK area.
Make the changes there and then pass return code 20 in RETURN-CODE. The altered
record in the WORK area will replace the record in RECORD-UP.
IDENTIFICATION DIVISION.
PROGRAM-ID. E35FL101.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-390.
OBJECT-COMPUTER. IBM-390.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
I-O-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 EVEN-FLAG PIC 9(2) VALUE ZERO.
01 CHANGE-REC.
05 C-REC PIC X(6) VALUE 'CHANGE'.
05 C-INCR PIC 9(4) VALUE ZERO.
05 C-BLANK PIC X(90) VALUE SPACES.
01 INSRT-REC.
05 I-REC PIC X(6) VALUE 'INSERT'.
05 I-INCR PIC 9(4) VALUE ZERO.
05 I-BLANK PIC X(90) VALUE SPACES.
01 TOTAL.
05 BLANKS PIC X(10) VALUE 'E35'.
05 TITL PIC X(25)
VALUE 'TOTAL RECORDS HANDLED'.
05 COUNTER PIC 9(8) VALUE 0
01 RECORD-UP.
05 RU PIC X(100).
01 WORK.
05 WK PIC X(100).
01 IN-BUF.
05 IB PIC X(100).
01 DUMMY1 PIC X(4).
IF NOT FIRST-TIME
ADD 1 TO COUNTER
MOVE 0 TO RETURN-CODE.
RETURN-TO-SORT.
IF LAST-TIME MOVE 8 TO RETURN-CODE
DISPLAY TOTAL.
GOBACK.
IDENTIFICATION DIVISION.
PROGRAM-ID. E35VL101.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-390.
OBJECT-COMPUTER. IBM-390.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
I-O-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 EVEN-FLAG PIC 9(2) VALUE ZERO.
01 CHANGE-REC.
05 C-REC PIC X(6) VALUE 'CHANGE'.
05 C-INCR PIC 9(4) VALUE ZERO.
05 C-BLANK PIC X(90) VALUE SPACES.
01 INSRT-REC.
05 I-REC PIC X(6) VALUE 'INSERT'.
05 I-INCR PIC X(4) VALUE ZERO.
05 I-BLANK PIC X(90) VALUE SPACES.
01 TOTAL.
05 BLANKS PIC X(10) VALUE ' E35'.
05 TITL PIC X(25)
VALUE 'TOTAL RECORDS HANDLED'.
05 COUNTER PIC 9(8) VALUE 0.
01 RECORD-UP.
05 RU OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-RU PIC X.
01 WORK.
05 WK OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-WK PIC X.
01 IN-BUF.
05 IB OCCURS 1 TO 100 TIMES
DEPENDING ON LEN-IB PIC X.
IF NOT FIRST-TIME
ADD 1 TO COUNTER
MOVE 0 TO RETURN-CODE.
RETURN-TO-SORT.
IF LAST-TIME MOVE 8 TO RETURN-CODE
DISPLAY TOTAL.
GOBACK.
Like any other E35 exit routine, the C E35 exit routine is called each time a record is
brought out of Phase 3. Communication between MFX and the C exit takes place through
arguments defined in the function header. For example, records are passed to the C routine
by an address presented in the second argument in the function parameter list. No storage
is reserved in the exit program because the records exist elsewhere.
The C E35 exit routine can be written using either the C370 V2R1 compiler with the V2R2
C370 Library, the SAA AD/Cycle C370 V1R2 Compiler and Library or the C/C++ for MVS/
ESA V3R1.1 Compiler and Library. When using the LE/370 run-time library modules, it
may be necessary to account for this additional storage by adjusting the b value of the Exit-
Name parameter on the MODS statement.
Exit Communication
The parameter list structure required for passing fixed-length and variable-length records
between the sort and the exit is detailed in the following section. The parameter names
used in the examples are arbitrary but each definition is required. Complete sample pro-
grams showing the use of the argument lists are presented following the discussion of the
exit interface.
in_buf The in_buf parameter contains a pointer to the record that MFX
is to put in the output data set. Until a record has been accepted
or inserted, this pointer will be null. A record at this address
can be modified if required.
dummy1 - dummy4 These parameters define unused place holders. They are used
with variable-length C E35 communication. Their definition
here allows a common parameter list for fixed and variable-
length C E15 and E35 exits.
0 Accept this record. This instructs MFX to accept the (unaltered) record in
the record_up area.
4 Delete this record. MFX will delete the current record in the record_up area.
8 Disconnect E35. This instructs MFX to process any remaining records with-
out showing them to the E35 exit. When this return code is used at end-of-
file (signalled by exit_status 08), it indicates that the E35 is also finished
and will not add additional records. When used before end-of-file, it indi-
cates that MFX should process the "current" record passed to the E35, and
any subsequent records, as if there were no E35 present. Note that when
MFX is not creating any output files (SORTOUT or SORTOFxx) and E35 is
the only "output," MFX terminates immediately, since any subsequent
records will never be seen.
12 Insert a record. This instructs MFX to add the record in the work area to
the input data set just ahead of the current record in the record_up area.
When MFX returns control to the E35, the same record will be in the
record_up area. The exit routine can then add another record from the work
area or process the current record in record_up.
16 Terminate MFX. MFX will terminate and return to the calling program or
the Supervisor. MFX will issue a completion code of 16 to indicate that the
sort was unsuccessful.
20 Replace current record. MFX will replace the current record in the
record_up area with the record in the work area. Be sure that the record in
the work area is valid before passing it to MFX.
Change a Record
In order to change the record in the record_up area, first move it to the provided work area.
Make the changes there and then pass return code 20. The altered record in the work area
will replace the record in record_up.
#define FIRST_TIME 0
#define MOST_TIME 4
#define LAST_TIME 8
#define ACCEPT_REC 0
#define DELETE_REC 4
#define END_EXIT 8
#define INSERT_REC 12
#define END_SORT 16
#define REPL_REC 20
#include <decimal.h>
typedef _Packed struct record {
char rec[6];
decimal(7,0) incr;
char address[90];
} t_ru;
int counter,i_incr;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int SMPE35FB(int* exit_status,t_ru* record_up,t_ru* work,t_ru* in_buf,
int* dummy1,int* dummy2,int* dummy3,int* dummy4,int* comm_len,
void* communication_area)
{
int return_code;
char *text1="CHANGE";
char *text2="INSERT";
if (*exit_status != FIRST_TIME) {counter++;
return_code=ACCEPT_REC;
}
#define FIRST_TIME 0
#define MOST_TIME 4
#define LAST_TIME 8
#define ACCEPT_REC 0
#define DELETE_REC 4
#define END_EXIT 8
#define INSERT_REC 12
#define END_SORT 16
#define REPL_REC 20
#define MAX_RLEN 104
typedef _Packed struct record1 {
char rec[6];
int incr;
char address[MAX_RLEN-14];
} t_ru1;
typedef _Packed struct record2 {
char title[10];
int number;
} t_ru2;
int counter,i_incr,i_number;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int SMPE35VB(int* exit_status,void* record_up,void* work,void* in_buf,
int* dummy,int* len_ru,int* len_wk,int* len_ib,int* comm_len,
void* communication_area)
{
if (*exit_status==LAST_TIME)
{ return_code=END_EXIT;
printf("E35 total number of records handled:%d\n",counter);
}
return(return_code);
Return Codes
0 Sort present records only. This instructs MFX to process only those records
presently contained on the intermediate storage devices. The sort will
receive message WER054I RCD IN xxxxxxxx, OUT yyyyyyyy if the data is
read from SORTIN directly, or WER055I INSERT xxxxxxxx, DELETE
yyyyyyyy if the data receives input exit (E14 or E15) or INCLUDE/OMIT
processing. The message’s RCD IN or INSERT xxxxxxxx figure indicates
how many records have been sorted. For a sort with no exits or INCLUDE/
OMIT processing, the remaining records may be sorted by running another
job using the SKIPREC=n parameter on the SORT control statement, skip-
4 Try to sort all records. This tells MFX to continue to read in records from
the input data set. If there are very few records left, the sort may complete
successfully. If there are too many records to continue the sort, MFX will
terminate with a SORT CAPACITY EXCEEDED message.
Exits E18, E38, and E39 - Checking Labels, Processing Read or Write
Errors, End-of-File Routines, Special VSAM Processing
These exits are mainly used for I/O error recovery routines. However, they may also be used
to check labels, to do end-of-file processing, and to provide various information to the VSAM
access method.
Exit E18 is only used for sorts and exit E38 only for merges or copies. Each exit is entered
exactly once, at the start of SORTIN processing. At this time, MFX checks Register 1 for
the address of a user parameter list specifying the various open and error exit routines the
user wishes MFX to include. MFX will then enter these routines at the appropriate times
during execution. Because use of these exits forces the use of BSAM for the input file(s),
performance may be adversely affected.
The format of the parameter list is given below. More information on the DCB fields can be
found in the appropriate IBM publication.
The parameter list must begin on a fullword boundary and consist of an integral number of
words. With the exception of the required fullword of zeros used to indicate the end of the
parameter list, entries are optional. The first byte of each word identifies the parameter:
SYNAD field Indicated by 01 in byte 1. The SYNAD field contains the address of a
synchronous read error routine, assembled as part of the exit program.
Note that you may not use Register 13 as a save area pointer on entry
to your routine. You must either provide your own save area or use the
SYNADAF macro instruction.
EXLST field Indicated by 02 in byte 1. The EXLST field contains the address of a list
of pointers to user routines that perform operations such as label check-
ing. Note that in the event that the list contains a DCB-exit entry, it
will not be entered during concatenated SORTIN processing.
EROPT code Indicated by 03 in byte 1. Bytes 2 and 3 contain zeros, byte 4 the
EROPT code. This code tells MFX what action to take if it discovers an
uncorrectable read error on a non-VSAM input file.
EODAD field Indicated by 04 in byte 1. The EODAD field contains the address of an
end-of-file routine. It can only be used with an E18 exit.
With VSAM input, these exits can be used to pass the addresses of various VSAM exits or
to insert passwords into VSAM input ACB’s. When control is returned to the sort, Register
1 must contain the address of a parameter list:
Table 55. Sample VSAM Parameter List for E18 and E38
If both address entries are present, they may be in either order. Only one need be present.
(QSAM parameters will be ignored.) The password list referenced in the parameter list is
found in the exit routine and is formatted as follows:
8-byte DDname
8-byte Password
The exit routine must not alter this list. The sort may destroy the last byte of the DD name
field.
The exit list is built using the VSAM EXLST macro, which provides the addresses of the
VSAM exit routines. VSAM branches directly to the routines which must return to VSAM
via the address in Register 14.
To do EODAD processing with E38, write a LERAD exit and check for X'04' in the FDBK
field of the RPL: this indicates input EOD. This field is needed by the merge, so it should
not be altered when returning to VSAM.
The following example shows how to code the return to the sort.
Exit E39 is used mainly for SORTOUT write error routines. The exit is entered once at the
beginning of merge or copy processing or the start of sort Phase 3. At this time MFX checks
Register 1 for the address of a user parameter list specifying the various routines the user
The parameter list must begin on a fullword boundary and consist of an integral number of
words. With the exception of the required fullword of zeros used to indicate the end of the
parameter list, entries are optional. The first byte of each word identifies the parameter:
SYNAD field Indicated by 01 in byte 1. The SYNAD field contains the address of a syn-
chronous write error routine, assembled as part of the exit program. Note
that you may not use Register 13 as a save area pointer on entry to your
routine. You must either provide your own save area or use the SYNADAF
macro instruction.
EXLST field Indicated by 02 in byte 1. The EXLST field contains the address of a list of
pointers to user routines that perform operations such as label checking. If
the EXLST field is specified, CHECKPOINT processing will not be per-
formed by MFX.
Exit E39 may be used to supply a VSAM exit list or password list for the output file in the
same manner as described for exits E18 and E38. Note that unlike E18 there is no EODAD
field with this exit.
For all order E control fields except BInary fields, the number of bytes in the control field
image will be the number specified as the l (length) value on the SORT/MERGE control
An E61 exit can process only the first 256 bytes of the control field image in a single pass. If
a control field image is more than 256 bytes long, the exit will be entered more than once
for that control field.
If AC is specified as the format of a control field on the SORT or MERGE statement, MFX
will translate the field to ASCII before the E61 routine is given control. In order to use an
E61 routine to modify what would be an AC control field, specify the field as CH in the
SORT or MERGE statement and translate the image to ASCII after it is altered by the E61
exit routine.
There is no advantage to coding an E61 exit if the ALTSEQ control statement can provide
the needed collating modification. ALTSEQ changes the installation’s alternate collating
sequence, used for all control fields specified with the format code AQ.
An E61 exit cannot be used with locale processing (LOCALE option enabled).
Each time your routine is executed, MFX will place the address of a three-word parameter
list in Register 1. The parameter list will be on a fullword boundary. The first word contains
the number of the control field within the record in byte 4. The second word contains the
address of the control field in the work area in bytes 2, 3, and 4. The third word contains
the length of the control field in bytes 3 and 4. All values are given in hexadecimal and the
unused bytes are filled with zeros.
The length of the control field image is completely determined by the length and format
code of the control field. Therefore, in order to provide a 12-byte PD image of 5 bytes from
the original record, it is necessary for the SORT/MERGE control statement to reference a
12-byte PD control field that contains the 5 desired bytes. The extra 7 bytes are used to con-
tain the "lengthened" image.
The length of the control field image is completely determined by the length and format
code of the control field. To shorten a control field image, specify the full length of the origi-
nal control field as the l (length) value in the SORT/MERGE control statement. Then
shorten each image by the same number of bytes and pad it uniformly to the length of the
original field. Be sure to pad each control field image with the same leading or trailing
character, and replace data in the control field image with the same type of data as that in
the actual control field.
Every order E control field is collated according to its image and format code, in ascending
order. To collate the field in apparent descending order, complement the control field image
according to its format code before returning control to MFX. For a BI or CH field, for exam-
ple, complement the image with hexadecimal FF’s before returning control to the sort.
MFX provides a number of special REXX variables to facilitate the development of REXX
exits. These variables offer a simple, efficient means of establishing communication
between the exit and the sort/merge.
To load these variables, the following command must be used when the exit is called.
When the exit completes its work, the exit should use the following sequence of commands
to return the variables to MFX.
If an E15 is providing all the input (SORTIN not present), the only
valid values for SYACTION are INSERT, CLOSE or ABEND.
SYEXITYP This variable will automatically be set to E15 or E35, depending on
which type of exit is being called.
SYGBLN1... These eight special variables are global variables. The user may set
...SYGBLN8 these to any value provided that the value does not exceed 15 charac-
ters in length. MFX will insure that these variables are preserved
across calls to the exit.
SYGBLSTR This is an additional global variable. The user may set this to any
value, provided the string does not exceed 1024 characters in length.
MFX will insure that this variable is preserved across calls to the exit.
The following example illustrates a REXX exit that will count the number of records that
are passed to the exit:
This chapter briefly outlines the flow of control in the standard Disk Sort, incore sort,
merge and copy. It describes the order in which MFX will process and act on the PARMs,
control statements and exit routines provided by the user. Note that all executions begin
with Phase 0 processing and that a given MFX execution will skip steps where appropriate
(e.g., will skip a “Variable-length record sampling” step if sorting fixed-length records or
HISTOGRM length values are supplied). No attempt has been made to indicate which
steps are required of all Disk Sorts, incore sorts, etc., or to indicate the nature or timing of
any abend processing.
Phase 0
• Process PARMs, merging EXEC and $ORTPARM PARM specifications. The EXEC
statement/invoking program’s parameter list overrides the installation defaults.
$ORTPARM overrides the EXEC statement/invoking program’s parameter list.
• Process control statements (from the $ORTPARM DD statement and either the SYSIN
DD statement or the invoking program’s parameter list).
• GO TO ————————————— Phase 1
Phase 1
non-JOIN
• Call E11.
• Call E18.
• Open SORTIN.
• Call E15.
• Call E61.
• Call E14.
• Close SORTIN.
• Call E17.
Phase 1
JOIN
INCORE SORT
Determination
• GO TO ———————————— Phase 2
Incore Sort
• Call E31.
• Call E39.
• Open SORTOUT.
• Call E35.
• Write to SORTOUT.
• Close SORTOUT.
• Call E37.
• GO TO ————————————— Program
Termination
Phase 2
• Call E21.
• Call E27.
• GO TO ————————————— Sorting
Phase 3
Sorting
Phase 3
• Take checkpoint.
• Call E31.
• Call E39.
• Call E35.
• If SORTOUT, SORTOFxx or SORTOFx are present, then for each output data set:
• Call E37.
• GO TO ————————————— Program
Termination
Non-Sorting,
non-JOIN Phase
3
• Call E31.
• Call E38.
• Call E39.
• Read from SORTIN/SORTINnn or DB2 database for DB2 query or (for a merge) call
E32 for a record.
• Call E35.
• If SORTOUT, SORTOFxx or SORTOFx are present, then for each output file:
• Call E37.
• GO TO ————————————— Program
Termination
JOIN Non-
Sorting Phase 3
• Call E35.
• If SORTOUT, SORTOFxx or SORTOFx are present, then for each output file:
• GO TO ————————————— Program
Termination
Program
Termination
• END.
MAXSORT breaks up the sorting process into small, individual sorts. At the end of each
individual sort a natural breakpoint occurs. At this time, the sorted data is written out on
intermediate storage devices and it becomes possible to stop the program without losing
the results of the previous processing. At each breakpoint, an operator may intervene to
change program options.
When all the input to the sort has been read and has become individual sorted data sets,
this output becomes input to one or more merges. If all the data sets can be merged at once,
one final merge is performed. If all the data sets cannot be merged at once, some of them
will be combined in one or more intermediate merges. Then, when all the data sets can be
merged at one time, the final merge is performed and the final sorted output is produced.
The diagrams on the following two pages illustrate the MAXSORT technique.
• MAXSORT requires less disk space than ordinary sorts. Because MAXSORT stores the
output of each individual sort on tape, the same disk SORTWK files can be used over
and over again.
• Since the output of each individual sort is a completely sorted data set, the original job
may be interrupted for higher priority jobs without wasting processing time.
• If a system or program failure occurs, whatever data sets have already been produced
are still usable. The job can be restarted at the last breakpoint, and all previously
produced data sets can be used without resorting.
DD Statements
MAXSORT’s DD statement requirements are summarized in the following table. As many
as three additional types of DD statements may be needed. Note that SORTWK files must
be allocated only to disk devices.
When the RELEASE=ON parameter is active (either via specification or by default) at the
conclusion of the sort portion of a MAXSORT, most of the allocated SORTWK space is free
(however, in the case of invoked sorts or SORTWKs defined as OLD, the data set is
returned to the size allocated at MAXSORT initiation rather than the minimum size possi-
ble).
The breakpoint data set must be allocated on a direct access device. It is recommended that
space for the breakpoint data set be allocated in the job step preceding the sort step. Or, the
breakpoint data set may be pre-allocated in a separate job.
The following example illustrates how disk space for a breakpoint data set might be allo-
cated as part of a MAXSORT job control stream. These two statements would follow the
JOB statement:
Figure 357. Sample Job Step Allocating Disk Space for a Breakpoint Data Set
In this example, the name of the breakpoint data set is BKPT.DATA. Because this data set
must be kept until MAXSORT has completed, DISP=(NEW,CATLG) has been specified.
Supplying approximately 100K bytes of primary space and allowing for secondary alloca-
tion should be adequate.
The sample SORTBKPT DD statement which follows identifies the breakpoint data set for
which disk space has already been allocated.
//SORTBKPT DD DSN=BKPT.DATA,DISP=(OLD,KEEP)
This SORTBKPT DD statement defines the breakpoint data set for which disk space has
previously been allocated. The data set name must be the same name which was specified
when the space for the breakpoint data set was allocated. DISP=(OLD,KEEP) is specified
SORTOU00 DD Statement
The SORTOU00 DD statement is required for every MAXSORT application in which the
intermediate output is stored on tape.
The SORTOU00 DD statement defines the unit to be used for the output of the individual
sorts and intermediate merges. MAXSORT will create and name these data sets which will
eventually be merged to produce the final sorted output.
The data set names generated will have one of the two formats. If the TIMESTMP option is
not specified (the installation default), data set names will have the format:
Snn
TDS.jobname.
Mnn
Figure 359. Data Set Names Format for TIMESTMP Not Specified
If the TIMESMP option is specified at installation time, data set names will have the for-
mat:
Snn
TDS.Ddddhhmm.jobname.
Mnn
In either case, the S or M indicates whether the output is from the sort phase or from the
merge phase; nn is the relative number of the data set (01 to 99). The Ddddhhmm time
stamp refers to the time (Julian day, hour and minute) the sort began. The prefix default
(TDS.) can be changed by specifying the BKPTDSN PARM option.
• Specify the DEFER option in the UNIT parameter so that mount messages to the
operator that do not pertain to MAXSORT are suppressed.
• If DYNATAPE is in effect, the tape unit name must be the same as the unit name
specified in the TAPENAME PARM.
//SORTOU00 DD DSN=PERM.OU00,DISP=(NEW,KEEP),
// UNIT=(TAPE,,DEFER),VOL=PRIVATE
SORTOUnn DD Statements
The SORTOUnn DD statements allocate the tape units used as input to the merge phase.
They are required unless the DYNATAPE option (available only under z/OS) is used.
• At least two tape units must be allocated in the absence of DYNATAPE. However,
allocating more units will make the merge phase complete more quickly.
• Each statement must be allocated to a unique tape drive. If DYNATAPE is in effect, the
tape unit name must be the same as the unit name specified in the TAPENAME
PARM.
• All the tape units must operate at the same recording density. For best performance,
multiple density units should be run at the highest density.
• For each SORTOUnn statement, replace the 'nn' with a two digit number between 01
and 99. The numbers need not be consecutive.
• Specify the DEFER option in the UNIT parameter so that mount messages to the
operator that do not pertain to MAXSORT are suppressed.
//SORTOU01 DD DSN=PERM.OU01,DISP=(NEW,KEEP),
// UNIT=(TAPE,,DEFER),VOL=PRIVATE
//SORTOU02 DD DSN=PERM.OU02,DISP=(NEW,KEEP),
// UNIT=(TAPE,,DEFER),VOL=PRIVATE
If disk is used for intermediate storage, the following rules should be observed:
• To determine how many SORTOUnn DD statements to supply, divide the total number
of bytes of sort input data by the number of bytes of SORTWK space and add 2 to the
result. This figure is the number of SORTOUnn statements to supply. If too few
SORTOUnn DD statements are supplied, MAXSORT will terminate for restart at the
point at which a new DD statement is needed.
• Each SORTOUnn DD statement must allocate enough primary and secondary space to
hold all of the data written during that intermediate sort.
• Track overflow is not supported for disk SORTOUnn data sets. Record lengths must not
exceed the track capacity unless VS or VBS records are being processed.
SORTCKPT DD Statement
This DD statement is required in order to restart a MAXSORT which is task-invoked or
includes a user exit routine because in these cases MAXSORT cannot be restarted from a
breakpoint. The standard OS/VS Checkpoint-Restart feature is used. Both automatic
Checkpoint-Restart and deferred Checkpoint-Restart capabilities are supported (see
“Chapter 14. Performance Considerations”). Checkpoints are taken at the end of each inter-
mediate sort or merge.
A MAXSORT with an E35 exit does not require the SORTCKPT DD statement.
Control Statements
Control statements will only be accepted at the initial execution of MAXSORT. If
MAXSORT is restarted, the control statements cannot be changed. Except for JOIN,
JOINKEYS, MERGE and REFORMAT, all MFX control statements are supported for
MAXSORT. In addition, the RESTART subparameter of the SEQNUM parameter and the
IFTHEN WHEN=GROUP parameter are not supported on an INREC statement.
PARM Options
The MAXSORT parameters described below may be specified on the EXEC statement, the
$ORTPARM DD statement, PARMTBLE or PARMEXIT, and may be listed in any order.
BKPTDSN
cc...c.
BKPTDSN=
TDS.
The BKPTDSN PARM is used to change the prefix of the data set names for the output of
the individual sorts and intermediate merges. TDS. is the delivered default. The last char-
acter of the prefix must be a period. If the TIMESTMP option was specified at installation
time, up to 21 characters may precede that period. Otherwise, up to 31 characters may be
specified before the final period.
DYNATAPE
DYNATAPE
NODYNATAPE
DYNATAPE instructs MAXSORT to dynamically allocate any tapes needed as input for the
merge phase. DYNATAPE may be used instead of (or as a supplement to) SORTOUnn DD
statements.
MAXSORT
MAXWKSP
MAX
MAXWKSP= nM
n
This option specifies the maximum amount of disk SORTWK space that MAXSORT can
use. When this parameter is used, MAXSORT will release excess space in order to meet the
figure specified by the user.
When the RELEASE=ON parameter is active (either via specification or by default) at the
conclusion of the sort portion of a MAXSORT, most of the allocated SORTWK space is freed
(however, in the case of invoked sorts or SORTWKs defined as OLD, the data set is
returned to the size allocated at MAXSORT initiation rather than the minimum size possi-
ble).
If MAX, the default value, is specified, all primary and secondary space which has been
allocated will be acquired. The MAXWKSP value may also be specified as a decimal num-
ber of cylinders (n) or as a decimal number of megabytes (nM) of work space.
MINWKSP
500
MINWKSP= nM
n
The MINWKSP value may be specified as a decimal number of cylinders (n) or a decimal
number of megabytes (nM) of work space.
RESTART
LAST
RESTART= NO
id
LAST, the default value, requests that the sort start at the most recent breakpoint.
NO specifies that the SORTBKPT data set is to be cleared so that it can be used for a new
job. (Be sure to specify NO only when the SORTBKPT data set is empty or should be
destroyed.)
To restart at a particular breakpoint, code its id number. The breakpoint id number is pro-
vided by message WER350I.
SORTSIZE
n
SORTSIZE= nM
nT
SORTTIME
n
SORTTIME=
1440
The SORTTIME parameter terminates the sort at the next breakpoint after n minutes of
clock time have elapsed. (The sort may be restarted later.) The default is 1440 minutes (24
hours).
If this parameter is omitted or 1440 is specified, the sort will not terminate prematurely.
This parameter may be specified with operator communication at installation time. If oper-
ator communication is specified, the sort will be interrupted at the next breakpoint after
the specified amount of time has elapsed and the operator will be asked whether to termi-
nate the sort or continue until the next breakpoint.
TAPENAME
name
TAPENAME=
TAPE
This parameter specifies the tape unit generic name for dynamic tape allocation. The
default TAPENAME is TAPE.
If the TAPENAME parameter is specified, the same unit generic name must be specified
for both the SORTOU00 and the SORTOUnn DD statements.
The tape unit generic name must be a valid unit name at your installation.
Exit Programs
All the exits available for Disk Sort are supported for MAXSORT. However, since
MAXSORT never runs out of work space on even the largest sorts, an E16 exit routine will
never be called. Exit routines may be written in COBOL, C, Assembler language, or REXX.
All exits should be prelink-edited for maximum efficiency.
The following rules must be observed when MAXSORT includes an exit routine:
• MAXSORT may take system checkpoints when the following exits are active: E14, E15,
E25, E35 and E61. Since a checkpoint may be taken between any two calls of these
exits, these routines should be coded accordingly. Any restrictions that apply to system
Checkpoint-Restart, such as restrictions on the use of data sets, are applicable to the
coding of these exit routines.
When MAXSORT is invoked from a program, the MAXSORT PARM should be specified in
the $ORTPARM DD statement. The SYSIN DD statement is ignored.
Restarting MAXSORT
A JCL-initiated MAXSORT can be restarted from a breakpoint if necessary. When
MAXSORT is restarted from a breakpoint, the following PARM options cannot be modified:
CMP=CPD/CLC, EQUALS, E15/E35=COB, FILSZ, LOCALE, MAXSORT, STOPAFT and
TAPENAME. Other PARM options will be accepted if they are specified on the EXEC
statement. Only the CORE parameter can be passed through $ORTPARM.
MFX control statements cannot be modified when MAXSORT is restarted. However, the l5,
l6 and l7 values on the LENGTH parameter of the RECORD control statement can be
altered.
To specify that checkpoints be taken for a MAXSORT with an exit routine or for an invoked
MAXSORT, the following rules must be observed:
• Include the SORTCKPT DD statement in the JCL (in addition to the SORTBKPT DD
statement.
Operator communication with MAXSORT is not a delivered default - these options must be
enabled at MFX installation time.
For example, if MAXSORT’s assigned block of computer time (its SORTTIME value) has
been exhausted and MFX was installed to permit operator intervention at such times, mes-
sage WER375D is generated.
The operator receiving this message can decide to terminate the sort or allow it to continue,
basing his decision on scheduling priorities and the estimated time of the sort. When
another 30 minutes have passed, the operator will be asked again whether or not
MAXSORT should be terminated.
When DYNATAPE is specified and operator communication has been enabled at installa-
tion time, message WER376D may be generated to report the results of the dynamic alloca-
tion attempt.
If the operator responds 'GO', MAXSORT will execute with four tape units. If the operator
responds 'STOP', MAXSORT will terminate. If the operator responds with a number ('NN'),
MAXSORT will try to allocate that total number of tape drives. Ideally, the operator should
specify six for 'NN' because MAXSORT needs six tape units for best performance. If the
operator requests additional tape units, message WER376D will be reissued. The operator
will again be prompted for a 'GO', 'STOP' or 'NN' reply. In this way, the operator can bal-
ance the requirements of MAXSORT against the requirements of other jobs that are exe-
cuting at the same time.
When DYNATAPE is specified, there may not be enough tape units available for dynamic
allocation. In this case, message WER377D is generated.
Figure 374. Example: Operator Notification of Insufficient Tape Units under DYNATAPE
The operator receiving message WER377D can wait until additional tape drives have been
released and then reply 'RETRY'. Or, the operator can answer 'STOP' to terminate the job
and then restart it later when more tape drives become available.
If the DYNATAPE and TAPENAME PARMs have been specified and all tape units on the
system within the TAPENAME class have already been allocated, message WER378D is
generated.
Figure 375. Example: Operator Notification of Insufficient Tape Units for TAPENAME
Class
Message WER378D is followed by message WER376D if the number of tape drives allo-
cated is sufficient for execution, or by message WER377D if it is not sufficient.
Example 1: A 100 Gigabyte MAXSORT with only Minimal Disk Space Available
An installation is running a 100 gigabyte sort and has a restricted amount of disk space
available for SORTWK across ten volumes (WORK1, WORK2, ...WORK10).
Figure 376. Sample JCL Control Stream for a 100 Gigabyte MAXSORT
2. This statement allocates the space for the breakpoint data set. Specify (NEW,CATLG)
because this data set must be saved.
3. The EXEC statement initiates the regular MFX program, and the MAXSORT PARM is
specified, as required. This job requests a minimum of 6000 cylinders of disk space for
SORTWKnn data sets. If that much space cannot be obtained during the job, the
program will terminate.
5. These DD statements are coded just as they would be for an ordinary sort.
7. The SORTOU00 DD statement is required for this job because the intermediate sort
output will be stored on tape. DISP=(NEW,KEEP), a permanent DSN and
VOL=PRIVATE are specified to ensure that the system unloads each output tape. The
DEFER option in the UNIT parameter is specified so that mount messages to the
operator that do not pertain to MAXSORT are suppressed.
8. The SORTOU01, SORTOU02 and SORTOU03 DD statements allocate the tape units
used as input to the merge phase. Permanent DSNAMEs, DISP=(NEW,KEEP),
VOL=PRIVATE and the DEFER option in the UNIT parameter are all specified just as
they were for the SORTOU00 DD statement.
Example 1 can be restarted from a breakpoint simply by submitting the original job control
stream without the job step which allocated space for the breakpoint data set. The job will
be restarted from the last breakpoint because RESTART=LAST is the default; it is not nec-
essary to specify RESTART=LAST on the EXEC statement.
Figure 377. Sample JCL Control Stream for Restarting a 100 Gigabyte MAXSORT
The JCL is identical to the JCL in Example 1 except that the step which allocated the disk
space for the breakpoint data set is not resubmitted.
This example is identical to Example 1 with one difference: the DYNATAPE PARM
requests dynamic tape allocation.
Figure 378. Sample JCL Control Stream for a 100 Gigabyte MAXSORT
The DYNATAPE PARM requests that tape units be obtained dynamically. Because
DYNATAPE has been specified, the SORTOU01, SORTOU02, and SORTOU03 DD
statements specified in Example 1 do not have to be supplied. They will be created and
dynamically allocated when needed. If enough tape units are available at the time the job is
run, the sort will be successfully completed in one step.
For best results, code two SORTOUnn DD statements in addition to specifying the
DYNATAPE PARM as the above example illustrates. This approach ensures that
MAXSORT will have the minimum two tape units needed for the merge phase and also
allows MAXSORT to take advantage of the additional tapes available under dynamic
allocation.
Tuning MAXSORT
A good rule of thumb is that each intermediate sorted data set should create from one to
five volumes of input data, and the only way to determine the amount of input data is by
controlling the amount of SORTWK space used. This is illustrated in Figure 379.
If only 3,000 cylinders were allocated in the preceding example, 45 intermediate sorts
would be performed, increasing the required tape mounts and potential for error. If 75,000
cylinders were allocated, most of the input would be processed by the first intermediate
sort, delaying the first breakpoint and introducing the potential for losing data. It is cru-
cial, therefore, to allocate a balanced amount of DASD space that will divide your file into
reasonably sized segments to minimize the possibility of system error and to enhance your
performance.
PARASORT requires additional tape units for the application. You will need from two to
eight times the current number of tape units, depending upon resource availability and the
degree of improvement desired. PARASORT automatically manages the tape units and
minimizes the use of the tape drive resources by deallocating excess tape drives during ini-
tialization and releasing all the extra units at the end of the sort input phase.
PARASORT Applicability
Certain MFX facilities or application characteristics cannot be used with PARASORT. The
following are incompatible with a PARASORT application:
• Certain unusual sort key types, feature combinations, or long sort keys in excess of 800
bytes.
• FIELDS=COPY specified.
DD Statements
PARASORT’s DD statement requirements are summarized in the following table. One
additional DD type (SORTPARn) is required compared to a conventional disk sort.
The SORTIN and SORTPARn DD statements are discussed below. For a discussion of the
other DD statements, which are specified for PARASORT just as for a non-PARASORT
Disk Sort, see “Chapter 4. JCL and Sample JCL/Control Statement Streams”.
For optimal performance, data sets that reside on tapes, such as 3480s, that can be read
only in a single direction should have two units allocated. If the data set is on a tape that
supports bidirectional processing, a single unit is sufficient. In all cases DEFER mounting
must be specified.
SORTIN data sets may not be passed data sets or have PASS specified on their DD state-
ment.
The following example SORTIN DD statements for PARASORT illustrate three different
SORTIN cases:
Note that each example includes a y on the UNIT specification (for example,
UNIT=(3480,y,DEFER)). The y is either 1 or 2 and indicates the number of units to be allo-
cated for these devices. For optimal performance, data sets that reside on tapes that can be
read only in a single direction, such as 3480s, should have two units allocated. If the data
set is on a tape that supports bidirectional processing, a single unit is sufficient. In all cases
DEFER mounting must be specified.
Example 1
//SORTIN DD DSN=INPUT.FILE,DISP=(OLD,KEEP),
// UNIT=(,y,DEFER)
or if a special esoteric name is available
// UNIT=(xxxxx1,y,DEFER)
//SORTIN DD DSN=INPUT.FILE,DISP=(OLD,KEEP),
// UNIT=(3480,y,DEFER),VOL=SER=(VOL001,VOL002,...,VOL00N)
or if special esoteric name is available
// UNIT=(xxxxx1,y,DEFER),VOL=SER=(VOL001,VOL002,...,VOL00N)
This example presumes the file is standard label and the first file is on VOL001.
For uncataloged data sets, the unit and volser list must be specified.
Example 3
//SORTIN DD DSN=INPUT.FILE1,DISP=(OLD,KEEP),
// UNIT=(3480,y,DEFER),VOL=SER=(VOL001,VOL002,VOL003)
or if special esoteric names are available
// UNIT=(xxxxx1,y,DEFER),VOL=SER=(VOL001,VOL002,VOL003)
// DD DSN=INPUT.FILE2,DISP=(OLD,KEEP),
// UNIT=AFF=SORTIN,VOL=SER=(VOL101,VOL102)
// DD DSN=INPUT.FILE3,DISP=(OLD,KEEP),
// UNIT=AFF=SORTIN,VOL=SER=(VOL201)
SORTPARn DD Statements
The SORTPARn DD statements define units that will be used to perform the parallel read-
ing of the input file. Up to four SORTPARn DD statements may be provided, with a mini-
mum of two required. The number of SORTPARn DD statements that you provide may be
limited by the tape channel capacity at your installation. See “Special Channel Separated
Esoteric Names” on page 10.7 for information on how to determine if your choice is limited.
The n in the SORTPARn is replaced with numbers 1 through 4. The numbers must start at
1 and be numbered consecutively.
//SORTPAR1 DD DSN=*.SORTIN,DISP=OLD,
// UNIT=AFF=SORTIN
//SORTPAR1 DD DSN=*.SORTIN,DISP=OLD,UNIT=AFF=SORTIN,
// VOL=SER=(VOL001,VOL002,...,VOL00n)
where the VOL=SER list contains the identical volumes specified on the SORTIN DD
specification. If the SORTIN DD is a series of concatenations, the VOL=SER list con-
tains the volumes that comprise the first data set in the concatenation.
The remaining SORTPARnn DDs are coded as shown on the following prototype
SORTPARnn DD statement:
//SORTPARn DD DSN=*.SORTIN,DISP=(,KEEP,KEEP),
// VOL=PRIVATE,UNIT=(xxxx,y,DEFER)
or if special esoteric names are available
// VOL=PRIVATE,UNIT=(xxxxxn,y,DEFER)
The xxxx is a unit type or generic name compatible with the device associated with
SORTIN. If special channel separated esoteric names have been made available, see
“Special Channel Separated Esoteric Names” on page 10.7.
The y is either 1 or 2 and indicates the number of units to be allocated for these devices. For
optimal performance, data sets that reside on tapes that can be read only in a single direc-
tion, such as 3480s, should have two units allocated. If the data set is on a tape that sup-
ports bidirectional processing, a single unit is sufficient. In all cases DEFER mounting
must be specified.
• The total number of volumes to be read from SORTIN and its concatenations.
There is no need to allocate more SORTPARn data sets than total volumes in the
SORTIN file. Note that if more SORTPARn data sets are allocated than there are
volumes, the excess SORTPARn data sets will be deallocated at PARASORT’s initi-
ation.
• The degree of channel contention, which may reduce the number of SORTPARn DD
statements used.
The use of special esoteric unit names will ensure that this contention is elimi-
nated, but your choice for the number of SORTPARn DD statements may be lim-
ited.
• Resource availability.
System constraints may limit the number available to a particular job.
1. Decide whether you would like to specify 4-way (up to SORTPAR4), 3-way (up to
SORTPAR3) or 2-way (up to SORTPAR2) input.
2. In the table of special esoteric names provided by your systems programmer, find the
name that corresponds to the tape type of the SORTIN data sets.
The following is a sample table of special esoteric names. This table is for illustration
only; the names at your site may be different.
3. Use the name from the table at your site for your SORTIN and SORTPARn names. The
following example JCL is for input from 3480 cartridges with at least 4 volumes:
//SORTIN DD DSN=....,DISP=(OLD,KEEP),UNIT=(PAR441,2,DEFER)
//SORTPAR1 DD DSN=*.SORTIN,DISP=OLD,
// UNIT=AFF=SORTIN
//SORTPAR2 DD DSN=*.SORTIN,DISP=(,KEEP,KEEP),
// VOL=PRIVATE,UNIT=(PAR442,2,DEFER)
//SORTPAR3 DD DSN=*.SORTIN,DISP=(,KEEP,KEEP),
// VOL=PRIVATE,UNIT=(PAR443,2,DEFER)
//SORTPAR4 DD DSN=*.SORTIN,DISP=(,KEEP,KEEP),
// VOL=PRIVATE,UNIT=(PAR444,2,DEFER)
Sortwork Considerations
The amount of sortwork space required is the same as if the application were run as a
conventional sort. What should be modified, if sortworks are provided via JCL rather than
DYNALLOC, is the number of SORTWKxx DD statements. Try to provide a total number of
SORTWKxx DDs that is two to three times the number of SORTPARns specified. This
would typically require an adjustment in primary and secondary space amounts so that the
total space allocated is similar to that of the original application. This subdivision of
SORTWORK space will provide an opportunity for additional channel path availability.
This parallelism in SORTWORK channel paths is also a key to improving sort elapsed time
performance.
or
These messages can be disregarded since this type of processing is deliberate with
PARASORT.
MFX can directly retrieve data from a DB2 database based on a user-provided query. An
SQL SELECT statement is used to specify the criteria of the request. The query of the DB2
database replaces MFX's SORTIN or E15 processing. SORT or COPY functions, but not
MERGE, can be used with DB2 queries. All MFX features performed after E15 processing
are available for use with the DB2 query facility. Refer to “Chapter 8. The Flow of the Sort”
for a summary of MFX's features and flow of control during processing.
The MFX DB2 Query facility improves performance over DB2’s DSNTIAUL program by
allowing DB2 data to be passed directly into a SORT or COPY operation, without the use of
setup steps or the need for user-written E15 exits.
Restrictions
The following cannot be used with the DB2 Query facility. If specified, they will cause MFX
to terminate with a return code of 16:
• E15 exit
• MERGE
• The TYPE parameter and the l1 and l2 values of the LENGTH parameter of a RECORD
statement
To initiate a SORT or COPY with the DB2 Query facility using job control statements, spec-
ify PARM='DB2=dsn' on the EXEC statement. The dsn referred to in the DB2 parameter is
the DB2 subsystem name to be accessed. When a SORT or COPY DB2 Query application is
invoked from a program, specify the DB2 parameter in the $ORTPARM DD statement.
Note: In order to issue the first query to the DB2 subsystem identified in the DB2=parm,
you must have BINDADD authority so the SYNCSORT packages and plan can be added to
the subsystem. If you don’t want to use the default DB2 options to bind our SYNCSORT
packages and plan, you can manually do the binding by using DBRM members which are
included with your MFX installation files. Please contact Syncsort Mainframe Product Ser-
vices for additional instructions.
The following shows a sample EXEC statement with the DB2 PARM:
DD Statements
The DD statements used with the DB2 Query facility are summarized in the following
table. Note that the SORTDBIN DD statement is unique to the DB2 Query facility.
SORTDBIN DD Statement
The SORTDBIN DD statement is required for a DB2 query application. The data set
defined by the SORTDBIN contains the SQL SELECT statement that describes the criteria
of the query.
The SORTDBIN DD record format must be F or FB, and the record length must be 80.
The SORTDBIN data set must be formatted in accordance with the following rules:
• Only a SELECT statement or $ELECT statement (for trial run described below) is
accepted. Any other SQL statements will cause the job to terminate with a WER468A
error message. For details on the facilities and syntax of a SELECT statement refer to
the IBM publication DB2 Universal Database for z/OS SQL Reference (SC18-7426).
• The maximum supported length of a SELECT statement for this feature is 32765
characters.
• The SELECT statement may not use the '--' convention of two consecutive hyphens to
denote that the remainder of a card image is a comment.
• The SELECT statement may be terminated with a semicolon. Any characters found
after the semicolon will be considered comments.
PARM Options
The DB2 query support parameters described below may be specified on the EXEC state-
ment, in the $ORTPARM data set, in PARMTBLE or in a PARMEXIT. They may be listed
in any order.
DB2
DB2=dsn
This parameter is required in order to execute MFX’s DB2 Query facility. The dsn referred
to in the DB2 parameter is the DB2 subsystem name to be accessed.
MULTIFETCH
MULTIFETCH = n, 100
This parameter indicates the number of rows per multiple-row fetch. n can be any integer
from 1 to 1000. The default 100 rows per fetch will be used if MULTIFETCH is not speci-
fied. A higher number of rows per fetch may enhance DB2 query performance, but more
storage will be consumed. When the storage amount exceeds an internal value, MFX will
dynamically reduce the number of rows per fetch.
The multiple-row fetch feature can only be used for DB2 version 8 and above. It will be
ignored for prior DB2 versions.
Operation
Using the query provided in the SORTDBIN data set, MFX will access the DB2 database
specified in the DB2 EXEC PARM and will process as fixed-length records the rows
returned from the query. The records will be processed as if read from a SORTIN or
retrieved from an E15 exit. All MFX features available after E15 processing in the flow of
control can be used with a SORT or COPY application.
The record used within MFX is constructed from the fields in the query as follows:
• The data format of the fields within the record is the same format returned by DB2.
• Variable-length character data is stored in a fixed-length field. The field length is equal
to the maximum length of the field plus two bytes for a leading field length descriptor
variable. The field length descriptor contains a binary value describing the number of
bytes of data provided for this field. If an instance of the field is shorter than the
maximum, the remaining bytes will be set to binary zeros.
• Any fields defined to allow nulls will cause the creation of two fields within the record
constructed by MFX. The first will be the data field and the second will be a one byte
indicator field. If the value of the field is null, by default the field will be filled with
binary zeros (X'00') and the indicator field will contain a '?' to signify the field is null. If
the value of the field is not null, the indicator will be set to binary zeros. If binary zeros
would not be an appropriate fill value for a null field, use of SQL functions such as
VALUE or COALESCE on the SELECT statement should be considered. For instance, if
the field to be retrieved is packed decimal, it is usually best to create a null value of the
proper PD format. This ensures that if the field is used later as a sort key or in other
data conversion features, it would contain appropriate high or low values such as PD
zeros or nines as specified in the VALUE or COALESCE function.
Record Description
Information about the record created by the query will be displayed in the MFX message
data set. For each column selected, the report will display the start and end position within
the record, the DB2 data type, the equivalent MFX data type, and whether null values are
allowed. A data type whose length is not implied by the format will have a field length
appended to its description. Note that the length displayed for a VARCHAR DB2 data type
is two bytes shorter than would be indicated by the field start and end positions. The extra
two bytes described in the start and end positions are for the field length descriptor, which
is contained in the first two bytes of the field.
// EXEC PGM=SYNCSORT,PARM='DB2=DSN1'
//STEPLIB DD DSN=DB2.SDSNLOAD,DISP=SHR
// DD DSN=SORT.RESI.DENCE,DISP=SHR
//SYSOUT DD SYSOUT=A
//SORTDBIN DD *
$ELECT FIRSTNME,LASTNAME,WORKDEPT,HIREDATE,EDLEVEL,SALARY
FROM DSN.EMPTAB
WHERE EDLEVEL>10
/*
Note that only the SYSOUT and SORTDBIN DD are required for a trial mode execution.
An actual execution of the application will require other DDs as documented for SORT or
COPY applications.
The STEPLIB DD statement specifies where the MFX and DB2 products can be found. The
STEPLIB DD statement would be needed if these products could not be found in the stan-
dard system libraries.
The DB2 EXEC statement parameter would be set to the DB2 subsystem name to be
accessed.
The SYSOUT data set will contain an input record layout report as shown in the following
sample:
You would create MFX control statements with field specifications based on the input
record layout and place the control statements in the data set specified by the SYSIN DD
statement. You would then create a set of JCL statements for the application.
• The EXEC statement identifies SYNCSORT as the program to be executed. The DB2
PARM defines the DB2 subsystem to be accessed.
• The STEPLIB DD statement instructs the system as to where the MFX and DB2
products can be found.
• The SYSOUT DD statement assigns the MFX messages to the output device associated
with SYSOUT class A.
• The SORTOF1 DD statement gives OUT1 as the output data set name and specifies a
3390 disk. One cylinder of primary space has been allocated on this volume. The DISP
parameter shows that this data set is not yet in existence.
• The two SORTWK statements reserve space on four temporary data sets for inter-
mediate storage. Twenty cylinders are to be reserved on the data sets.
• The SYSIN DD statement marks the beginning of the input stream that includes the
sort control statements. A sort will be performed and a report will be generated. The
records read from the DB2 database under control of the query specified in the
SORTDBIN data set will be formatted and presented in this report. Fields will be
converted to printable format when necessary.
The SYSOUT will contain a report on the execution of the application. The report displays
the control statements followed by the query record layout and MFX messages with infor-
mation on the particular execution. The following is a sample report:
EMPLOYEE INFOMATION
MFX can process multiple VSAM and non-VSAM data sets for input through the MUL-
TIIN facility. This facility enhances the standard SORTIN specification which supports
only a single VSAM data set for input without any concatenation of VSAM or non-VSAM
data sets. The MULTIIN facility can be used for a SORT or COPY application.
MULTIIN may also be used in any multiple input file application where there is a need to
identify the data set from which a record was read. The &MULTIINDD subparameter of
the INCLUDE/OMIT control statements and the INREC control statement can be used for
this purpose. See “INCLUDE/OMIT Control Statement Format” on page 2.27 and “INREC
Control Statement Format” on page 2.51 for details.
If multiple files need to be processed as input, but there are no VSAM files and there is no
need for the &MULTIINDD feature, conventional SORTIN concatenation should be used.
This will improve the performance of the application.
Restrictions
The MULTIIN facility cannot be used in a MERGE or JOIN application. If specified, the
MFX application will terminate with a return code of 16.
EXEC Statement
DD Statements
The DD statements used with the MULTIIN facility are summarized in the following table.
Note that the MULTIIN DD statement is unique to the MULTIIN facility.
SORTMIn and SORTMInn data sets can be VSAM (entry-sequenced, key-sequenced or rel-
ative record) or non-VSAM data sets, including BatchPipes, z/OS pipes and HFS data sets.
DCB information need not be supplied for a disk or standard labeled tape file. Any of the
information accessed from a standard label can be overridden by coding the appropriate
DCB parameter in the JCL.
It is possible to sort or copy up to 100 data sets. Each input data set is specified on a
SORTMIn or SORTMInn DD statement. The valid range for n is 0 through 9; for nn, 00
through 99. If both SORTMIx and a SORTMI0x are specified, they are treated as dupli-
cates and only the first definition is processed. Numbers may be skipped or used out of
order. MFX will read the SORTMI files in numerical order. If EQUALS is in effect, the
order of equal-keyed records within each SORTMInn file will be preserved. In addition,
equal-keyed records from the lowest-numbered SORTMInn file will be written before
those from the second SORTMInn file, and so on.
If no SORTMInn or SORTMIn data sets are defined when the “MULTIIN” PARM is passed,
error message WER224A will be posted.
The maximum record lengths supported are 32,760 bytes for fixed-length records and
32,767 bytes for variable-length records.
By default MFX does not accept an uninitialized SORTMInn data set and will terminate
processing with a WER400A message. An uninitialized data set is one that has been newly
created but never successfully closed. The UNINTDS PARM or installation option can be
used to change MFX’s default mode of processing to accept an uninitialized input data set
and process it as an empty file. See “UNINTDS” on page 5.30.
The following shows sample JCL for multiple input data sets:
In the preceding example, SORTMI17 is a VSAM data set, SORTMI1 is a non-VSAM disk
data set and SORTMI14 is a non-VSAM tape data set.
Operation
If there are one or more non-VSAM SORTMInn input data sets, the non-VSAM input
RECFM will be used as the input RECFM for the application. All non-VSAM input files
must have the same record format. If the RECORD TYPE specification differs from the
SORTMInn RECFM DCB parameter for the non-VSAM input, the latter takes prece-
dence.
If all SORTMInn files are VSAM, then the TYPE parameter on the RECORD control state-
ment should be specified. If TYPE is not provided, the SORTOUT RECFM will be examined
to determine the input TYPE. If no SORTOUT RECFM is found and the input files are all
VSAM, TYPE=V will be assumed if the SORTOUT is VSAM and TYPE=F will be assumed
if SORTOUT is non-VSAM or there is no SORTOUT.
If the record TYPE determined above is variable, then the record length used will be the
largest of the provided files.
If the record TYPE is fixed and one or more SORTMInns are non-VSAM, then the record
length of the non-VSAM data sets will be used. Any VSAM file with a record shorter than
the non-VSAM record length will have those records padded with a X’00’. If there is a
VSAM data set with a record whose length is longer than the non-VSAM record length,
error message WER264A will be issued.
If the record TYPE is fixed and all SORTMInn data sets are VSAM, then the record length
will be the largest record length of all the VSAM data sets. Each record in a VSAM file
whose record length is not the largest one will have its records padded with X’00’s.
If VSAMEMT=YES is specified, any empty VSAM input data set will be processed as a
legitimate data set containing 0 records, and MFX will end with a return code of 0. The
delivered default, VSAMEMT=NO, instructs MFX to terminate with a WER254A critical
error if there is an empty VSAM input data set specified for input.
Figure 399. JCL and Required Control Statements for a Multiple Input Application
Introduction
The MFX Dictionary Feature allows you to create symbolic ‘dictionary_names’ for fields,
constants, or output columns, and use these dictionary_names in MFX control statements.
• Activate the Dictionary Feature using the SYMNAMES DD statement. This DD tells
MFX the name and location of the symbols dictionary to use. You can include multiple
dictionaries by concatenating data sets.
Each time MFX executes with the Dictionary Feature activated by the SYMNAMES DD, it
reads the dictionary statements from the symbols dictionary, and substitutes any
dictionary_name found in the following control statements with the associated field specifi-
cation or constant.
When a record layout changes, just modify the dictionary statements. The next sort execu-
tion will read in the updated dictionary statements and apply the new values during
dictionary_name substitutions.
Building A Dictionary
There are three types of dictionary statements:
• A statement with an asterisk (*) in the first column is a comment statement. MFX will
not process it, but it can be printed.
• A blank statement contains blanks in positions 1 through 80. MFX will not process it,
but it can be printed.
• A dictionary statement can start in any column from 1 through 80. However, a
dictionary statement can only occupy one line; a continuation to a second line is not
permissible.
• One or more blanks after the value indicate the beginning of a comment. Characters
following the blank(s) are not processed by MFX but can be printed.
• A semicolon (;) can be used instead of a comma (,) to separate the dictionary_name and
the value.
constant_name,constant
,p,l,f
,p,l
field_name comment
,p
,%pp
operator,value
• May be a combination of uppercase letters (A-Z), lowercase letters (a-z), numbers (0-9),
the number sign (#), the dollar sign ($), the commercial at sign (@), the underscore (_),
or the hyphen (-).
• May not have a number (0-9) or a hyphen (-) as the first character.
• Are case-sensitive; for example, 'Address', 'ADDRESS', and 'address' are treated as
different fields.
• Cannot be an MFX reserved word. The following table lists the MFX reserved words:
All MFX reserved words are in uppercase. Thus, mixed case and lowercase forms of MFX
reserved words are permissible as dictionary_names. Similarly, dictionary statement oper-
ators POSITION, SKIP and ALIGN are in uppercase; thus mixed and lowercase forms of
these words are permissible as dictionary_names. For example, ‘position’, ‘Skip’, and ‘align’
are all acceptable as dictionary_names.
The following sections describe the three types of dictionary statements in detail:
constant_name,constant comment
The value of a constant may be a character string, a decimal number, a hexadecimal string,
a bit string, a two-digit year date string, or a system symbol string.
The table starting on the next page describes the types of constant values.
Valid formats:
'xx...x'
C'xx...x'
nC'xx...x'
c'xx...x'
nc'xx...x'
Valid formats:
X'yy...yy'
nX’yy...yy’
x'yy...yy'
nx’yy...yy’
X'F1H5'
where yy represents any X'F1C5' (H is not a valid hexadecimal
Hexadecimal pair of hexadecimal digits digit)
x'3fb91e'
string and n is a repetition factor. X'06' x'cf2'
The maximum value for n
(unpaired hexadecimal digit 2)
is 4095. The maximum
length of the string is 32
pairs of hexadecimal dig-
its. Hexadecimal digit are
0-9, A-F, or a-f.
Valid formats:
B'bbbbbbbb...bbbbbbbb'
b'bbbbbbbb...bbbbbbbb'. b'0011'
(only 4 bits, 8 needed)
Each group of 8 bs repre- b'11110000'
sents the 8 bits that com- b''
Bit string B'11...0000'
pose one byte. Maximum (no bits specified)
b'01101111'
length is 8 groups of 8 bits B'00001112'
each. A bit is a 1, 0 or . (invalid bit value 2)
(period). Must be a multiple
of 8 bits.
Valid formats:
Y'LOW'
Y'HIGH'
Y'BLANKS'
Y'x...x' Y'1'
Y'DATE1' (fewer than 2 digits)
Y'DATE2'
Y'HIGH' Y' '
Y'DATE3'
Two-digit year Y'LOW' (blank is not a valid digit)
y'LOW'
date string y'HIGH' Y'980731' Y'1234567'
y'BLANKS' Y'012' (more than 6 digits)
y'x...x'
y'DATE1' Y'BLANK'
y'DATE2' (should be 'BLANKS')
y'DATE3'
Valid formats:
S'&xx...xx' S'&YYMMDD'
s'&xx...xx' s'&SYSNAME' S'&hhmmss'
System Symbol
where x...x represents the s'&JOBNAME' (not in uppercase)
system symbol all in upper- S'&SYSPLEX'
case.
System symbols are defined in IBM publication SA22-7592 z/OS MVS Initialization and
Tuning Reference. You can use dynamic system symbols, system-defined static system sym-
bols and installation-defined static system symbols in your symbol dictionary and MFX
control statements.
The string you specify as a symbol string can consist of a mixture of characters and all
three types of system symbols. You can also build strings using concatenation and sub-
strings. If you need to specify an apostrophe in the string, use two single apostrophes.
When system symbols are encountered in a symbol dictionary, they are converted to the
appropriate character string and then processed as any other symbol.
,p,l,f
,p,l
field_name comment
,p
,%pp
A field_name in a dictionary statement can be defined by its position in the record and its
length and format type (p,l,f). Length and format type are optional. A field_name can also
refer to a parsed field (%pp).
The rules for fields specified in a control statement always apply to a field specified as a
dictionary_name since internally MFX substitutes the actual field specification. For exam-
ple, if you specify a format, take care that the format of the field_name is acceptable on the
MFX control statement. For example, consider the dictionary_name CITY, defined by the
following dictionary statement:
CITY,10,29,CH
The following control statement specifying CITY would be valid because a CH field is per-
missible on the SORT control statement:
SORT FIELDS=(CITY,A)
However, the field_name CITY could not be used on a DUPKEYS AVG control statement
because CH is not a valid format with AVG.
Note that you can specify a field_name with p, l, and f, then use the field_name in a control
statement that only requires p and l. MFX will substitute p and l during processing and
ignore the f specification. For example, consider the following dictionary statements:
Account#,1,12,CH
CheckAmount,23,6,PD
SORT FIELDS=(Account#,A)
DUPKEYS SUM=(CheckAmount),FORMAT=PD
Based on the field_names defined in the dictionary statements, MFX will make the follow-
ing substitutions:
SORT FIELDS=(1,12,CH,A)
DUPKEYS SUM=(23,6),FORMAT=PD
For more information on format substitution, refer to the “Using Dictionary_names in MFX
Control Statements” section starting on page 13.19.
The following three subsections describe the rules for specifying position (p), length (l) and
format (f) in field_name dictionary statements.
Following are the rules for specifying position (p) in field_name dictionary statements:
• p can be a number from 1 through 32752 whenever p,l or p,l and f are used. However, if
position (p) is used alone (for example, CITY,20), p can not be more than 31 significant
digits. Note that any value of p greater than 32752 may cause a syntax error when it is
processed as a position.
• p can be in the form of m.n for specifying a bit position, where m is a number from 1
through 32752 and n is a number from 0 through 7. Note that m.0 is equivalent to m.
• p can be an asterisk (*), which indicates that the next position should be assigned to p.
Since l represents length, the next position is set to p + l each time the field_name for
p,l,f or p,l is encountered. If the next position has not yet been determined, as when the
asterisk is used in the first field_name, then p defaults to one.
When p is an asterisk (*) and there is no length specified, you can also specify + or – n,
where n is a number from 1 through 32752.
• p can be an equal sign (=) which indicates that the previous position should be assigned
to p. If the previous position has not yet been determined, an error message will be
generated.
When p is an equal sign (=) and there is no length specified, you can also specify + or –
n, where n is a number from 1 through 32752.
Note that use of = for p can result in incorrect position values if fields are inserted at
some later date.
The value of the next position and the previous position can also be modified by a POSI-
TION operator statement. See “Using POSITION in Operator Statements” on page 13.14.
The dictionary table, which can be printed on request (see the SYMNOUT DD statement on
page 13.23 ), displays the actual positions assigned to p when the asterisk or equal sign is
used for p. For example, consider the following dictionary statements:
Payment_type,40,1,BI
@cash$,B’......00’
@check,B’......01’
@credt,B’......1.’
Teller,*,20,CH
Check#,=,4,ZD
CCard#,=,12,ZD
Payment_type,40,1,BI
@cash$,B’......00’
@check,B’......01’
@credt,B’......1.’
Teller,41,20,CH
Check#,41,4,ZD
CCard#,41,12,ZD
field_name1,1,10,CH
.
.
.
.
field_namen,*,10,CH
rec_len,*-1
You would then use rec_len in the RECORD control statement, as follows:
RECORD TYPE=F,LENGTH=rec_len
Following are the rules for specifying length (l) in field_name dictionary statements:
• l can be in the form of m.n for specifying a bit length, where m is a number from 0
through 32752 and n is a number from 0 through 7. Note that m and n cannot both be
zero.
• l can be an equal sign (=), which assigns the previous length to l. If the previous length
has not yet been determined when = is read, MFX will generate an error message.
Note that use of = for l can result in incorrect length values if fields are inserted at
some later date.
If the dictionary table is printed, it will display the actual lengths that were assigned when
= was specified for l. For example, consider the following dictionary statements:
Student_name,1,40,CH
Test_score_1,*,4,ZD
Test_score_2,*,=,ZD
Test_score_3,*,=,ZD
Student_name,1,40,CH
Test_score_1,41,4,ZD
Test_score_2,45,4,ZD
Test_score_3,49,4,ZD
Following are the rules for specifying format (f) in field_name dictionary statements:
AC, AQ, ASL, AST, BI, CH, CLO, CSF, CSL, CST, CTO, D1, D2, DC1, DC2, DC3, DE1,
DE2, DE3, DT1, DT2, DT3, FI, FL, FS, LS, OL, OT, PD, PD0, SFF, SS, TC1, TC2, TC3,
TC4, TE1, TE2, TE3, TE4, TM1, TM2, TM3, TM4, TS, UFF, Y2B, Y2C, Y2D, Y2DP, Y2P,
Y2PP, Y2S, Y2T, Y2TP, Y2U, Y2UP, Y2V, Y2VP, Y2W, Y2WP, Y2X, Y2XP, Y2Y, Y2YP,
Y2Z, ZD
When either p or l is specified in the bit form (m.n) and the bit number is not zero
n 0 , then the only valid format is BI.
• f can be an equal sign (=) which indicates that the previous format should be assigned
to f. If the previous format has not yet been determined when an = sign is used for f,
MFX generates an error message.
Note that use of = for f can result in incorrect format values if fields are inserted at
some later date.
If the dictionary table is printed, it will display the actual formats MFX substituted for =.
For example, consider the following dictionary statements:
Student_name,1,40,CH
Test_score_1,*,4,ZD
Test_score_2,*,=,=
Test_score_3,*,=,=
Student_name,1,40,CH
Test_score_1,41,4,ZD
Test_score_2,45,4,ZD
Test_score_3,49,4,ZD
Following are the rules for specifying a parsed field (%pp) in field_name dictionary state-
ments:
In the example below, four parsed fields are defined in the symbol dictionary.
Stock_symbol,%1
Current_price,%2
Sign_of_change,%3
Change_amount,%4
INREC PARSE=(Stock_symbol=(ENDBEFR=C’,’,FIXLEN=4),
Current_price=(ENDBEFR=C’,’,FIXLEN=6),
Sign_of_change=(FIXLEN=1),
Change_amount=(ENDBEFR=C’,’,FIXLEN=5),
BUILD=(01:Stock_symbol,
07:Current_price,JFY=(SHIFT=RIGHT),
15:Sign_of_change,
16:Change_amount,JFY=(SHIFT=RIGHT))
INREC PARSE=(%01=(ENDBEFR=C’,’,FIXLEN=4),
%02=(ENDBEFR=C’,’,FIXLEN=6),
%03=(FIXLEN=1),
%04=(ENDBEFR=C’,’,FIXLEN=5),
BUILD=(01:%01,
07:%02,JFY=(SHIFT=RIGHT),
15:%03,
16:%04,JFY=(SHIFT=RIGHT))
Syntax rules for the operator statement are the same as for the other types of dictionary
statements. In addition, the operator must be specified in all uppercase letters.
,r
POSITION
,fieldname
SKIP,n
comment
,B
,D
ALIGN
,F
,H
• r sets the next position and the previous position to a value. The next position is used
when an asterisk (*) replaces p in a field_name statement. The previous position is
used when an equal sign (=) replaces p in a field_name statement. Following a
POSITION,r statement, either an asterisk (*) or an equal sign (=) can be used for
position (p) in the next field_name statement.
POSITION,45
Volser,*,8,CH
Volser,45,8,CH
• field_name sets the next position and the previous position to the position of the
specified field name. The next position is used when an asterisk (*) replaces p in a
field_name statement. The previous position is used when an equal sign (=) replaces p
in a field_name statement. Following a POSITION,field_name statement, either an * or
an = can be used for p in the next field_name statement.
The field_name used with the POSITION operator can be any previously defined
field_name. As a result, POSITION,field_name allows you to map different fields over
the same locations.
Filename,1,8,CH
Filetype,*,8,CH
Filemode,*,2,CH
POSITION,Filename
Filespec,*,18,=
Filename,1,8,CH
Filetype,9,8,CH
Filemode,17,2,CH
Filespec,1,18,CH
• n can be in the form of u.v for specifying a bit length, where u is a number from 0
through 32752 and v is a number from 0 through 7. Note that u and v cannot both be
zero.
SKIP,n increases the next position by n bytes. The next position is used when an aster-
isk (*) replaces p in a field_name statement.
Make,1,10,CH
SKIP,4
pp1,= (Last position not changed by SKIP)
Model,*,10,CH
Make,1,10,CH
pp1,1
Model,15,10,CH
• B aligns the next position on a byte boundary, for example 1, 2, 3,... The next position is
used when an asterisk (*) replaces p in a field_name statement. Uppercase (B) and
lowercase (b) are both permissible.
ZD1_zone,5.0,0.4,BI
ALIGN,B
Ten_bits,*,1.2,BI
ALIGN,B
nxt_byte,*,2,CH
ZD1_zone,5,0.4,BI
Ten_bits,6,1.2,BI
nxt_byte,8,2,CH
• D aligns the next position on a doubleword boundary, for example 1, 9, 17,... The next
position is used when an asterisk (*) replaces p in a field definition statement.
Uppercase (D) and lowercase (d) are both permissible.
Account#,42,8,CH
ALIGN,D
Balance,*,8,CSL
Account#,42,8,CH
Balance,57,8,CSL
• F aligns the next position on a fullword boundary, for example 1, 5, 9,... The next
position is used when an asterisk (*) replaces p in a field_name statement. Uppercase
(F) and lowercase (f) are both acceptable.
DIVISION,34,3,FI
ALIGN,F (already aligned)
DEPT_1,*,3,FI
ALIGN,F
DEPT_2,*,3,FI
DIVISION,34,3,FI
DEPT_1,37,3,FI
DEPT_2,41,3,FI
• H aligns the next position on a halfword boundary, for example 1, 3, 5,…The next
position is used when an asterisk (*) replaces p in a field_name statement. Uppercase
(H) and lowercase (h) are both permissible.
box_1,1,1,BI
ALIGN,H
box_2,*,1,BI
ALIGN,H (Last position not changed by ALIGN)
sel_2,=,1,BI
box_1,1,1,BI
box_2,3,1,BI
sel_2,3,1,BI
The dictionary statements can be contained in a physical sequential data set, a member of
a PDS, or DD *. Each data set must consist of fixed-length, 80-byte records.
You may specify multiple dictionaries by concatenating data sets with the SYMNAMES
DD.
INCLUDE
INREC
JOINKEYS
OMIT
OUTFIL
OUTREC
You can use a constant_name wherever you would specify a constant (X'nn...',
B'bbbb,...',C'ccc...', Y'xx...'), that is:
Note that you cannot use a dictionary_name for any of the following:
• EDIT parameter
• DATE parameter
DUPKEYS
INCLUDE
INREC
JOINKEYS
MERGE
OMIT
OUTFIL
OUTREC
RECORD
REFORMAT
SORT
SUM
You can use a field_name wherever you would specify a position, length, and format (p,l,f or
p,l or p), a parsed field (%pp) or an output column.
When substituting field_names in control statements, MFX checks the context in which
each field_name appears and determines which field specification is appropriate: p,l,f or
only p,l. A field_name substitution results in position and length (p,l) under the following
conditions:
• A format is explicitly specified for the field; that is, the field_name is followed by a
format specification.
If records are reformatted, (for example by using INREC, OUTREC or an E15 or E35 exit),
resulting in different field positions, you will need to use field_names that correspond to the
new field positions in subsequent control statements. For example, consider the following
dictionary statements:
Customer_Name,1,20,CH
Customer_Address,*,20,CH
Customer_City,*,20,CH
Customer_Zip,*,9,ZD
Customer_Acct_Bal,*,12,ZD
INREC FIELDS=(Customer_Name,Customer_Zip,Customer_Acct_Bal)
New_Customer_Name,1,20,CH
New_Customer_Zip,*,9,ZD
New_Customer_Acct_Bal,*,12,ZD
If the repositioned fields are given unique names, as shown above, you can concatenate the
old and new dictionaries and use both the old and new dictionary_names, as follows:
INREC FIELDS=(Customer_Name,Customer_Zip,Customer_Acct_Bal)
SORT FIELDS=(New_Customer_Acct_Bal,A,New_Customer_Name,A)
There is a TO= subparameter available on the INREC, OUTREC and OUTFIL control
statements. With OUTFIL, it can be specified in the OUTREC, HEADER and TRAILER
parameters. The TO= subparameter can be specified wherever there is an fo parameter
which is used to define the output numeric data format of an expression. For example,
OUTREC FIELDS=(1,8,BI,TO=ZD)
In general, there is no reason to include the ‘TO=’ because the meaning is the same. How-
ever, with field_name substitution, there can be different outcomes depending on whether
or not ‘TO=’ is used. For instance, if a field_name were defined as:
FIELD1,1,8,BI
OUTREC FIELDS=(FIELD1,ZD)
MFX would assume the ZD should replace the BI in the context of the OUTREC statement,
resulting in the following substitution:
OUTREC FIELDS=(1,8,ZD)
OUTREC FIELDS=(FIELD1,TO=ZD)
OUTREC FIELDS=(1,8,BI,TO=ZD)
To ensure that there are no ambiguities with the use of data dictionary_names and certain
types of data conversions, you should use the TO= syntax when necessary. Since the PDC,
PDF, ZDC and ZDF formats can only be specified as output formats, there is no ambiguity
and the ‘TO=’ form is not required.
• The second part is the dictionary table generated by MFX from the dictionary
statements.
The DCB attributes for the SYMNOUT data set are: RECFM=FBA and LRECL=121.
Once an error has been detected, positions calculated with the use of an asterisk (*) for p or
with the POSITION operator in subsequent dictionary statements will not be validated. If
an error is detected in any dictionary statement, MFX will terminate processing after all
dictionary statements are read.
If MFX detects an error in a control statement while substitution is taking place, it may
respond in either of the following ways:
• Print the statement that was in error, followed by a corresponding error message, then
continue with the next statement and terminate when all substitutions have been
completed.
• Stop the substitution for the statement in error and continue processing, letting
subsequent processing handle the error. If this occurs, the original field or constant_
name rather than the substituted value may be displayed in a translated statement.
If there are no errors during the substitution process, MFX will substitute values for
field_names and constant_names wherever they are valid. If substituted values prove
invalid for a particular statement or parameter, this situation will be detected after the
substitution has been performed.
Order#,10,8,CH
Catlog#,18,6,CH
Color,24,1,CH
Grey,C’G’
Red,C’R’
red,C’r’
Black,C’B’
White,C’W’
Qty,25,3,ZD
Price,28,4,PD
This example uses leading blanks before some color dictionary_names to create indentation
for clarity.
A blank statement is used before and after the "color" section. Such blank statements are
ignored but can be printed.
Dictionary_names are case-sensitive. Thus, Red and red are separate dictionary_names.
Example 2
Street,38,45,CH
City,*,26,CH City is “83,26,CH”
State,*,2,CH State is “109,2,CH”
Zip,*,9,ZD Zip is “111,9,ZD”
In this example, note how position (p) is replaced with an asterisk (*) to indicate that the
value of p should be the next position after the previous field. This is a powerful feature.
Using an asterisk (*) for position allows you to define adjoining fields automatically. Thus,
if a field specification changes, it is not necessary to calculate and specify the changed posi-
tions of subsequent fields.
Example 3
Name,5,40,CH
SKIP,20
Phone#,*,11,CH Phone# is “65,11,CH”
Example 4
In this example, an equal sign (=) is used instead of p, l or f. The equal sign assigns the pre-
vious position, length or format to the equal sign, mapping one field onto another.
Although field_names and constant_names can usually be specified in any order, using the
asterisk (*) or equal sign (=) forces a dependency on field order.
Note the use of comments in the above examples. As for MFX control statements, a blank
after the value indicates the beginning of a comment. You can also use comment state-
ments, which begin with an asterisk (*) in column 1.
Example 5
//SYMNAMES DD DSN=PARTS.LAYOUT,DISP=SHR
// DD DSN=MFC.LAYOUT,DISP=SHR
// DD DSN=STOCK.LAYOUT,DISP=SHR
Part#,1,8,CH
Desc$,*,20,CH
Mfc_code,*,6,CH
Mfc_part#,*,10,CH
Stock_Shelf#,*,4,BI
Stock_Bin#,*,4,BI
Stock_Qty,*,4,PD
Part#,1,8,CH
Desc$,9,20,CH
Mfc_code,29,6,CH
Mfc_part#,35,10,CH
Stock_Shelf#,45,4,BI
Stock_Bin#,49,4,BI
Stock_Qty,53,4,PD
Field_names from all three dictionaries in the above example could be used in MFX control
statements as follows:
OUTFIL FNAME=ORDER,INCLUDE=(Stock_Qty,LT,100),
OUTREC=(Part#,10X,Mfc_code,5X,Mfc_part#)
OUTFIL FNAME=INTEL,INCLUDE=(Mfc_code,EQ,C’INTEL’),
OUTREC=(Part#,10X,Stock_Shelf#,LENGTH=6,
8X,Stock_Bin#,LENGTH=6,
8X,Stock_Qty,LENGTH=8)
This example demonstrates some circumstances where format specifications are used and
are not used in control statements.
In your symbols dictionary you can specify a field_name with p, l, and f, then use the
field_name in a control statement that only requires p and l. MFX will substitute p and l
during processing and ignore the f specification under certain circumstances. For example,
consider the following dictionary statements:
Account#,1,12,CH
CheckNumber,13,4,ZD
CheckDate,17,6,Y2T
CheckAmount,23,6,PD
SORT FIELDS=(Account#,A,CheckDate,A)
DUPKEYS SUM=(CheckAmount),FORMAT=PD
OUTFIL OUTREC=(Account#,CheckDate,CheckAmount,M23)
Based on the field_names defined in the dictionary statements, MFX will make the follow-
ing substitutions:
SORT FIELDS=(1,12,CH,A,17,6,Y2T,A)
DUPKEYS SUM=(23,6),FORMAT=PD
OUTFIL OUTREC=(1,12,17,6,Y2T,23,6,PD,M23)
• SET or PROC symbols from the JCL. These are prefaced by an ampersand: &symbol
• Any characters except quotes; characters after a symbol name may be appended with a
period: &symbol.text
JPn dictionary_names are listed in the optional SYMNAMES DD output data set before
any other dictionary_names that have been defined in the SYMNAMES DD data set. They
will be built as
JPn,S'string'
Select data for only certain states where the list of states will vary:
// SET STATE1='NY'
// SET STATE2='NJ'
// SET STATE3='PA'
// SET STATE4='CT'
// SET STATE5=' '
// SET STATE6=' '
// SET STATE7=' '
// SET STATE8=' '
//SELECT1 EXEC PGM=SORT,
// PARM=('JP1"&STATE1",JP2"&STATE2",JP3"&STATE3",JP4"&STATE4"',
// 'JP5"&STATE5",JP6"&STATE6",JP7"&STATE7",JP8"&STATE8"')
//SYSOUT DD SYSOUT=*
//SYMNOUT DD SYSOUT=*
//SORTIN DD *
TALLAHASSEE FL
TRENTON NJ
TOPEKA KS
HARTFORD CT
SACRAMENTO CA
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(15,2,CH,EQ,L(JP1,JP2,JP3,JP4,JP5,JP6,JP7,JP8))
SORT FIELDS=(1,16,CH,A)
The output is
HARTFORD CT
TRENTON NJ
Select data for the current month using system symbols for MM and YYYY:
Assuming this JCL was executed in July 2013, after data dictionary symbol substitution
the INCLUDE statement becomes
INCLUDE COND=(1,6,CH,EQ,C'072013')
072013
Produce a report for one particular month, which is selectable from the EXEC statement
for a PROC:
MAXSORT, MFX’s maximum capacity sorting technique, is not limited by disk space avail-
ability. MAXSORT determines how much data can be sorted using the available disk work
space and divides SORTIN into SORTWK-manageable segments; the sorted segments are
stored on tape or disk for a later, automatic merge. MAXSORT makes all the Disk Sort
operational optimizing features and modern programming options available to large sorts,
and additionally provides an enhanced breakpoint/restart capability for greater scheduling
flexibility--the user can stop MAXSORT processing at selected intervals without loss of
sorted output.
PARASORT improves elapsed time performance for sorts whose input is read from a multi-
volume tape data set and/or concatenated tape data sets. The performance improvement
from PARASORT is a result of processing the SORTIN input volumes in a parallel fashion.
PARASORT requires two to eight times the current number of tape units, depending upon
resource availability and the degree of improvement desired. PARASORT automatically
manages the tape units and minimizes the use of the tape drive resources by deallocating
excess tape drives during initialization and releasing all the extra units at the end of the
sort input phase.
From the point of view of performance, the JCL-initiated sort execution has the advantage.
Whenever possible, tasks incidental to the sort/merge/copy process should be handled via
MFX control statements. Where this is not possible, the JCL/control stream should be sup-
plemented with user-written exit routines. Ideally, the exit routines exist as load modules,
so that they do not require link-editing every time the job is run. MFX permits exit routines
to be written in COBOL, C, FORTRAN, REXX, or Assembler language.
If you must invoke the sort from a COBOL program, you may improve sort performance by
passing an accurate FILSZ=n/En parameter via $ORTPARM.
The CMP PARM specifies the kind of compare operation to be used for sort/merge control
fields up to 16 bytes long, bearing the format code PD or ZD. When CMP=CPD, the default,
is used, ZD fields are PACK’ed and then compared. Invalid PD data may cause a system
0C7 abend and program termination. The integrity of fields labelled “ZD” is only guaran-
The alternative, CMP=CLC, is a more costly option--it forces the sort to extract potentially
invalid PD and ZD fields and do a certain amount of data manipulation to obtain valid sign
comparisons.
The EQUALS PARM instructs the sort/merge to preserve the order of equal-keyed records.
EQUALS will have a slight but generally significant impact on sort performance. By mak-
ing EQUALS available on an individual sort basis, MFX makes this programming option
available where it is needed, without imposing it on the installation’s more routine jobs. For
sort efficiency, use EQUALS only where the preservation of the input order of equal-keyed
records is important.
The user interested in sort performance will specify the STOPAFT PARM in test runs of the
sort. With STOPAFT=n, only the first n records of the input file will be sorted. By reducing
the number of records to be processed, STOPAFT improves sort performance. If additional
tests are necessary, the SKIPREC PARM can be used together with STOPAFT to select a
different subset of the SORTIN data set.
Setting CORE
The following examples illustrate the most common types of alternative codings for the
CORE PARM:
CORE=MAX-30K
CORE=500K
CORE=MAX
In the first case, where for example, a COBOL program calls MFX via the SORT verb, the
sort and the invoking program (including its Input Procedure and Output Procedure) are
all in memory at the same time. The only dynamic aspect to memory management in this
case is the acquisition of memory for the buffers of any files opened by the Input and Out-
put Procedures; it is only when a file is opened that the memory for the file’s buffers is
obtained. Therefore, all data sets required during the sort should, if possible, be opened
before invoking the sort.
The coding of the CORE parameter must make allowances for the Input and Output Proce-
dures’ file buffers by reserving enough memory for the greater of the two procedures’
requirements. If, for example, the Input Procedure’s files require 50K and the Output Pro-
cedure’s files require 100K, MFX should be instructed to set aside 100K for their use; code
CORE=MAX-100K. If CORE=MAX is coded, it is likely that no memory will be available for
buffers when the Input or Output Procedure attempts to open a file, resulting in an
ABEND80A message. If CORE is coded with a constant value such as CORE=756K, there
is still the possibility of an ABEND80A message since the constant value requested (in this
case, 756K) may account for all the memory available, again leaving no memory for the
buffers.
With CORE=MAX-100K, the precise amount of memory used by the sort depends both on
the amount of memory that is available and on the maximum value set at sort installation
time (the site maximum). Since this form of the parameter ensures that 100K of the total
memory available to this job will be set aside for the buffers, CORE=MAX-100K will not
produce an ABEND80A message. Note that MAX-value must be greater than the minimum
memory requirement for MFX execution.
The table below illustrates the relationship between the site maximum and the available
memory for an invoked sort requiring 100K bytes worth of buffers for the Input and Output
Procedures. In reviewing the table, note that the site maximum sets an absolute ceiling on
the amount of memory that can be used by the sort; even if additional memory is available,
it is not available to the sort. This additional memory would, however, be available to the
Input or Output Procedure for file buffers, accounting for some of the normal sort termina-
tions indicated. Since the programmer has no way of knowing whether these conditions will
hold at execution time, CORE=MAX-100K remains the preferred method of setting memory
for an invoked sort with 100K bytes worth of buffers.
The COBOL programmer has the option of setting CORE by means of the SORT-CORE-
SIZE special register. In order to set memory aside for the buffers, the invoking program
places a negative value into the special register prior to sort execution; CORE=MAX-100K
is equivalent to MOVE-102400 TO SORT-CORE-SIZE. Under VS COBOL II or COBOL/
370, CORE can be set by submitting the CORE=MAX-nK PARM via the $ORTPARM data
set.
Table 65. Illustration: CORE Alternatives for Invoked Sort with 100K Buffer Space
When exits are included, the optimal coding of the CORE parameter depends on the mem-
ory value in the MODS control statement. As in the case of the COBOL Input/Output Pro-
cedure, coding CORE=MAX-100K will set aside 100K bytes for buffers. If the MODS
statement’s memory value included sufficient buffer space, code CORE=MAX; coding any-
thing but CORE=MAX nullifies the MODS memory value(s). Again, the site maximum pre-
vents the sort from appropriating too much memory. When the exit program is not
referenced in a MODS statement (e.g., when an E15/E35 exit routine is coded in line with
an invoking Assembler program) or the MODS memory value accounts only for the pro-
gram’s code, memory must be reserved for the buffers of any files to be opened. An Assem-
bler program’s in-line E15/E35 exit routine is equivalent to a COBOL Input/Output
Procedure.
In JCL sorts without exit routines, it is not necessary to code any CORE parameter. MFX
will use as much of the site maximum as is available at the time of execution. Thus, if the
site maximum is set to 1024K and 2048K bytes are available, MFX will use 1024K.
The incore sort is not available to Disk Sorts taking checkpoints, using SUM, DUPKEYS,
OUTREC, OUTFIL, an E14 or E16 exit routine, or producing VSAM output.
An Incore Sort is possible when all of the data that is to be sorted can be contained in main
storage. For most simple applications:
Note: SORTWK data sets are required in order to use SUM, DUPKEYS, OUTREC,
OUTFIL, a VSAM SORTOUT data set, checkpoint/restart, an E14 or E16 exit routine,
MAXSORT or PARASORT.
With the operational feature RELEASE turned ON (this is the delivered default), MFX
automatically supplements and releases any disk space the user allocates for intermediate
storage, making the allocation of the correct amount of SORTWK space an automatic, sort-
controlled process. For general sorting purposes, the user need not be concerned with pre-
cise SORTWK space allocations. However, allocating SORTWK space in cylinders, rather
than blocks or tracks, will usually yield optimal performance.
For best performance with filesizes greater than 30 megabytes, especially when
DYNALLOC is not enabled, allocate the required space across 4 to 6 SORTWK devices.
Message WER124I is provided in some applications in order to permit the user who is
interested in a finely tuned sort execution to improve intermediate storage allocation for
future runs. Routinely overallocating SORTWK, relying on RELEASE=ON, will delay sort
step execution until all the space requested (including the excess space) is available, and
will waste this excess space until its released at the end of Phase 1. Routinely underallocat-
ing by a large amount assumes that the needed storage will always be physically available.
If, for some reason, the required storage cannot be obtained on any volume assigned for sort
work areas, MFX will terminate with a SORT CAPACITY EXCEEDED error.
MFX’s work data set disk space management is automated to a very high degree. It can:
• Automatically release excess disk space at the completion of Phase 1. The space
immediately becomes available for allocations to other jobs.
• Dynamically allocate work data sets through the z/OS DYNALLOC capability.
You can improve the efficiency of disk space usage by allocating optimally at the outset.
where:
A = Number of records to be sorted.
B = Average record length of data being sorted.
C = Track capacity of the work device:
Allocating disk storage space in cylinders rather than tracks will improve the performance
of MFX. When converting tracks to cylinders, round the number of cylinders up to the
higher number. For example, if 9.5 cylinders are needed, allocate 10 cylinders.
MFX implements the automatic space management facility by reading the JFCB and modi-
fying the SPACE parameter to enter a secondary allocation quantity (or accept one that
was coded) and the RLSE subparameter. The JFCB is the z/OS control block that repre-
sents the DD statement.
Several MFX options may be implemented which affect the disk space management of the
sort. (See the Default Options chapter of the Installation Guide.) Specific functions of these
features are as follows.
4. The use of space release is suppressed for small sorts, including the incore sort, in order
to minimize system overhead. For non-incore sorts, if the file size is less than 4
megabytes, space release is normally suppressed. The 4 megabyte threshold may be
altered.
5. The use of space release is normally suppressed for all invoked sorts to prevent SORT
CAPACITY EXCEEDED termination when MFX is invoked more than once by a single
program. If the first sort involves a modest volume of data, and causes space release to
make the work data sets smaller, and the second sort is larger, the second sort might
not find sufficient work space. Your installation can turn on space release for invoked
sorts and thus save disk space. This very rarely causes problems because (1) few
programs invoke the sort more than once and (2) MFX’s automatic secondary allocation
normally prevents a SORT CAPACITY EXCEEDED termination.
1. Automatic release is suppressed for permanent data sets unless additional sort work
space has been allocated.
MFX uses normal z/OS facilities to obtain secondary allocations on work data sets. Conse-
quently, the sort, like any other program under z/OS, is restricted to sixteen extents per
data set. MFX, however, will recover from system B37 ABENDS that other programs might
encounter in attempting secondary allocations. If MFX determines that a particular sort
work data set cannot sustain a secondary allocation because it already has sixteen extents
or because there is not enough space left on the volume, it does not attempt secondary allo-
cation on that data set. MFX further checks all other work data sets, and if none of them
can sustain a secondary allocation, it must abort with SORT CAPACITY EXCEEDED.
MFX often avoids the use of one or more work data sets to minimize overall system conflict,
as, for instance, between SORTIN and a work data set. It may obtain secondary allocation
on some data sets while releasing on others.
To instruct MFX to take checkpoints, code CKPT or CHKPT (either spelling) on the SORT/
MERGE control statement and supply a SORTCKPT DD statement.
For a sort, checkpoints are taken at the beginning of Phase 3 before the output data sets (if
any) are opened, and at every end-of-volume of a SORTOUT data set when OUTFIL is not
in use. An operator may then restart the sort at Phase 3 or at any end-of-volume check-
point. If necessary, a new output volume or device with identical characteristics to the
defective volume or device may be substituted.
For a merge or copy, MFX takes a checkpoint at every end-of-volume of a SORTOUT data
set when OUTFIL is not in use.
The DISP Parameter for SORTCKPT, SORTWKxx and SORTOUT Data Sets
The coding of the DISP parameter for these data sets depends in part on the PARM-speci-
fied response to an unsuccessful sort. There are four cases:
When return code 16 is issued by the unsuccessful sort (i.e., when an I/O error occurs and
NOIOERR is set or, for other errors, when NORC16 is set), the second subparameter of the
DISP parameter should be specified as KEEP or CATLG. When the unsuccessful sort
causes a user abend (i.e., when IOERR=ABE for I/O errors, RC16=ABE for other errors),
the third subparameter of the DISP parameter should be specified as KEEP or CATLG.
Thus, with NOIOERR and RC16=ABE or with IOERR=ABE and NORC16, both the second
and the third DISP subparameter should be specified as KEEP or CATLG. Unless the DISP
parameter is coded in accordance with these two PARM values, restart will be impossible.
It is recommended that these data sets be deleted upon successful completion of the sort.
This can be done by coding the COND parameter for an IEFBR14 step to follow the sort
step in the jobstream. The COND parameter makes the IEFBR14 (data set deletion) execu-
tion depend upon the successful completion of the previous step (the sort).
Assign a permanent DSN to the SORTCKPT DD statement and specify the UNIT, SPACE
and VOL=SER parameters to make the operator’s job easier should a deferred restart
become necessary.
//SORTCKPT DD UNIT=3390,DSN=SORT.CKPT,
// SPACE=(CYL,(1,1)),
// VOL=SER=WORK01,DISP=(MOD,KEEP,KEEP)
Assign a permanent DSN to every SORTWKxx DD statement and specify the UNIT,
SPACE and VOL=SER parameters in case a deferred restart becomes necessary. Avoid
using passed data sets, JCL refer-backs, and any other references which would make the
JCL following the restart dependent on the JCL preceding the restart.
Note that the SORTCKPT data set and the SORTWKxx data set(s) may reside on the same
direct access device without loss of efficiency.
//SORTWK01 DD UNIT=3390,DSN=SORT.WK01,
// SPACE=(CYL,(20,10)),
// VOL=SER=WORK02,DISP=(,KEEP,KEEP)
Automatic Checkpoint-Restart
With automatic checkpoint-restart, the operating system will ask the operator whether an
unsuccessful/abending step should be restarted. A “yes” reply instructs the system to
restart the job at the last checkpoint taken. If the operator replies “no,” the job will still be
eligible for deferred checkpoint-restart, but its control statements will have to be modified
before the job is resubmitted.
• All system completion codes with which the sort may abend should be defined at
system generation time as being eligible for restart. If the RC16=ABE and/or
• User-written exit routines and calling programs may not issue the STIMER macro.
Deferred Checkpoint-Restart
Unlike automatic checkpoint-restart, deferred checkpoint-restart requires that certain JCL
changes be made before resubmitting the job.
• A SYSCHK DD statement must appear immediately before the first EXEC statement
in the job. The SYSCHK DD must use the same DSN name as the SORTCKPT DD of
the sort that failed. Specify UNIT, VOL=SER, and DISP=(OLD,KEEP).
• The RESTART parameter must be specified, and must provide the job stepname and
the PROC stepname (if any) associated with the step containing the failed sort, as the
first subparameter. (Separate the two stepnames by a period.) The second
subparameter should contain the checkpoint ID of the last checkpoint taken before the
sort failed. This can be determined from the console messages given for the job. For JCL
sorts, the ID is usually "Cnnnnnnn," referring to the sequence number assigned by the
operating system.
The performance of MFX is almost totally independent of the number of work data sets.
The sort’s performance may, however, be strongly influenced by the number of devices to
which the work data sets are allocated. Generally, for any sort of significant size, the more
work devices, the better the sort can perform. If the sort file size is small, however, perfor-
mance improvements might be outweighed by increased overhead in managing the extra
data sets. Increasing the number of work devices will:
In all cases, allocate one work data set per work device.
The easiest way to increase the number of work devices is to increase the number of work
data sets. This tends to increase the number of devices to which work data sets allocate,
although the relationship between the two may be complex and unpredictable.
Try to ensure that every sort has at least one work data set on a pack that does not contain
SORTIN or SORTOUT. MFX will avoid work data set contention with SORTIN and
SORTOUT if it can.
Channel Separation
Try to obtain as many paths to the work devices as possible. It is particularly desirable to
provide some path to the work data sets that will not be jammed with traffic from SORTIN
or SORTOUT.
On the other hand, SORTIN and SORTOUT may be on the same channel, or even the same
device, without any performance loss.
Avoid using a mixture of device types with different track capacities for the work data sets,
since MFX sacrifices some efficiency if this is the case.
If you must choose between two different disk device types for the work data sets, use the
faster; if they are close in speed, use the one with the larger track size.
Avoid the use of VIO data sets for work data sets.
If you must use tape work data sets, allocate as many as possible.
What Is HISTOGRM?
HISTOGRM is a separate program which is used to gain information about variable-length
files. The program scans a variable-length file and provides information which can then be
used to run more efficient sorts. HISTOGRM can report the:
NRECS
ALL
NRECS=
nnn
WIDTH
20
WIDTH=
nnnn
Indicates the range between minimum and maximum block lengths and the minimum and
maximum record lengths in each group of the HISTOGRM output. The number specified
for the WIDTH value must be a multiple of 4. (4, 8, 12, . . . See examples of block and record
HISTOGRMs that follow.) Adjust this range based on the characteristics of the file (the
lengths of the shortest and longest record) and the desired length of HISTOGRM.
3380
DEVWK= 3390
Tells the type of disk device that will be used for intermediate storage when the sort is run.
Specify the device number if HISTOGRM is to calculate L6 and L7.
KEYL
20
KEYL=
nnnn
Gives the end location of the last control field in the record. Specify a value for KEYL if
HISTOGRM is to calculate L6 and L7.
BIGREC
20
BIGREC= nnnn
MAX
Specifies the maximum number of HIS025I messages that will be issued in a HISTOGRM
execution. When HISTOGRM processes a large file, this message may be generated as
often as once for each record in the file. BIGREC limits the number of HIS025I messages
that will be issued in each execution. HISTOGRM processing continues, but no further
messages are issued once the BIGREC value is reached.
BLOCK
NOBLOCK
Tells whether or not to print the graphic portion of the HISTOGRM for block length.
REC
REC
NOREC
Tells whether or not to print the graphic portion of the HISTOGRM for record length.
BIGSTOP
BIGSTOP
NOBIGSTP
Tells whether or not to terminate the HISTOGRM run if an RDW value greater than the
DCB LRECL is encountered in the input file.
//L6L7 JOB
//STEP1 EXEC PGM=HISTOGRM
//STEPLIB DD DSN=HISTOGRM,DISP=SHR
//SYSUT1 DD UNIT=3490,VOL=SER=000001, 1
// DSN=VLRECS,LABEL=(1,SL),
DISP=OLD
//SYSPRINT DD SYSOUT=A 2
//SYSIN DD * 3
KEYL=50,DEVWK=3390,NOBLOCK,NOBIGSTP
/*
2. SYSPRINT is the data set on which printed output will appear. The DCB (not
illustrated) is: DCB=(LRECL=121,BLKSIZE=121,RECFM=F).
The following example shows a sample execution of HISTOGRM by an E15 exit during a
sort.
Figure 473. Sample JCL/Control Stream for HISTOGRM Initiated by an E15 Exit
1. SORTIN is a DD statement for MFX. It contains the data set that will be analyzed
while it is being sorted. The data set name is VARDATA, and it is found on the
standard labeled tape with the volume serial number 000001. The data set is already in
existence. If SORTIN is not a standard label tape, DCB parameters must be specified.
Note that RECFM must be either V, VB, or VBS.
2. SORTOUT is a DD statement for MFX. It assigns the data set name SORTED.DATA to
the output file, and specifies a 3490 tape unit with the volume serial number 000002. It
is not yet in existence. The DCB parameters default to those of SORTIN.
3. SORTWK01, SORTWK02, and SORTWK03 are DD statements for MFX. They reserve
20 cylinders of primary space, 10 cylinders of secondary space on direct access devices
for intermediate storage.
4. SYSOUT is a DD statement for MFX. It assigns the MFX messages to the output device
associated with class A.
5. The MODLIB DD statement is used to define the partitioned data set in which the
HISTE15 program resides; MODLIB is referenced in the MODS control statement. The
data set name is SYS1.SYNCLIB, and the DISP shows the library may be shared.
6. The SYSIN DD * statement marks the beginning of the input stream that includes the
sort control statements. The SORT control statement shows that one control field will
The MODS control statement must specify an E15 exit as an exit-type parameter and give
HISTE15 as the exit routine name. HISTE15 takes 5000 bytes of storage and resides in the
main MFX library referenced here by a DD statement named MODLIB. The routine does
not require link-editing during sort execution.
7. SYSPRINT is the data set on which the printout from HISTE15 appears. Its DCB is:
DCB=(LRECL=121,BLKSIZE=121,RECFM=F).
8. The HISTIN DD statement is optional. It is used to override any default values. The
following DCB parameter must be specified: DCB=(LRECL=80,RECFM=
FB,BLKSIZE=80). (With HISTIN DD *, the DCB is not necessary.)
NRECS= ALL
WIDTH= 20
KEYL= End of key field furthest into record for this sort.
REC
yyyyyyyyyyy
1. HISTOGRM informational messages for blocks are printed at the top of the report. For explanations, see individual messages in the
message section which follows these examples.
2. BLOCK COUNT gives the number of blocks falling within the minimum and maximum numbers shown as BLOCK LENGTH. The
range is the WIDTH value that has been specified.
3. The asterisks are the graphic representation of the number of blocks within the range of block lengths.
1. HISTOGRM informational messages for records are printed at the top of the report. For explanations, see individual messages in
the message section which follows these examples.
2. RECORD COUNT gives the number of records falling within the minimum and maximum numbers shown as RECORD LENGTH.
The range is the WIDTH value that has been specified.
3. The asterisks are the graphic representation of the number of records within this range of record lengths.
• MFX PipeSort
These products significantly improve sorting efficiency and enhance programmer produc-
tivity.
Sort processing within SAS often consumes as much as 30 percent of CPU time and EXCPs.
Because sorting is such a large part of system activity, PROC MFX’s efficiency results in
noticeable improvements in overall system throughput. This reduced elapsed time from
PROC MFX makes it possible for SAS applications to complete much faster.
PROC MFX improves performance by providing a direct interface between MFX and SAS.
This frees MFX to use its high performance techniques - sophisticated access methods, path
length minimization algorithms and I/O optimization.
MFX PipeSort
MFX PipeSort works with MFX to run multiple sorts simultaneously on the same input
data. For large input files, MFX PipeSort significantly reduces total elapsed time compared
to running separate sort jobs.
MFX PipeSort reads SORTIN once and distributes the input records to up to eight simulta-
neous MFX executions. The complete range of MFX control statements and PARMs is avail-
able for the individual sort operations.
The output files are differently sequenced according to user-specified sort keys and are
written to different SRTnOUT DD data sets.
Optionally, you can use an inline E15 exit, with or without one or more E35 exits. An inline
E15 input exit can supply the input data to MFX PipeSort, and E35 output exits can accept
the different output record sets.
For detailed information regarding installation and implementation through z/OS JCL,
refer to the MFX PipeSort User’s Guide.
where nnn is the message number and x may be any of the letters A through I. The inter-
pretation of the suffix letter x is given below.
A (action) messages indicate a critical error condition: MFX terminates in order to allow
the user to correct the error(s) so that a successful sort/merge may be run.
B (tuning) messages provide information that may be useful in adjusting the job/control
stream to the actual demands of the job. These messages only print if a critical error forces
sort termination or if B messages were requested at execution or installation time.
C-I (informational) messages document decisions internal to the sort as well as MFX’s
response to error conditions which are not severe enough to warrant sort/merge termina-
tion.
TSO %SS14MSG
The installation of the SS14MSG facility is optional. Therefore, if you are unable to invoke
the facility as described, you should contact your system administrator for more informa-
tion.
Note: All messages that refer to SORTIN, SORTWK, SORTOF, and SORTOUT provide the
actual DD name, which reflects any changes made via a DD name override or a prefix over-
ride.
Note: For MAXSORT, these counts are cumulative for the entire
MAXSORT application.
1. When the input consists of concatenated data sets, check that the
largest blocksize is available at sort initialization. See
“Concatenating Input Data Sets” on page 4.6.
2. If the data set is on disk and has just been created by another
program, check that this program opened the data set even if no
data was written to the file. The data set must be opened in order for
an end-of-file mark to be written. (In the absence of an end-of-file
mark, MFX will tend to read whatever was on the disk as part of
the input data set, causing an I/O error.)
EXPLANATION: The end of the SYSIN data set was reached before all
user exit routines were read or an object deck was missing its first
statement.
WER104A REXX E15 AND REXX E35 EXITS FOUND IN A COPY APPLICA-
TION
EXPLANATION: A REXX E15 and a REXX E35 may not both be speci-
fied in a copy application. Only one of the exits is permitted.
2. Data conversion has been requested for a field that is not specified
as BI, CSF/FS, FI, PD, Y2ID, Y2IP or ZD.
Note that for MAXSORTs, the factor displayed is at or near "1.00" for
all but the last sort. For the last sort, the factor may be anywhere
between "0.01" and "1.00" depending on the amount of data sorted.
EXPLANATION: The LRECL must be the same for all fixed-length files
supplied to a merge.
EXPLANATION: The virtual storage specified for MFX’s use was not
available in a contiguous block for Phase 1. This condition was probably
caused by a calling program or user exit routine. MFX obtained its vir-
tual storage in fragments and continued execution. Note that the call-
• ppp may not represent all of the preallocated tracks available, since
not all preallocated sortwork data sets may be opened by MFX.
• uuu may be less than the sum of ppp, ddd and sss since it
represents the space actually used and not the space available.
EXPLANATION: The installation default for the MFX SMF record fea-
ture is applied, but the sort did not invoke the module that creates the
sort statistical record. A possible reason for the sort’s not invoking the
module may be that FREE=CLOSE was coded on the SORTOUT
(SYSUT2) or SORTWKxx DD statement.
ACTION: Change the LRECL in the output file’s DCB or the l3 value on
the RECORD control statement (if an E35 exit is used) to reflect the
correct record length, or specify another value for the VLTEST PARM.
CONCAT DS
WER170A MULTIPLE INPUT , BLKSIZE NOT DIVIS BY LRECL
EXPLANATION: There are too many input records to fit in virtual stor-
age.
ACTION: Either increase the amount of virtual storage the sort is able
to use or supply SORTWKxx DD statements. (The DYNALLOC option
may be used instead of SORTWKxx DD statements.)
EXPLANATION: MFX was able to sort the input file without using
intermediate storage (SORTWKxx’s). All input data was contained in
virtual storage.
ACTION: Check the JCL and the disk or tape labels for the error.
ACTION: Execute HISTOGRM to check the data set for a record con-
taining invalid span bits. You can also use the VLTEST option to turn
off segment sequence checking if so desired.
EXPLANATION: SORTWKxx data set(s) are required for one of the fol-
lowing conditions in this execution of MFX: (1) INCORE=OFF is speci-
fied as a PARM, (2) exit E14 or E16 is activated, (3) the SUM control
statement is used, (4) the OUTREC control statement is used, (5) the
checkpoint-restart facility is used, (6) SORTOUT is a VSAM data set,
(7) the OUTFIL control statement is used. (All conditions only apply to
sort applications.)
EXPLANATION: The return code from merge exit E32 must be 8, 12, or
16.
EXPLANATION: The SVC nnn or SVC 109 with router code rrr was
specified as the MFX SVC. The SVC did not return a code indicating it
was at the correct version level, therefore it was not used. The SVC is
either at the wrong MFX release/maintenance level or is not an MFX
SVC. The problem could cause less efficient I/O and/or loss of SMF
records.
ACTION: Notify your system programmer, who should check that the
SVC has been installed in the system libraries, has been IPLed into the
system, was specified via SYNCMAC, and was not incorrectly overrid-
den via $ORTPARM or the PARM field.
0214 - Unit not available. If all specified units are unavailable when
DYNALLOC is issued, the DYNALLOC request fails.
For other reason codes, see IBM publication z/OS MVS Programming:
Authorized Assembler Services Guide SA22-7608.
ACTION: In the first case, code correct RECFM for the data set speci-
fied; in the latter case, code DCB characteristics for the output data set,
and rerun the job.
WER246I FILESIZE x
Note: If xx is A0, it is likely that the VSAM data set is empty, and that
VSAMEMT=NO is in effect. Pass the parameter VSAMEMT=YES as a
possible solution.
EXPLANATION: Two input files for a merge have the same number.
The file number is given.
ACTION: Use the IDCAMS utility to identify and correct the records in
error.
WER276B SYSDIAG=nnnnnnnn,nnnnnnnn,nnnnnnnn,nnnnnnnn
ACTION: Use z/OS checkpoint facilities since only these will save your
work areas and the program memory for restart.
ACTION: Allocate all intermediate sort data to the same device type.
ACTION: Restart this job and run under the same MFX release that
you started with.
EXPLANATION: Too few tape units were allocated to meet the number
specified in MINMERGE. Either too few SORTOUxx DD were supplied
or the z/OS system was unable to dynamically allocate enough units.
EXPLANATION: The operating system could not read the Job File Con-
trol Block for MFX analysis.
EXPLANATION: The amount of data that was processed for the cur-
rent MFX individual sort/merge is given in kilobytes. When a merge is
processed yy gives the number of tape units used.
EXPLANATION: The data set names of the tapes for intermediate sort
output are given. The tape volumes are listed for tape intermediate sort
output. Retain these reels for input to a later merge.
ACTION: The operator can wait until other tape drives have been
released, then reply 'RETRY'. If enough drives are now available, exe-
cution continues. Otherwise the above message is repeated. Eventually
enough tape drives become available or the operator terminates the job
with a 'STOP' response.
EXPLANATION: The input data set was allocated but never opened for
output. Therefore, there is no valid data or end-of-file mark in the data
set. This condition usually occurs when a program abends and the steps
to create the data are bypassed.
EXPLANATION: An object deck was found in the SYSIN data set that,
according to the MODS statement, was not specified as belonging in
SYSIN.
WER416B
access-method WAS USED FOR ddname
ddname: EXCP'S=eee [,UNIT=uuuu] [,DEV=dddd] [,CHP=cccccccc,n][,VOL=vvvvvv]
TOTAL OF xxx EXCP'S ISSUED FOR totalid
For certain types of sorts, MFX may dynamically allocate data sets
other than SORTWKxx data sets for use in the sorting process, and this
can occur whether or not normal dynamic allocation of sortwork data
sets is enabled. When used, such data sets are collectively represented
in a single WER416B message using a ddname of "SORTWK&&" for
the purpose of reporting EXCPs issued against them.
In the third form of the message, xxx provides a total of the EXCPs
issued for SORTWORKS, SORTING, COPYING, or MERGING, as iden-
tified by "totalid."
ACTION: Recreate the SORTOUT data set with more directory blocks
and rerun the job step.
If system resources are available and the output files of a multiple out-
put application have identical specifications, MFX will make this type
of change to take advantage of system resources to improve the applica-
tion’s performance.
EXPLANATION: One of the Y2x data formats has been used for a
SORT/MERGE field, an INCLUDE/OMIT/WHEN/BEGIN/END field or
an INREC/OUTREC edit field. The starting year is xxxx and the ending
year is yyyy for the century window used to process the fields.
EXPLANATION: The PARASORT technique has been used for this exe-
cution.
EXPLANATION: The tape label on volume vvvvvv does not match the
DCB characteristics of the input data set. This could happen because of
changed record length, BLKSIZE or record format. This situation is
normally caused by overwriting some of the data in a multi-volume
data set. The concatenation number indicates where in the input con-
catenation the volume in error may be found.
EXPLANATION: The DB2 query operation failed and the sort or copy
application will not execute. The message text indicates the condition
that caused the failure or the DB2 query requirement that was violated.
• MAXSORT MAY NOT BE SPECIFIED
• AN E15 EXIT MAY NOT BE SPECIFIED
• MERGE OPERATION MAY NOT BE SPECIFIED
• SKIPREC MAY NOT BE SPECIFIED
• SORTDBIN OPEN ERROR
• SORTDBIN CANNOT BE FOUND The DB2 parameter has been
specified, but the required SORTDBIN DD has not been provided.
• NO SQL SELECT STATEMENT FOUND IN SORTDBIN
• INVALID COMMAND, ONLY SQL SELECT STATEMENT
SUPPORTED Only a SELECT or $ELECT statement is valid in
SORTDBIN. No other SQL operations are supported.
• QUERY STATEMENT TOO LONG (MAX 32765 BYTES)
• CANNOT CONNECT TO DB2 DB2 is not started or the
subsystem name specified on the DB2 EXEC parameter is
incorrect.
• CANNOT BIND PLAN The user ID from which the job was
submitted has insufficient authority to bind the plan with the MFX
module. Submit the application from an ID that is allowed the
BIND privilege.
• BIND/OPN PLAN ER The user ID from which the job was
submitted has insufficient authority to bind the plan with the MFX
module or insufficient resources were available for DB2 to process
the open request.
• UNSUPPORTED DATA TYPE FOUND
• UNKNOWN DATA TYPE FOUND
• SQL ERROR: SQLCODE=xxxx,SQLSTATE=yyyy Where xxxx
is the SQLCODE and yyyy is the SQLSTATE returned. Refer to
IBM publication DB2 Universal Database for z/OS Messages and
Codes (GC18-9602) for details on these return codes.
• DB2 MODULES ARE NOT LINKED The DB2 query facility of
MFX has not been installed during MFX installation. Contact your
systems programmer for assistance.
If this does not solve the problem, then the total region size must be
raised high enough to contain all of the SORTJNF2 equally keyed
records.
EXPLANATION: MFX has used the zIIP processor for improved perfor-
mance.
EXPLANATION: The MFX Statistics data set did not have enough
space for the SYNCSMF record. This message is not controlled by the
MSG or FLAG PARM and will appear only on the console.
EXPLANATION: Some output lines are longer than the page width.
They are wrapped to the following line.
EXPLANATION: The format specified is not one of the valid data for-
mats.
ACTION: Check the libraries containing PROC MFX and MFX and
apply the required level of maintenance to each.
EXPLANATION: r.r is the MFX release number, and n.n is the TPF
maintenance level. A different product name is displayed when applica-
ble. No valid license key for use on the specified machine was found,
and the grace period for this error, noted by the WER903I warning mes-
sage, has expired. A key must contain the correct information for both
the serial number and the machine capacity. License keys are specified
either in the KEY parameter of the SYNCMAC installation options
macro, or included in a data set whose name is specified in the
KEYDSN parameter of SYNCMAC.
EXPLANATION: r.r is the MFX release number, and n.n is the TPF
maintenance level. A different product name is displayed when applica-
ble. The provided license key for this machine is only valid for the next
nnn days. After that time, WER902A will be issued, and the specified
product cannot be used.
EXPLANATION: r.r is the MFX release number, and n.n is the TPF
maintenance level. A different product name is displayed when applica-
ble. The provided license key for this machine is no longer valid because
the expiration date has passed. The specified product can no longer be
used.
EXPLANATION: r.r is the MFX release number, and n.n is the TPF
maintenance level. A different product name is displayed when applica-
ble. No valid license key for use on the specified machine was found.
License keys are specified in the KEY parameter of the SYNCMAC
installation options macro, or included in a data set whose name is
specified in the KEYDSN parameter of SYNCMAC.
EXPLANATION: r.r is the MFX release number, and n.n is the TPF
maintenance level. A different product name is displayed when applica-
ble. The KEYUPDATE parameter was specified, and MFX has success-
fully obtained a valid license key denoted by xxxxxxxxxxxxxxxx from
MFX’s key data set. The name of the data set was specified in the
KEYDSN parameter of the SYNCMAC installation options macro.
EXPLANATION: r.r is the MFX release number, and n.n is the TPF
maintenance level. A different product name is displayed when applica-
ble. The KEYUPDATE parameter was specified, but MFX was unable
to obtain a valid license key from MFX’s key data set due to the speci-
fied reason. Possible reasons for this failure are:
4. The MFX SVC was not available. MFX requires use of its SVC to
perform the update.
ACTION: Ensure that the KEYDSN parameter has been correctly spec-
ified and that the data set is accessible and contains a valid license key.
Also verify that the MFX SVC has been properly installed. If you
require further assistance, execute the SYNCLIST program on the sys-
tem where this message is occurring and contact Syncsort Mainframe
Product Services with the SYNCLIST output available for reference.
ACTION: Correct any errors in the key data set record that was dis-
played in the message text and rerun the KEYUPDATE application.
Troubleshooting Abends
WER999A indicates that an error condition occurred, preventing the successful completion
of the sort. This message does not necessarily mean that MFX was responsible for the error.
If, for example, the error is in the COBOL Input or Output Procedure of an invoked sort,
WER999A will appear. WER999A indicates that MFX got control after the error, printing
this MFX message.
The documentation accompanying WER999A varies with the error involved. It may consist
of a standard system dump (SYSUDUMP or SYSABEND) and/or an MFX-generated SNAP
dump. The MFX SNAP is formatted very much like a SYSUDUMP. In debugging the SNAP,
care must be taken to avoid reliance on the PSW AT ENTRY TO SNAP and the general reg-
isters. (A SNAP dump produced through the MFX DEBUG PARM or with a W-abend (i.e.,
WER999A UNSUCCESSFUL SORT xxxW) is only useful to a sort analyst at Syncsort
Mainframe Product Services. See “Before Calling Syncsort Mainframe Product Services”
later in this chapter.)
A W-type abend code indicates that program termination was forced by an error condition
internally detected by MFX; the problem cannot be resolved by the user. See “Before Call-
ing Syncsort Mainframe Product Services”, later in this chapter.
If any of the U-type abend codes in the chart below appears in the WER999A message, it
may indicate an MFX error (in which case, see “Before Calling z/OS Product Services”).
These are the only U-type abend codes that MFX issues; any U-type abend code which is
not on this list indicates an error in a user-written exit routine, invoking program or envi-
ronment. For example, user abend 4093 (RC=1C) is related to LOCALE processing. This
abend is issued from the LE/370 environment when the REGION is not large enough. To
address a U4093 abend, increase the REGION by 1 megabyte and resubmit the application.
Note that the WER999A message displays the abend code in hexadecimal.
Contact information:
Customers in Europe, Middle East, and Africa can contact Syncsort Mainframe
Product Services directly for expert advice at +800 7962 7678. E-mail can be used for any
question that does not need an immediate reply.
Contact information:
B Messages
A See BMSG Option
AC Format 2.30, 2.63, 2.234 BACKGROUND COLOR 2.126
ACCEPT Parameter 2.87 BALANCE Option 5.3, 5.6, 14.3
ACS 2.250, 5.13 BALN Option 6.7, 6.10
ALIGN Operator 13.16 BatchPipes/MVS 2.89, 4.5, 4.7, 4.9
ALLDUPS 2.19, 2.22–2.24 BI Format 2.30, 2.58, 2.63, 2.234
ALTSEQ 2.17–2.18, 6.9–6.10, 7.54 Binary Zeros, Insertion of 2.135–2.164, 3.30–3.32
AMODE 6.13 BIT 2.145
AND Operator 2.33, 3.3 Bit Level Comparison 2.31
ANSI Control Characters 2.118–2.119 Bit Level Logic 2.31–2.32, 2.44–2.46
Y’DATEx’ 2.39–2.41
Y2B Format 2.30, 2.65, 2.68, 2.160, 2.162, 2.235,
About Syncsort
Syncsort is a global software company that helps the world’s most successful organizations
rethink the economics of data. Syncsort provides extreme data performance and rapid time
to value through easy to use data integration and data protection solutions. With over
12,000 deployments, Syncsort has transformed decision making and delivered more
profitable results to thousands of customers worldwide.
© 2010 Syncsort Incorporated. All rights reserved. SyncSort, MFX, MFX PipeSort, PROC SYNCSORT and PROC MFX are trademarks of Syncsort Incorporated. All other
company and product names used herein may be the trademarks of their respective companies.
syncsort.com |1