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
 

 

Want to Add all the record of a particular Field in the file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Mon Feb 09, 2009 12:37 pm    Post subject: Want to Add all the record of a particular Field in the file
Reply with quote

Hi, icon_lol.gif

I want to Add all the record values in a particular field in a file, i dont have the sort job for that, i believe we have a sort job for that, i mean the program used for that is DFSORT, could anyone please give me the sort card details for it?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Feb 09, 2009 8:12 pm    Post subject:
Reply with quote

Hello,

Post the definition of the record/fields that would be used for your process as well as the recfm and lrecl of the file. Post some sample data and the result you want from this process. These do not need to be full-length records, only enough to show what you want.
Back to top
View user's profile Send private message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Mon Feb 09, 2009 8:23 pm    Post subject: Reply to: Want to Add all the record of a particular Field i
Reply with quote

Eg.,

Code:

FIELD-A              FIELD-B              FIELD-C
---------            ---------            ----------
AAAAAA               1000                     A
AAAAAB               2000                     C
AAAACS               3000                     X
AAAASO               4000                     E
SSAADA               5000                     F


I need to find the summation of the field FIELD-B, which should be 15000, we can do this having a SUM FIELD=() with some condition which will reorder the records for those fields which are unique and then have SUM FILEDS =() the fields whose sum is to be calculated, but then what if we donot have any field which doesnt have any unique values.
I hope this example helps.
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: Mon Feb 09, 2009 11:02 pm    Post subject:
Reply with quote

You didn't show what you wanted for output, so I assumed you just wanted one line with the total. Here's a DFSORT job that will do it:

Code:

//S1    EXEC  PGM=SORT                                 
//SYSOUT    DD  SYSOUT=*                               
//SORTIN DD *                                         
AAAAAA               1000                     A       
AAAAAB               2000                     C       
AAAACS               3000                     X       
AAAASO               4000                     E       
SSAADA               5000                     F       
/*
//SORTOUT DD SYSOUT=*                                 
//SYSIN    DD    *                                     
  OPTION COPY                                         
  OUTFIL REMOVECC,NODETAIL,                           
    TRAILER1=(TOT=(22,4,ZD,TO=ZD,LENGTH=5))           
/*


If that's not what you want for output, then you need to show what you do want for output.
Back to top
View user's profile Send private message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Tue Feb 10, 2009 11:29 am    Post subject:
Reply with quote

Hey thanks for the reply Frank,

Yes i need just the output as the result, i.,e the sum, but here i provided you with a hard-coded value, but it was just an example, i just meant to say that i have a PS that is having say 3 fields and there are some 1 million records, so it is obvious that may not be able to hardcode them , so then what could o do just give the Input and the ouput instead of the Hard-coding?
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Tue Feb 10, 2009 1:01 pm    Post subject:
Reply with quote

Abhushan,

The DFSORT JCL can be changed as per your requirement. So removing the hard coding and specify your input file as you specify in general jcl.
Back to top
View user's profile Send private message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Tue Feb 10, 2009 4:32 pm    Post subject:
Reply with quote

Thank you Nelson, Frank. icon_smile.gif
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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