Download Video Performer

Wednesday, September 18, 2013

SORT - Remove records from a file and update trailer count simultaneously:

SORT code is given below:

//STEP101 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SORTIN DD DSN=XXXX.YYYY,DISP=SHR
//SORTOUT DD DSN= X1.Y1,DISP=SHR
//SYSIN DD *
  SORT FIELDS=COPY
  OMIT COND=(1,9CH,EQ,C'2009MS06A')
      INREC IFTHEN=(WHEN=INIT
                                     OVERLAY=(221:SEQNUM,9,ZD)),
                   IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),
                                     OVERLAY=(8:221,9,ZD,SUB,+2,TO=PD,LENGTH=5))
                   OUTREC FIELDS=(1,220)
END
/*


- In above job records will be deleted based on the value ‘2009MS06A’ and trailer will be updated simultaneously with the current record count available in packed decimal format after deletion. 
 - The trailer count can be updated either in ZD/PD format depending upon the sort control card.

No comments:

Post a Comment