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 and PICK ONLY First Record

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


Joined: 28 Feb 2005
Posts: 80
Topics: 26

PostPosted: Wed Oct 31, 2007 11:47 am    Post subject: SORT and PICK ONLY First Record Reply with quote

Input File:
Code:
----+----1----+----2----+----3----+----4-
********************************* Top of
0015007510300000621012000-09-262000-10-18
0015007510300000621012000-10-189999-12-31
0015007510300000629732000-09-269999-12-31
0015007510300001301012001-10-022001-10-25
0015007510300001301012001-10-259999-12-31
0015007510300001309732001-10-029999-12-31


- Need to SORT Descending on Positions 1-18, 22-31,32-41
- Then check for the recent date and produce 1 row for every identical numbers in between 1 and 18 positions

For E.G., there are 3 rows with 001500751030000062 in the input file, in the output file I need to write ONLY 1 row that have the date of 2000-10-189999-12-31

Based on the E.G., this is how the output is expected

Code:
----+----1----+----2----+----3----+----4-
********************************* Top of
0015007510300000621012000-10-189999-12-31
0015007510300001301012001-10-259999-12-31


Please let me know your thoughts.
Back to top
View user's profile Send private message
sakreg
Beginner


Joined: 28 Feb 2005
Posts: 80
Topics: 26

PostPosted: Wed Oct 31, 2007 11:55 am    Post subject: Reply with quote

Missed to add this,

In the input file, I should exclude the First and Last rows from the SORT, they are the header and trailer.

There is a feature with ICETOOL to include or exclude DUPLICATES like

SELECT FROM(IN01) TO(OUT1) ON(1,18,BI) NODUPS
SELECT FROM(IN01) TO(OUT2) ON(1,18,BI) ALLDUPS

But Is there a way to pick only the first row for every matching rows based on any given condition?
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Oct 31, 2007 11:58 am    Post subject: Reply with quote

FYI, for those interested, according to previous topics, sakreg is using SYNCSORT.
Back to top
View user's profile Send private message
sakreg
Beginner


Joined: 28 Feb 2005
Posts: 80
Topics: 26

PostPosted: Wed Oct 31, 2007 12:04 pm    Post subject: Reply with quote

superk wrote:
FYI, for those interested, according to previous topics, sakreg is using SYNCSORT.


superk,

I am using ICETOOL

//TOOLIN DD *
SELECT FROM(IN01) TO(FSALIDA) ON(1,18,BI) NODUPS
SELECT FROM(IN01) TO(FSALID2) ON(1,18,BI) ALLDUPS
//*

My Assumption is there should be something like FIRST instead of NODUPS or ALLDUPS to use, But I am NOT SURE !
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Oct 31, 2007 12:56 pm    Post subject: Reply with quote

Quote:
My Assumption is there should be something like FIRST instead of NODUPS or ALLDUPS to use, But I am NOT SURE !


Yes, FIRST is an operator of SELECT. Why didn't you just try using FIRST given that you thought it might be available?

Quote:
I am using ICETOOL


If you're using DFSORT, then you're using DFSORT's ICETOOL (ICE messages). If you're using Syncsort, then you're using Syncsort's SYNCTOOL (SYT messages). Are you using DFSORT or Syncsort?

Quote:
In the input file, I should exclude the First and Last rows from the SORT, they are the header and trailer.


If you can identify the header and trailer in some way, you can just use an OMIT statement to exclude them. SKIPREC=1 can also be used to exclude the first record. Excluding the last record is tricker if you can't identify it in some way.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sakreg
Beginner


Joined: 28 Feb 2005
Posts: 80
Topics: 26

PostPosted: Wed Oct 31, 2007 1:23 pm    Post subject: Reply with quote

This is CLOSED, operator FIRST worked as expected Very Happy

Thank You Frank Yaeger and superk
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