MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort to use last record of each series

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
abracadabra
Beginner


Joined: 02 Sep 2003
Posts: 101
Topics: 55
Location: India

PostPosted: Mon Jun 27, 2005 2:21 pm    Post subject: Sort to use last record of each series Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12383
Topics: 75
Location: San Jose

PostPosted: Mon Jun 27, 2005 2:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
abracadabra
Beginner


Joined: 02 Sep 2003
Posts: 101
Topics: 55
Location: India

PostPosted: Mon Jun 27, 2005 3:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12383
Topics: 75
Location: San Jose

PostPosted: Mon Jun 27, 2005 3:09 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
abracadabra
Beginner


Joined: 02 Sep 2003
Posts: 101
Topics: 55
Location: India

PostPosted: Mon Jun 27, 2005 3:16 pm    Post subject: Reply with quote

Great Thanks Kolusu!!
_________________
Cheers!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group