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

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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