Loading

Sort Card examples (IBM Mainframes)

Avoid duplicates in a particular field (say first 8 characters)

SORT FIELDS=(1,8,CH,A)
SUM FIELDS=NONE

Sort first 8 characters, and omit few values

SORT FIELDS=(1,8,CH,A)
OMIT COND=(1,8,CH,EQ,C'AAAAAAAA')

Sort first 8 characters, and include only few values

SORT FIELDS=(1,8,CH,A)
INCLUDE COND=(1,8,CH,EQ,C'AAAAAAAA',OR, 1,8,CH,EQ,C'BBBBBBBB')

Sort card to select only 15 characters from 36th position of my input file.

//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)
//SYSIN    DD *
 SORT FIELDS=COPY
 OUTFIL CONVERT,
 OUTREC=(1:36,15,65X)
/*
//SORTOUT  DD DISP=(NEW,CATLG,DELETE),
//            SPACE=(CYL,(250,100),RLSE),
//            UNIT=DISK,
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),
//            DSN=MYDSN.OUTPUT.NAME

The 65X is given to fill the remaining 65 bytes of the output file with spaces.

Related Posts




blog comments powered by Disqus

There's 3 Comments So Far

  •   subhasis
    February 20th, 2011 at 5:48 am

    thanks , it has been explained nicely.

  •   gopinath
    April 23rd, 2012 at 11:27 am

    thanks for explaining clearly with examples

  •   Karthik
    April 23rd, 2012 at 1:57 pm

    thanks Gopinath !

Share your thoughts, leave a comment!