Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Sum a particular field in vsam

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to Sum a particular field in vsam
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Sep 01, 2006 8:46 pm    Post subject:
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:

http://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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Underlying DB2 VSAM LDS - SMF recording vasanthz All Other Mainframe Topics 6 Thu Jan 05, 2017 4:20 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us