Sync Sort
Sync Sort
SyncSort is the only general-purpose sort program supported under z/OS (OS/390) at
NERDC. You can use SyncSort any of the following ways:
This document primarily describes how to use the SYNCSORT cataloged procedure. You
should have a general familiarity with JCL and/or one of the languages mentioned above.
SyncSort has the following functions:
DD Names
SyncSort uses the following ddnames:
SORTIN
defines the input data set for a sorting application; not required for a
merge-only operation.
SORTIN01-- SORTIN16
define the input data sets for a merging application; not required for a
sorting application.
SORTWK01-- SORTWK16
define intermediate storage data sets for a sorting application; not required
for a merge.
SORTOUT
defines the output data set for a sorting or merging application; should not
be the same as the SORTIN data set because a system failure could then
destroy both your output and your data.
SYSOUT
REGION Size
SyncSort uses the default system region size unless you specify a region size. The current
system default at NERDC is 1M (1024K). SyncSort allows you to specify up to 4M by
using the REGION= parameter on the JOB or EXEC statement.
The following optional keyword parameters can be added to the EXEC statement:
OPTION='options'
REGION=nM
Use this keyword to specify the region size for the SORT utility. For
example,
//SORT EXEC SYNCSORT,REGION=2M
WKVOL=vol
By default, the sortwork data sets will be allocated on the work packs. Use
this parameter to specify a particular volume.
Program-Initiated Sorts
Refer to the documentation for Assembler, COBOL, or PL/I for information on how to
invoke SyncSort from within a program.
EXEC SYNCSORT,OPTION='options'
If you are using your own JCL rather than using the SYNCSORT cataloged procedure, you
can specify options in the PARM parameter of the EXEC statement, as in this example:
//
EXEC PGM=SORT,REGION=region,PARM='options'
(col 72)
X
For program-invoked sorts with exit routines, you must determine the
amount of memory needed by the exits, then specify CORE=MAX-nnnK.
NOSNAP
For a more efficient sort, the order of the records is not preserved. If the
order needs to be retained, use the EQUALS keyword.
NOIOERR
Control statements will be listed on the SYSOUT data set. NOLIST will
turn this off.
MSGDD=SYSOUT
The default DD name of the message data set is SYSOUT. Any other valid
DD name can be substituted.
PRINT121
Unused space in sortwork data sets will be released during execution time
unless the sort is program-initiated.
NORLSOUT
in which "n" is an estimate of the number of records to be sorted. Sort keys specify the
fields within the record upon which to sort, their data types, and whether they are to be
sorted in ascending or descending order.
Each sort key has the following four parts: starting byte, length in bytes, format, and
order.
start
specifies the starting byte position in the record relative to byte 1, which is
the first byte. For variable-length records, the offset must include the
record descriptor, so the first byte of the data portion of the record is
position 5.
length
ZD
PD
FI
FL
AC
BI
AQ
order
Sorting Example
The following example helps to illustrate how to SORT a data set. Suppose you have a
card-image (80-byte records) data set called UF.userid.GRADES, which is to be sorted
alphabetically by student name within the same letter grade. Assume the name is in
columns 1-25 and the letter grade is in column 50 of each record, and there are
approximately 100 students in the file. Figure 3 shows a sample job setup using the
SYNCSORT cataloged procedure.
Figure 3. Example to SORT a Data Set.
The input data set is UF.userid.GRADES. The output data set will be sent to the printer.
//SORTLST JOB (,,time,lines),'your name',CLASS=class
/*ROUTE PRINT node.location
//SORT EXEC SYNCSORT
//SORTIN DD DSN=UF.userid.GRADES,DISP=SHR
//SORTOUT DD SYSOUT=A
//SYSIN
DD *
SORT FIELDS=(50,1,CH,A,1,25,CH,A),FILSZ=E100