View previous topic :: View next topic
|
Author |
Message |
nitesh.mulay
New User
Joined: 30 May 2006 Posts: 10 Location: Pune
|
|
|
|
I have two files both of the same layout
eg :
File 1 :-
Key Field to sumup
H1111 000 000 123
H2222 000 000 777
File 1 :-
H1111 000 000 456
H2222 000 000 789
H3333 000 000 548
hear the key is H1111 and while copying into the third file ,if the key is same in both the records, i want to retain only the record in file 1 but sum up the fields 123 & 456 in that column
I want to use Sort utility for this
can any one suggest me a sort card for the same |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a simple SORT/SUM for this like the DFSORT job below. However, note that for your H2222 records, 777+789 will overflow 3 digits so both records will be kept. You need to indicate what you want to do about overflow.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
H1111 000 000 123
H2222 000 000 777
/*
// DD *
H1111 000 000 456
H2222 000 000 789
H3333 000 000 548
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION EQUALS
SORT FIELDS=(1,5,CH,A)
SUM FIELDS=(15,3,ZD)
/*
|
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
nitesh.mulay
New User
Joined: 30 May 2006 Posts: 10 Location: Pune
|
|
|
|
Thanks for the reply Frank
i had few more questions
1) can this be done using Sort Utility insted of ICEMAN
2) Will this create any problem if the fields to be summed off has a declaration of s9(5)v99, in this case in the sort card should the length be given as (starting position , 7) |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
can this be done using Sort Utility insted of ICEMAN |
PGM=ICEMAN and PGM=SORT both use DFSORT. So your question doesn't make any sense. Use PGM=SORT instead of PGM=ICEMAN if you like - there's no difference between them.
Quote: |
Will this create any problem if the fields to be summed off has a declaration of s9(5)v99, in this case in the sort card should the length be given as (starting position , 7) |
Yes, for S9(5)v99, you would use a length of 7. |
|
Back to top |
|
|
nitesh.mulay
New User
Joined: 30 May 2006 Posts: 10 Location: Pune
|
|
|
|
Thanks a lot frank for this info i tried out with SORT and it is working fine |
|
Back to top |
|
|
|