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

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Mon Feb 09, 2009 8:12 pm
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
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 Developer


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

PostPosted: Mon Feb 09, 2009 11:02 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top