View previous topic :: View next topic
|
Author |
Message |
Abhushan_s
New User
Joined: 28 Jul 2008 Posts: 34 Location: Ahmedabad
|
|
|
|
Hi,
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Abhushan_s
New User
Joined: 28 Jul 2008 Posts: 34 Location: Ahmedabad
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Abhushan_s
New User
Joined: 28 Jul 2008 Posts: 34 Location: Ahmedabad
|
|
|
|
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 |
|
|
nelson.pandian
Active User
Joined: 09 Apr 2008 Posts: 133 Location: Phoenix, AZ
|
|
|
|
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 |
|
|
Abhushan_s
New User
Joined: 28 Jul 2008 Posts: 34 Location: Ahmedabad
|
|
|
|
Thank you Nelson, Frank. |
|
Back to top |
|
|
|