BSP - Beratung, Schulung, Projekte


Using the MVT Sort with the Tur(n)key System

MVT Sort/Merge Control Statements

Control statements for the MVT Sort/Merge facility follow the same conventions as the other utility programs. Column 1 of the control statement must be blank, unless the statement has been given a title, which is usually not the case. Therefore, the text begins in column 2 of the statement. The parameters of the statement must not extend beyond column 71. If the control statement will not fit on a single line, break the statement at a comma and continue the statement on the next line, beginning in any column between columns 2 and 16. A continuation indicator character is not required in column 72 of any statement being continued onto the next line.

There is one strange restriction: The record length of the file(s) to be sorted or merged need to be 18 bytes or longer.

Parameters controlling the operation of a SORT or MERGE are submitted on a single control statement. The parameters that may be specified are:

FIELDS=(position,length,format,sequence,...)
or
FIELDS=(position,length,sequence,...),FORMAT=format
where In either format, the parameters inside the parentheses may be repeated as many times as required to specify the composite field that will determine the sort order.
If all the individual sub-fields that are to be sorted are of the same data format, use of the second syntax will simplify the coding.

FILESZ=x (Optional)
SKIPREC=z (Optional; not permitted for MERGE)
EQUALS | NOEQUALS
CKPT

Examples of SORT and MERGE statements:

SORT FIELDS=(11,1,CH,A,1,10,CH,A)
Sorts on two control fields – 1 byte beginning in byte 11 of the input record and 10 bytes beginning in byte 1 of the input record; both control fields will be sorted in ascending sequence and contain EBCDIC character data.
SORT FIELDS=(11,1,A,1,10,A),FORMAT=CH
This alternative format specifies the same sort as the first example.
SORT FIELDS=(5,4,PD,D,96,20,CH,A),SKIPREC=500,EQUALS
Sorts on two control fields
MERGE FIELDS=(1,7,CH,A)
Merges two or more input files on a single control field

The characteristics of the records in the input file(s) are specified on the RECORD statement:

RECORD TYPE={F|V},LENGTH=value

In order to use an alternating collating sequence, specify AQ as the data format in the SORT or MERGE control fields statement and include an ALTSEQ statement to specify the alternate collating sequence to be used:

ALTSEQ CODE=(fftt,fftt,...,fftt)
Where ff is the hexadecimal representation of the character whose position is to be changed and tt is the hexadecimal representation of the position to which it is to be moved.

The sort control statements are followed by an END statement to signal that all sort control input has been processed:

END

Sort/Merge JCL and Parameters

The SORT utility is controlled via standard JCL:

//TESTSORT JOB  (SETUP),
//             'TEST SORT',
//             CLASS=A,
//             MSGCLASS=A,
//             REGION=1024K,
//             MSGLEVEL=(1,1)
//SORT    EXEC PGM=SORT,REGION=512K,PARM='MSG=AP'
//SYSOUT   DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*
//SORTLIB  DD  DISP=SHR,DSN=SYS1.SORTLIB
//SORTOUT  DD  SYSOUT=*,DCB=(BLKSIZE=80,RECFM=F)
//SORTWK01 DD  UNIT=2314,SPACE=(CYL,(5,5))
//SORTWK02 DD  UNIT=2314,SPACE=(CYL,(5,5))
//SORTWK03 DD  UNIT=2314,SPACE=(CYL,(5,5))
//SORTWK04 DD  UNIT=2314,SPACE=(CYL,(5,5))
//SORTWK05 DD  UNIT=2314,SPACE=(CYL,(5,5))
//SORTWK06 DD  UNIT=2314,SPACE=(CYL,(5,5))
//SYSIN  DD    *
 SORT FIELDS=(40,10,CH,A)
 RECORD TYPE=F,LENGTH=(80)
 END
/*
//* SORT FIELDS=(06,06,CH,A)
//SORTIN DD *
..... data to be sorted ..........
Parameters controlling the overall performance of the Sort/Merge program are submitted using the PARM= parameter on the execution Job Control Card. The parameters that may be specified are:
PARM=Description
BALN Utilizes the Balance Tape or Direct Access Technique for sort work distribution.
CORE= Main Storage Allocation, where specifies the number of bytes to be allocated for the Sort/Merge program including buffers.
CRCX Utilizes the Criss Cross Direct Access Technique for sort work distribution.
DIAG Creates detailed diagnostic messages for use in solving severe Sort/Merge problems.
MSG=AC
AP
CC
CP
NO
Sort message output, where:
AC specifies all messages to the console
AP specifies all messages to SYSLOG
CC specifies critical messages to the console
CP specifies critical messages to SYSLOG
NO specifies no messages are to be output
The default is NO, which will result in no messages. If you receive a non-zero return code from the sort, you should resubmit the sort with a PARM=’MSG=AP’ so that diagnostic messages will be produced.
OSCL Utilizes the Oscillating Tape Technique for sort work distribution.
POLY Utilizes the Polyphase Tape Technique for sort work distribution.