View previous topic :: View next topic |
Author |
Message |
abracadabra Beginner
Joined: 02 Sep 2003 Posts: 101 Topics: 55 Location: India
|
Posted: Mon Jun 27, 2005 2:21 pm Post subject: Sort to use last record of each series |
|
|
Hi,
If I have the following set of records
ABC123.11
ABC456.22
ABC789.33
XYZ234.43
XYZ456.66
I want the last record of ABC and the last record of XYZ and so on...EQUALS in combination with SUM FIELDS=NONE gives the first record only.
I can do this in 2 steps easily. However, is there any syntax which would help me do that in 1 step?
Before kolusu gets angry, I would like to inform that I have given a search and have not found a similar problem. I have found problems where only the last record has been picked but not the way I want.
Thanks _________________ Cheers! |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12383 Topics: 75 Location: San Jose
|
Posted: Mon Jun 27, 2005 2:42 pm Post subject: |
|
|
Abracadabra,
The following DFSORT/ICETOOL JCL will give you the desired results. If your shop has syncsort then change the pgm name to synctool.
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ABC123.11
ABC456.22
ABC789.33
XYZ234.43
XYZ456.66
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,3,CH) LAST
/*
|
This would produce
Code: |
ABC789.33
XYZ456.66
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
abracadabra Beginner
Joined: 02 Sep 2003 Posts: 101 Topics: 55 Location: India
|
Posted: Mon Jun 27, 2005 3:04 pm Post subject: |
|
|
Kolusu,
I tried doing what you said except that I have used an input file and an output file for IN and OUT. Am getting an error code of '20' with no other message at all. The reason I used an input file was because the data is large and not just limited to 5 records.
Thanks _________________ Cheers! |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12383 Topics: 75 Location: San Jose
|
Posted: Mon Jun 27, 2005 3:09 pm Post subject: |
|
|
Quote: |
I tried doing what you said except that I have used an input file and an output file for IN and OUT. Am getting an error code of '20' with no other message at all.
|
abracadabra,
The reason you are getting that error is because you did not code the TOOLMSG & DFSMSG DD statements in your JCL. Just try to run the sample JCL provided and and let us know if you have any problems.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
abracadabra Beginner
Joined: 02 Sep 2003 Posts: 101 Topics: 55 Location: India
|
Posted: Mon Jun 27, 2005 3:16 pm Post subject: |
|
|
Great Thanks Kolusu!! _________________ Cheers! |
|
Back to top |
|
 |
|
|