- INPUT
- Blocked fixed-length records on 3380 and 3390
- OUTPUT
- Blocked fixed-length records on 3390
- WORK DATA SETS
- Dynamically allocated
- USER EXITS
- None
- FUNCTIONS/OPTIONS
- OMIT, OUTREC, SUM, DYNALLOC, ZDPRINT
//EXAMP JOB A400,PROGRAMMER 01
//STEP1 EXEC PGM=SORT 02
//SYSOUT DD SYSOUT=H 03
//SORTIN DD DSN=INP1,DISP=SHR,UNIT=3380,VOL=SER=SCR001 04
// DD DSN=INP2,DISP=SHR,UNIT=3390,VOL=SER=SYS351 05
//SORTOUT DD DSN=&&OUTPUT,DISP=(,PASS),UNIT=3390, 06
// SPACE=(CYL,(5,1)),DCB=(LRECL=22) 07
//SYSIN DD * 08
OMIT COND=(5,1,CH,EQ,C'M') 09
SORT FIELDS=(20,8,CH,A,10,3,FI,D) 10
SUM FIELDS=(16,4,ZD) 11
OPTION DYNALLOC,ZDPRINT 12
OUTREC FIELDS=(10,3,20,8,16,4,2Z,5,1,C' SUM') 13
- Line
- Explanation
- 01
- JOB statement. Introduces this job to the operating system.
- 02
- EXEC statement. Calls DFSORT directly by its alias SORT.
- 03
- SYSOUT DD statement. Directs DFSORT messages and control statements
to system output class H.
- 04-05
- SORTIN DD statement. Consists of a concatenation of two data
sets. The first input data set is named INP1 and resides on 3380 volume
SCR001. The second input data set is named INP2 and resides on 3390
volume SYS351. DFSORT determines from the data set labels that the
record format is FB, the LRECL is 80 and the largest BLKSIZE is 27920.
- 06-07
- SORTOUT DD statement. The output data set is temporary and
is to be allocated on a 3390. Because the OUTREC statement results
in a reformatted output record length of 22 bytes, LRECL=22 must be
specified. DFSORT sets the RECFM from SORTIN and selects an appropriate
BLKSIZE.
- 08
- SYSIN DD statement. DFSORT control statements follow.
- 09
- OMIT statement. COND specifies that input records with a character
M in position 5 are to be omitted from the output data set.
- 10
- SORT statement. FIELDS specifies an ascending 8-byte character
control field starting at position 20 and a descending 3-byte fixed-point
control field starting at position 10.
- 11
- SUM statement. FIELDS specifies a 4-byte zoned-decimal summary
field starting at position 16. Whenever two records with the same
control fields (specified in the SORT statement) are found, their
summary fields (specified in the SUM statement) are to be added and
placed in one of the records, and the other record is to be deleted.
- 12
- OPTION statement. DYNALLOC specifies that work data sets are
to be dynamically allocated using the installation defaults for the
type of device and number of devices. ZDPRINT specifies that positive
ZD SUM fields are to be printable.
- 13
- OUTREC statement. FIELDS specifies how the records are to be
reformatted for output. The reformatted records are 22 bytes long
and look as follows:
- Position
- Content
- 1-3
- Input positions 10 through 12
- 4-11
- Input positions 20 through 27
- 12-15
- Input positions 16 through 19
- 16-17
- Zeros
- 18
- Input position 5
- 19-22
- The character string ' SUM'