Page 1 of 1

How to subtract a particular value through all the records

PostPosted: Wed Jun 08, 2011 3:17 pm
by coollearner
I Have a following file with records
686989
697826
655898
088779
065899
676997
787899
58689
I want to subtract 999 from all the records. Can this be achieved using SORT?

Re: How to subtract a particular value through all the recor

PostPosted: Wed Jun 08, 2011 8:40 pm
by Frank Yaeger
You can use a DFSORT job like the following:

//S1 EXEC PGM=SORT                                         
//SYSOUT DD SYSOUT=*                                       
//SORTIN DD *                                               
686989                                                     
697826                                                     
655898                                                     
088779                                                     
065899                                                     
676997                                                     
787899                                                     
58689                                                       
//SORTOUT DD SYSOUT=*                                       
//SYSIN DD *                                               
  OPTION COPY                                               
  INREC BUILD=(1,6,UFF,SUB,+999,TO=ZD,LENGTH=6)             
/*


SORTOUT would have:

685990     
696827     
654899     
087780     
064900     
675998     
786900     
057690     


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080