SyncSort MVS

SyncSort is high performance sort/merge/copy utility available on the MVS mainframe systems. The basic functions of SyncSort are:

  • Sorting - Rearranging records to produce a specific sequence.
  • Merging - Combining up to 100 pre-sequenced datasets into one dataset which has the same sequence.
  • Copying - Reproducing a dataset without going through the sorting process.

Reference Manual

The SyncSort MVS Programmers Guide, which resides in dataset DC.MANUALS.SYNCSORT.ZOS.USERS.GUIDE on the Triplex System, is available in a downloadable PDF format.

 

DDNAME Standards for Sort Procedures

DDNAME

Definition

SORTIN

Input dataset for a sort application.

SORTIN01-SORTIN99

Input datasets for a merge application.

SORTWK01-SORTWK32

Intermediate storage datasets for a sort application.

SORTOUT

Output dataset for a sort/merge application.

SORTOFxx

Used for multiple output datasets created using SYNCSORT 'INCLUDE' and/or 'OMIT' statements. xx are any valid alphanumeric characters.

SYSIN

Input file for sort/merge control statements.

$ORTPARM

Used to pass SYNCSORT parameters in invoked sorts or in IEBGENER (BTRGENER) applications.

 

Internal Sort Considerations

All programs (ASSEMBLER, COBOL, PLI, etc.) using an internal sort must specify DDname SORTMSG in place of DDname SYSOUT in order to generate sort statistics. This is necessary because the SYSOUT DDname is used for other purposes by these programming languages.

 

Basic SyncSort Job

Following is an example of JCL used in a basic SyncSort standalone job:

//stepname EXEC PGM=SYNCSORT,REGION=____
//SORTIN DD DSN=your.input.dataset.name,DISP=OLD
//SORTOUT DD DSN=your.output.dataset.name,
  DISP=(NEW,CATLG,DELETE),
  SPACE=____,DCB=____
//SYSIN DD *

sort control
statements

