View previous topic :: View next topic
|
Author |
Message |
nmr
New User
Joined: 27 Sep 2007 Posts: 14 Location: hyderabad
|
|
|
|
My requirement is I need to read one file and in that file
for the variable say lockbox-number I need to sort all the lockbox-numbers and I need to calculate the
same lockbox-number record amounts and write total to output file
for example in the input file lockbox-number are like this
----------------------------------------------------------
Code: |
lockbox-number amount
6064 10
6064 20
6064 30
6065 60
6065 70
6065 80
6064 40
6064 50
|
output file
Code: |
lockbox-number total
6064 150
6065 210
|
how can we write sort job to perform above output |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
Use the SUM FIELDS option of SORT...
Try searching the forum b4 posting |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
Hi,
Try this sort card
Code: |
SUM FIELDS=(5,2,ZD) |
Let me know if you need any more help |
|
Back to top |
|
|
nmr
New User
Joined: 27 Sep 2007 Posts: 14 Location: hyderabad
|
|
|
|
Thanks khamarutheen
its working for me |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
nmr wrote: |
Thanks khamarutheen
its working for me |
nmr,
Are you sure you got the right results? Your summing on 2 bytes will results in a overflow and you will NOT get the right results. Use the following DFSORT JCL which will you the desired results.
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
6064 10
6064 20
6064 30
6065 60
6065 70
6065 80
6064 40
6064 50
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION EQUALS
SORT FIELDS=(1,4,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,4,
TRAILER3=(1,5,TOT=(6,2,ZD)))
//* |
Hope this helps... |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Quote: |
Thanks khamarutheen
its working for me
|
nmr,
Above code doesnot give proper results.
Kolusu's solution is working fine.
Regards,
KSK |
|
Back to top |
|
|
nmr
New User
Joined: 27 Sep 2007 Posts: 14 Location: hyderabad
|
|
|
|
ksk or kolusu
if you do not mind can u tell me the meaning of below code what it does,
because i am not aware of sort
OPTION EQUALS
SORT FIELDS=(1,4,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,4,
TRAILER3=(1,5,TOT=(6,2,ZD))) |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
i am not aware of sort |
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
sreenivasreddyg
New User
Joined: 23 Apr 2005 Posts: 39 Location: delhi
|
|
|
|
What happens if that field is comp-3. SORT will add the amoutns in this case also? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
What happens if that field is comp-3. SORT will add the amoutns in this case also? |
Sort will add the amounts if you define the positions as packed-decimal (for COMP-3 fields) rather than zoned-decimal. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
|