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 

Select by priority number in 1 step

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


Joined: 05 Oct 2005
Posts: 5
Topics: 3
Location: Near Detroit

PostPosted: Wed Dec 12, 2007 4:57 pm    Post subject: Select by priority number in 1 step Reply with quote

Is it possible to select 1 record from duplicates based on a priority field in only 1 step? The file contains a few million records so we would like to pass it through the fewest number of steps.

Specs:
Select the highest priority of each ID record set.
The ID and priority fields may be duplicated.
Not all priority values will be present.
IDs are listed in no set order.
Priorities in no set order.
ID and Priority fields are not adjacent.

Example:
Input
Code:

02 xx 1
01 xx 3
02 xx 2
01 xx 2
02 xx 1
02 xx 3
02 xx 2
01 xx 2

Output
Code:

01 xx 2
02 xx 1

Using DFSORT and Sum Fields leaves us with multiple priority records for each ID.
Using ICETOOL and Select ON(ID) and ON(PRIORITY) also leaves us with multiple priority records.

If we sort the output by ID with Sum Fields=None and Equals, it will give us the required output, but we may still be sorting a couple million records.

Any other ways?

Thanks for the help,
_________________
Glenn
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 Dec 12, 2007 5:09 pm    Post subject: Reply with quote

You can use a DFSORT/ICETOOL job like this to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
02 xx 1
01 xx 3
02 xx 2
01 xx 2
02 xx 1
02 xx 3
02 xx 2
01 xx 2
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,2,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,2,CH,A,7,1,CH,A)
/*

_________________
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
b540glenn
Beginner


Joined: 05 Oct 2005
Posts: 5
Topics: 3
Location: Near Detroit

PostPosted: Thu Dec 13, 2007 9:25 am    Post subject: Reply with quote

I forgot all about the CTL1 option. Embarassed

It works perfectly.

Thank You,
_________________
Glenn
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