View previous topic :: View next topic
|
Author |
Message |
rajeevdas03 Warnings : 1 New User
Joined: 21 Jan 2006 Posts: 19 Location: Mumbai
|
|
|
|
Hi,
Please help me in sort.
example;
file1; a1
a2
a3
a4 and so on..
file 2;a1
a1
a2
a2
a3
a4 and so on
my requirement is to find how many records from file1 is having 2 times entry in file2
output should be a1,a2
Thanks for your help. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Rajeev,
Your requirement need to be explained better for useful replies
Also let us know the sort product used |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
And will the 'entry' be always two times:
Quote: |
my requirement is to find how many records from file1 is having 2 times entry in file2 |
- if the 'entry' is 3 - you don't want to consider it? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
pretty easy in two steps ...
step 1 to count ... occurrences for file2
something like ( adjust for Your environment )
Code: |
000004 //s EXEC PGM=SORT
000005 //SYSOUT DD SYSOUT=*
000006 //SYSPRINT DD SYSOUT=*
000007 //SORTIN DD *
000008 AAAA
000009 BBBB
000010 BBBB
000011 CCCC
000012 CCCC
000013 CCCC
000014 EEEE
000015 EEEE
000016 FFFF
000017 FFFF
000018 FFFF
000019 FFFF
000020 //SORTOUT DD SYSOUT=*
000021 //SYSIN DD *
000022 SORT FIELDS(01,4,CH,A)
000023 INREC OVERLAY=(11:C'0001')
000024 SUM FIELDS(11,4,ZD)
000025 OUTFIL OMIT=(11,4,ZD,NE,2)
|
step 2 use join key to match with file 1 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, the two steps can be done in one, using JNFnCNTL (if DFSORT, or SyncSort with support for JNFnCNTL).
Subject to a full description of the problem, it is straightforward with what enrico has suggested, just "compressed into one step" if possible, else as two. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Also how do want to write the output ?
row wise or column wise? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
row wise or column wise? |
what if the number of matching records
( in file 1 and with 2 occurrences in file 2 )
was - let' s shoot a random number - 300.000 |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
I was asking that because TS said a1,a2
I was also wondering this what if file has duplicates |
|
Back to top |
|
|
|