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 the records of a file matching the key in other file
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Vish
Beginner


Joined: 17 Sep 2003
Posts: 21
Topics: 9
Location: Mumbai India

PostPosted: Wed Oct 01, 2003 7:13 am    Post subject: Select the records of a file matching the key in other file Reply with quote

Friends,

I have one transaction file contains 20 fields in each record.The first field in the file is the account number. I have another file containing only active account numbers.
My requirement is to select the transaction records of which the account number matches with the second file. Is this possible by SORT utility ?
Or any other method of doing this apart from writing the program.

Thanks,
_________________
Vish
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Oct 01, 2003 7:37 am    Post subject: Reply with quote

Vish,

Did you check out this topic??

http://www.mvsforums.com/helpboards/viewtopic.php?t=11

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Oct 01, 2003 10:32 am    Post subject: Reply with quote

Vish,

If you want more specific help on doing this with DFSORT/ICETOOL, show an example of your input records for the two files, and what you want the output records to look like. Also tell me the RECFM and LRECL of the input files, the starting position and length of the account number in each file, and whether you can have duplicate records within each file.
_________________
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
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Tue Oct 07, 2003 2:24 am    Post subject: Reply with quote

I think coding EZTreive 'MATCH' will be the simplest solution.
Back to top
View user's profile Send private message Send e-mail
Vish
Beginner


Joined: 17 Sep 2003
Posts: 21
Topics: 9
Location: Mumbai India

PostPosted: Tue Nov 11, 2003 12:17 pm    Post subject: Reply with quote

Hi Frank,
File A looks like below. Assume first 3 characters constitute key.
200 PETER BANGALORE
300 LILLY MUMBAI
500 TONY DELHI

File B which contains the keys only.
100
300
400
500
600
700

The output file is
300 LILLY MUMBAI
500 TONY DELHI

The records of File A should be written in the output if the key matches with the key in File B.

Thanks
Vish
_________________
Vish
Back to top
View user's profile Send private message
Vish
Beginner


Joined: 17 Sep 2003
Posts: 21
Topics: 9
Location: Mumbai India

PostPosted: Tue Nov 11, 2003 12:29 pm    Post subject: Reply with quote

Hi Frank,
Sorry for missing the LRECL and RECFM in the previous post.
Record length is 80 and Record format is Fixed length.
Thanks,
_________________
Vish
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: Tue Nov 11, 2003 2:23 pm    Post subject: Reply with quote

Vish,

This DFSORT/ICETOOL job will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//CON DD DSN=...  input fileA
//    DD DSN=...  input fileB
//OUT DD DSN=...  output file
//TOOLIN DD *
  SELECT FROM(CON) TO(OUT) ON(1,3,CH) FIRSTDUP
/*

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


Joined: 06 Dec 2002
Posts: 117
Topics: 44
Location: Chennai,India

PostPosted: Mon Jan 05, 2004 6:26 am    Post subject: Reply with quote

Frank,

Can you please explain the function of "ON(1,3,CH) FIRSTDUP".

Thanks,
Ravikumar.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jan 05, 2004 9:49 am    Post subject: Reply with quote

Ravikumar,

Straight from the manual the parm FIRSTDUP on SELECT statement Limits the records selected to the first record of those with [b]ON[b] i.e (1,3) values that occur more than once (value count > 1). You can use this operand to keep just the first record of those records with duplicate field values.

The manual can be accessed here

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/CCONTENTS

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
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Mon Jan 05, 2004 10:21 am    Post subject: Reply with quote

Ravikumar,

ON(1,3,CH) tells DFSORT/ICETOOL you want to select records based on the character values in positions 1-3. FIRSTDUP tells DFSORT/ICETOOL that you only want to select the first record for each set of duplicates. So if you had the following input records:

Code:

ZQX R1
RST R1
ABC R1
ABC R2
DEF R1
RST R2
GHI R1
ABC R3
GHI R2


your output with ON(1,3,CH) FIRSTDUP would be:

Code:

ABC R1
GHI R1
RST R1


For more information on all of the parameters you can use with the SELECT operator of DFSORT's ICETOOL, see:

http://www.storage.ibm.com/software/sort/mvs/icetool/online/srtmtsel.html
_________________
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
ravikumar_sri2001
Beginner


Joined: 06 Dec 2002
Posts: 117
Topics: 44
Location: Chennai,India

PostPosted: Tue Jan 06, 2004 10:28 am    Post subject: Reply with quote

Kolusu/Frank,
Thanks for your explanation.

Frank,

As your o/p shows, the o/p file is sorted based on the key filed.
Will ICETOOL preserve the order from i/p file if two records has the same key while
giving FIRSTDUP.

I/P :

ABC R2
ABC R1
GHI R2
GHI R1

O/P :

ABC R2
GHI R2

Thanks,
Ravikumar.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 06, 2004 10:45 am    Post subject: Reply with quote

Ravikumar,

yes it does preserve the order as SELECT operator of DFSORT's ICETOOL has OPTION EQUALS as default.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Tue Jan 06, 2004 11:17 am    Post subject: Reply with quote

Ravikumar,

Kolusu is correct. The SELECT operator of DFSORT's ICETOOL passes the EQUALS option to DFSORT telling it to preserve the original order of duplicate records.
_________________
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
ravikumar_sri2001
Beginner


Joined: 06 Dec 2002
Posts: 117
Topics: 44
Location: Chennai,India

PostPosted: Wed Jan 07, 2004 11:49 am    Post subject: Reply with quote

Kolusu/Franks

Thanks for your explanation.
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Mar 31, 2004 8:52 am    Post subject: Reply with quote

Hello Frank Yaeger
In our shop we are using ICETOOL and FIRSTDUP is not working.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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