View previous topic :: View next topic
|
Author |
Message |
arun23kiran
New User
Joined: 01 Sep 2006 Posts: 3
|
|
|
|
Hi,
Can anyone of you let me know how i can find the sum of a particular field in a vsam file? If possible, can you give me that piece of code? |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
I think you can repro the VSAM file into a sequential data set and then sort it into snother by using SUM FIELDS option |
|
Back to top |
|
|
arun23kiran
New User
Joined: 01 Sep 2006 Posts: 3
|
|
|
|
hi prasad,
I want to do it directly on the VSAM file instead of using a repro and then using sum fields option. Is there any way out? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use DFSORT directly for VSAM files. If the VSAM records are all fixed length, you can use this:
Code: |
RECORD TYPE=F
SORT FIELDS=(p,m,f,s)
SUM FIELDS=(p,m,f)
|
If the VSAM records are variable length, you can use this:
Code: |
RECORD TYPE=V
SORT FIELDS=(p+4,m,f,s)
SUM FIELDS=(p+4,m,f)
|
Note that with TYPE=V you need to add 4 to the starting position to account for the 4-byte RDW that DFSORT prepends temporarily to each record.
For more information on using VSAM data sets with DFSORT, see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/1.8.3.4?SHELF=&DT=20060615185603&CASE= |
|
Back to top |
|
|
arun23kiran
New User
Joined: 01 Sep 2006 Posts: 3
|
|
|
|
hi Frank,
Thanks very much. |
|
Back to top |
|
|
|