IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to Sum a particular field in vsam


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arun23kiran

New User


Joined: 01 Sep 2006
Posts: 3

PostPosted: Fri Sep 01, 2006 6:41 pm
Reply with quote

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
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Fri Sep 01, 2006 7:44 pm
Reply with quote

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
View user's profile Send private message
arun23kiran

New User


Joined: 01 Sep 2006
Posts: 3

PostPosted: Fri Sep 01, 2006 7:51 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Sep 01, 2006 8:46 pm
Reply with quote

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
View user's profile Send private message
arun23kiran

New User


Joined: 01 Sep 2006
Posts: 3

PostPosted: Sat Sep 02, 2006 12:14 am
Reply with quote

hi Frank,

Thanks very much.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts CVDA value for RRDS VSAM dataset. CICS 2
Search our Forums:

Back to Top