/*
//SYSOUT

DD SYSOUT=*
//SORTWK01 DD SPACE=____
. . .  
. . .  
. . .  
//SORTWK99 DD SPACE=____

Note SORTWK datasets are often not required if sufficient space (REGION) is requested on the JOB or EXEC statement.

Sort Procedures

It is important to select the proper sort and space for your specific requirements. Refer to "Performance Considerations" in the SyncSort reference manual.

The following sort procedures reside in SYS2.PROCLIB on the Gold Camp mainframe systems:

MINISORT

The MINISORT procedure uses disk space for three sortwork files, each allocating five cylinders.

MINISORT JCL Example

//stepname EXEC MINISORT
//SORTIN DD DSN=your.input.dataset.name,DISP=SHR
//SORTOUT DD DSN=your.output.dataset.name,
// RETPD=____,DISP=(NEW,CATLG,DELETE),
// SPACE=____,DCB=____
//SYSIN DD *
sort control statements
/*

DISKSORT

The DISKSORT procedure uses disk space for three sortwork files, each allocating ten cylinders.

DISKSORT JCL Example

//stepname EXEC DISKSORT
//SORTIN DD DSN=your.input.dataset.name,DISP=SHR
//SORTOUT DD DSN=your.output.dataset.name,
// DISP=(NEW,CATLG,DELETE),RETPD=____,
// SPACE=____,DCB=____
//SYSIN DD *
sort control statements
/*

MIDISORT

The MIDISORT procedure uses three sortwork files, each allocating twenty cylinders.

MIDISORT JCL Example

//stepname EXEC MIDISORT
//SORTIN DD DSN=your.input.dataset.name, DISP=SHR
//SORTOUT DD DSN=your.output.datset.name,
// DISP=(NEW,CATLG,DELETE),RETPD=____,
// SPACE=____,DCB=____
// SYSIN DD *
sort control statements
/*

MAXISORT

The MAXISORT procedure uses three sortwork files, each allocating 140 cylinders.

NoteThis is a large capacity sort and must be run in the proper Job Class and as a one-step job.

MAXISORT JCL Example

//stepname EXEC MAXISORT
//SORTIN DD DSN=your.input.dataset.name,DISP=SHR
//SORTOUT DD DSN=your.output.dataset.name,
// DISP=(NEW,CATLG,DELETE),RETPD=____,
// SPACE=____,DCB=____
//SYSIN DD *
sort control statements
/*

SUPRSORT

The SUPRSORT procedure is a large capacity disk sort that uses six sortwork areas as defined by Data Class SORTWK.

SUPRSORT JCL Example

//MAXSORT PROC PRNT=A,BKPTDSN=,SRTSPC=350,
// MAXWK=1050,SIZET=4096K,
// TME=90,WKRETPD=5,BKRETPD=5,SIZE=6M,
// RESTART=LAST
//************ *********************************************
//MAXSORT EXEC PGM=SYNCSORT,
// PARM=('MAXSORT,MAXWKSP=&MAXWK,
// RC16=ABE,VSCORET=&SIZET',
// 'BKPTDSN=&BKPTDSN..,RESTART=&RESTART'),
// REGION=&SIZE,TIME=&TME
//SYSOUT DD SYSOUT=&PRNT
//SORTWK01 DD SPACE=(CYL,(&SRTSPC)),DSN=&&TEMP1,
// DISP=(NEW,PASS)
//SORTWK02 DD SPACE=(CYL,(&SRTSPC)),DSN=&&TEMP2,
// DISP=(NEW,PASS)
//SORTWK03 DD SPACE=(CYL,(&SRTSPC)),DSN=&&TEMP3,
// DISP=(NEW,PASS)
//SORTOU00 DD DSN=&BKPTDSN..SPOOL,
// DISP=(MOD,DELETE,CATLG),
// UNIT=(XTAPE,,DEFER),
// LABEL=RETPD=&WKRETPD
//SORTOU01 DD DSN=&BKPTDSN..MRGE1,
// DISP=(MOD,DELETE,CATLG),
// UNIT=(XTAPE,,DEFER),
// LABEL=RETPD=&WKRETPD
//SORTOU02 DD DSN=&BKPTDSN..MRGE2,
// DISP=(MOD,DELETE,CATLG),
// UNIT=(XTAPE,,DEFER),
// LABEL=RETPD=&WKRETPD
//SORTOU03 DD DSN=&BKPTDSN..MRGE3,
// DISP=(MOD,DELETE,CATLG),
// UNIT=(XTAPE,,DEFER),
// LABEL=RETPD=&WKRETPD
//SORTBKPT DD DSN=&BKPTDSN,SPACE=(1000,(100,50)),
// DISP=(MOD,CATLG),LABEL=RETPD=&BKRETPD
//SORTIN DD DDNAME=SORTIN
//SORTOUT DD DDNAME=SORTOUT
//SYSIN DD DDNAME=SYSIN

MAXSORT

MAXSORT uses both tape and disk to sort large volumes of data. The data is sorted to the SORTWORK (DDname SORTWKxx) disk areas until available space is filled. When the sortwork space is filled, the sorted data is written to intermediate work tapes. If more input data remains to be sorted, the pre-allocated sortwork areas are reused. After all the sortwork areas have been filled, the data is merged to the intermediate work tapes. This process continues until there is no more input data to be sorted. All the merged intermediate work tapes are then merged to the sorted output file.

The MAXSORT procedure has a total of eight symbolic parameters:

&BKRETPD: Indicates the retention period of the sort breakpoint dataset. The default is 1 (one day).

&BKPTDSN: This is a required parameter and indicates the name of the breakpoint dataset. A fully-qualified dataset name must be provided for this parameter. It is also used to make unique dataset names for the SPOOL and MERGE datasets.

&SRTSPC and &MAXWK: These two parameters work together.

&SRTSPC is the number of cylinders allocated per sortwork device. The default is 350 cylinders for each of the three sortwork units.

&MAXWK reflects the total amount of disk sortwork space available for use by SYNCSORT. &MAXWK is computed by multiplying &SRTSPC by 3 (&SRTSPC x 3). The default is 1050 cylinders which is the sum of the total allocations from &SRTSPC.

&RESTART: Indicates whether the job can be restarted. The default is LAST. The two valid overrides for this parameter are LAST and ID.

LAST indicates that a restart is being requested and the restart is to begin at the last successfully completed breakpoint.

ID indicates that the sort is to resume at a particular breakpoint indicated by a code number (ID).

&SIZET: This parameter is the VSCORE for the job. The default is 4096K.

&TME: This is the maximum amount of CPU time for the job to complete in minutes. The default is 90 (90 minutes).

WKRETPD: This is the retention period for the work/merge tapes used during the sort. The default is 2 (two days).

Restarts

If a restart is required, assure that the following steps are completed:

  • Assign a longer retention period to the breakpoint dataset.
  • Assign a longer retention period to the work tape files.
  • Rerun the job with RESTART=LAST.

Invoked MAXSORT Sorts

Invoked sorts (sorts invoked from a program written in a language such as COBOL) must proceed in a slightly different fashion. Imbed a //$ORTPARM DD statement invoking MAXSORT in your JCL.

Invoked sort JCL Example:

//$ORTPARM DD *
MAXSORT
/*

NoteSORTWK01, SORTWK02, SORTWK03, SORTOU00, SORTOU01, SORTOU02, SORTOU03 and SORTBKPT DD statements must be included in the invoked sort step. The MAXSORT procedure can be used as a model.

Additional parameters may be passed in the following way:

//$ORTPARM DD *
MAXSORT,RESTART=LAST
/*

MAXSORT JCL Example

WarningWarning:

The SPOOL and MERGE datasets incorporate the breakpoint dataset name to create unique names; the potential for creating a dataset larger than 44 characters is possible. Each user must assure that the breakpoint name provided is no longer than 30 characters to adhere to the restriction that dataset names shall not be longer than 44 characters.

Another precaution is in the use of special characters. For example, if the breakpoint dataset name is a generation datagroup (GDG), such as userid.MBBREAK.DATA(+1), an invalid dataset name will be created for the SPOOL and MERGE datasets. To prevent this from happening, specific overrides must be provided.

MAXSORT Override JCL Example

MAXSORTR

Use the MAXSORTR procedure to restart MAXSORT jobs that do not successfully complete. To execute MAXSORTR, simply resubmit your original MAXSORT JCL and change "EXEC MAXSORT" to "EXEC MAXSORTR". No further JCL changes are required.

MAXSORTR JCL Example

//stepname EXEC MAXSORTR,
// BKPTDSN=your.breakpoint.dataset.name
//MAXSORT.SORTIN DD DSN=your.input.dataset.name,DISP=OLD
//MAXSORT.SORTOUT DD DSN=your.output.dataset.name,DISP=OLD
//MAXSORT.SYSIN DD your.dataset.name,DISP=OLD

SORT

The SORT procedure does not contain sortwork files; provide sortwork DD statements, if required.

SORT JCL Example

//stepname EXEC SORT
//SORTWK01 DD SPACE=(TRK,(10))
//SORTWK02 DD SPACE=(TRK,(10))
//SORTWK03 DD SPACE=(TRK,(10))
//SORTIN DD DSN= your.input.dataset.name,DISP=OLD
//SORTOUT DD DSN= your.output.dataset.name,
// DISP=(NEW,CATLG,DELETE),LABEL=RETPD=____
//SYSIN DD *
sort control statements
/*

MERGE

The MERGE procedure merges presorted files; therefore, no sortwork files are required. Input can be up to 100 presorted datasets. For a given application, all records must be of the same format and, if fixed length, must all be the same record length.

The files must be in sorted order before they can be merged. Merging concatenated files is impossible except for a multi-volume file.

The REGION and CORE parameters must be increased as more input is to be merged, or if the block sizes are greater than 8000.

MERGE JCL Example 1

//stepname EXEC MERGE
//SORTIN01DD DSN= your.input1.dataset.name,DISP=OLD
//SORTIN02DD DSN= your.input2.dataset.name,DISP=OLD
//SORTIN03DD DSN= your.input3.dataset.name,DISP=OLD
//SORTOUTDD DSN= your.output.dataset.name,
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD DSN=SORTACC(MERGE43),DISP=SHR

MERGE JCL Example 2

//stepname EXEC MERGE,PARM.MERGE='CORE=MAX'
//SORTIN01DD DSN= your.input1.dataset.name,DISP=OLD
//SORTIN02DD DSN= your.input2.dataset.name,DISP=OLD
//SORTIN03DD DSN= your.input3.dataset.name,DISP=OLD
//SORTIN04DD DSN= your.input4.dataset.name,DISP=OLD
//SORTOUTDD DSN= your.output.dataset.name,
// DISP=(NEW,KEEP,DELETE)
//SYSIN DD *
Merge Control Statements
/*

The following example demonstrates how to increase the CORE and REGION when a very large size or number of records is to be merged.

//stepname EXEC MERGE,TIME.MERGE=15,
PARM.MERGE='CORE=MAX'
//SORTIN01 DD DSN= your.input1.dataset.name,DISP=OLD
//SORTIN02 DD DSN= your.input2.dataset.name,DISP=OLD
//SORTIN03 DD DSN= your.input3.dataset.name,DISP=OLD
//SORTIN04 DD DSN= your.input4.dataset.name,DISP=OLD
//SORTOUT DD DSN= your.output.dataset.name,
// DISP=(NEW,KEEP,DELETE)
//SYSIN DD *
Merge Control Statements
/*

User-Written SORT Exits

User-written sort exits, which are written in Assembler Language, are subroutines that may be called by the sort program.

Some of the tasks that may be accomplished include: packing fields, summarizing on sort key, eliminating unnecessary fields, adding or deleting records, and keeping file controls.

TSO SORT (TSOSORT) Command

The TSOSORT command is used to sort files online rather than in batch. To execute this command, enter TSOSORT at the TSO READY prompt or ISPF Option 6.

PARASORT

PARASORT is not supported at the Gold Camp Campus.

PIPESORT

PipeSort is a concurrent sort utility which performs up to eight simultaneous sorts on the same input data. It is used in place of a multiple step job that sorts the same input data into a different sorted output for each step of the job.

For large input files, PipeSort significantly reduces total elapsed time compared to running separate sort jobs.

PipeSort reads the SORTIN once and distributes the input records to a maximum of eight simultaneous SyncSort executions. The complete range of SyncSort control statements and parameters is available for individual sort operations.

The output files are sequenced according to user-specified sort keys and are written to different SRTnOUT DD datasets. Following is a description of each JCL DD statement required for a PipeSort execution:

DDNAME Definition
SORTIN Input dataset to be sorted. One is required.
SYSOUTn Message dataset for the individual sort. One is required for each pipe, up to a maximum of eight.
SRTnCNTL Sort control statement(s). One is required for each pipe, up to a maximum of eight. This statement is equivalent to the SYSIN statement in a standard sort step.
SRTnOUT Output dataset. One is required for each pip, up to a maximum of eight.
SRTnWKnn A series of sortwork datasets for each pipe. These datasets are optional for most sorts.

PipeSort JCL Example:

In the following PipeSort JCL example, one input file (SORTIN) will be simultaneously sorted into four separate output files, each having a different sort sequence.

//stepname EXEC PGM=PIPESORT,REGION=4096K
//SORTIN DD DSN=your.input.dataset.name,DISP=OLD
//SYSOUT DD SYSOUT=1
//SRT1OUT DD DSN= your.output1.dataset.name,
// UNIT=XTAPE,VOL=(PRIVATE,,,5),RETPD=____,
// DISP=(NEW,CATLG,DELETE)
//SYSOUT1 DD SYSOUT=1
//SRT1CNTL DD * <==== sort fields for pipe 1
sort control statements
/*  
//SRT2OUT DD DSN=your.output2.dataset.name,
// UNIT=XTAPE,VOL=(PRIVATE,,,5),RETPD=____,
// DISP=(NEW,CATLG,DELETE)
//SYSOUT2 DD SYSOUT=1
//SRT2CNTL DD * <==== sort fields for pipe 2
sort control statements
/*  
//SRT3OUT DD DSN= your.output3.dataset.name,,
// UNIT=XTAPE,VOL=(PRIVATE,,,5),RETPD=____,
// DISP=(NEW,CATLG,DELETE)
//SYSOUT3 DD SYSOUT=1
//SRT3CNTL DD * <==== sort fields for pipe 3
sort control statements
/*  
//SRT4OUT DD DSN= your.output4.dataset.name,
// UNIT=XTAPE,VOL=(PRIVATE,,,5),RETPD=____,
// DISP=(NEW,CATLG,DELETE)
//SYSOUT4 DD SYSOUT=1
//SRT4CNTL DD * <==== sort fields for pipe 4
sort control statements
/*  

MAXSORT Procedure:

//MAXSORT PROC PRNT=A,BKPTDSN=,SRTSPC=350,
// MAXWK=1050,SIZET=4096K,
// TME=90,WKRETPD=5,BKRETPD=5,SIZE=6M,
// RESTART=LAST
//************ *********************************************
//MAXSORT EXEC PGM=SYNCSORT,
// PARM=('MAXSORT,MAXWKSP=&MAXWK,
// RC16=ABE,VSCORET=&SIZET',
// 'BKPTDSN=&BKPTDSN..,RESTART=&RESTART'),
// REGION=&SIZE,TIME=&TME
//SYSOUT DD SYSOUT=&PRNT
//SORTWK01 DD SPACE=(CYL,(&SRTSPC)),DSN=&&TEMP1,
// DISP=(NEW,PASS)
//SORTWK02 DD SPACE=(CYL,(&SRTSPC)),DSN=&&TEMP2,
// DISP=(NEW,PASS)
//SORTWK03 DD SPACE=(CYL,(&SRTSPC)),DSN=&&TEMP3,
// DISP=(NEW,PASS)
//SORTOU00 DD DSN=&BKPTDSN..SPOOL,
// DISP=(MOD,DELETE,CATLG),
// UNIT=(XTAPE,,DEFER),
// LABEL=RETPD=&WKRETPD
//SORTOU01 DD DSN=&BKPTDSN..MRGE1,
// DISP=(MOD,DELETE,CATLG),
// UNIT=(XTAPE,,DEFER),
// LABEL=RETPD=&WKRETPD
//SORTOU02 DD DSN=&BKPTDSN..MRGE2,
// DISP=(MOD,DELETE,CATLG),
// UNIT=(XTAPE,,DEFER),
// LABEL=RETPD=&WKRETPD
//SORTOU03 DD DSN=&BKPTDSN..MRGE3,
// SP=(MOD,DELETE,CATLG),
// UNIT=(XTAPE,,DEFER),
// LABEL=RETPD=&WKRETPD
//SORTBKPT DD DSN=&BKPTDSN,SPACE=(1000,(100,50)),
// DISP=(MOD,CATLG),LABEL=RETPD=&BKRETPD
//SORTIN DD DDNAME=SORTIN
//SORTOUT DD DDNAME=SORTOUT
//SYSIN DD DDNAME=SYSIN

MAXSORT Override JCL Example:

//stepname EXEC MAXSORT,PRINT=1,
// BKPTDSN='your.breakpoint.dataset.name(+1)'
//MAXSORT.SORTOU00 DD DSN=your.output.dataset.name,
// DISP=(,KEEP)
//SORTOU01 DD DSN= your.output1.dataset.name,
// DISP=(,KEEP)
//SORTOU02 DD DSN= your.output2.dataset.name,
// DISP=(,KEEP)
//SORTOU03 DD DSN= your.output3.dataset.name,
// DISP=(,KEEP)

 

Customer Guide

Loading

 



 

Contact Us

Service.Desk@State.ca.gov

(916) 464-4311

P.O. Box 1810
Rancho Cordova, CA
95741-1810