SYMNAMES in SORT

SYMNAMES is a means of defining variables in SORT. When you have a complex sortcard, it becomes hard to have your sort control card ‘readable / understandable’. It is a good practice to always use SYSNAMES DD to define variables and then use the logical variable names in Sort card.

Below is an example with the SYMNAMES DD (variables declared) and SYSIN (the ‘sort control card’).

//SORTSTEP  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DISP=SHR,
//            DSN=MYDSN.NAME
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,2000)
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,2000)
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,2000)
//SYMNAMES DD *
 Name,1,10,CH
 Age,11,2,ZD
/*
//SYSIN    DD *
 SORT FIELDS=(Age,D)
 INCLUDE FILEDS=(Age,GT,25)
/*
//SORTOUT  DD DISP=(NEW,CATLG,DELETE),
//            SPACE=(CYL,(250,100),RLSE),
//            UNIT=DISK,
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),
//            DSN=MYDSN.OUTPUT.NAME

read more on SYMNAMES

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.