View previous topic :: View next topic |
Author |
Message |
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Tue Jun 26, 2007 1:42 am Post subject: find summation for a particular field in a file using sort |
|
|
Hi everybody,
My requirement is that I have the file given below:
input: Code: |
1-10 11-15
xxxxxxxx 15
yyyyyyyy 16
aaaaaaaa 17
.
..
sum xxxx
|
output: Code: |
xxxxxxxx 15
yyyyyyyy 16
aaaaaaaa 17
.
..
sum summation
summation=(15+16+17....)
|
Any help is highly appreciated |
|
Back to top |
|
|
krisprems Beginner
Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Tue Jun 26, 2007 3:32 am Post subject: |
|
|
Hi computer
nice that i am speaking to a computer
Do you want the summation of the second filed as a trailer record? _________________ cHEERs
krisprems |
|
Back to top |
|
|
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Tue Jun 26, 2007 3:47 am Post subject: |
|
|
I dont need any header or trailer
My reqiurement is only to sum the field and display in the sum 's field which is to be present in outtput as present in input |
|
Back to top |
|
|
krisprems Beginner
Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Tue Jun 26, 2007 4:37 am Post subject: |
|
|
computer
For the i/p that you have shown, this should work fine.
Code: | //*******************************************************
//STEP1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD *
XXXXXXXX 15
YYYYYYYY 16
AAAAAAAA 17
SUM XXXX
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OMIT COND=(1,3,CH,EQ,C'SUM')
OUTFIL REMOVECC,
TRAILER1=('SUM=',TOT=(11,2,ZD,M11,LENGTH=8))
/*
|
SORTOUT conatins
Code: | XXXXXXXX 15
YYYYYYYY 16
AAAAAAAA 17
SUM=00000048
|
_________________ cHEERs
krisprems |
|
Back to top |
|
|
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Tue Jun 26, 2007 10:27 am Post subject: |
|
|
thanks krisprems,
its working fine |
|
Back to top |
|
|
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Tue Jun 26, 2007 10:41 am Post subject: |
|
|
Can anybody tell me 'M11' in the above sort card. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
|
Back to top |
|
|
krisprems Beginner
Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Tue Jun 26, 2007 12:35 pm Post subject: |
|
|
Quote: | Can anybody tell me 'M11' in the above sort card. |
computer
You are welcome.
This link to "z/OS DFSORT: Getting Started" will answer ur question _________________ cHEERs
krisprems |
|
Back to top |
|
|
|
|