IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Need Help in Sort


 
IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: :: View next topic  
Author Message
rajeevdas03
Warnings : 1

New User


Joined: 21 Jan 2006
Posts: 19
Location: Mumbai

PostPosted: Thu May 09, 2013 7:09 am
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1566
Location: Andromeda Galaxy

PostPosted: Thu May 09, 2013 8:23 am
Reply with quote

Rajeev,


Your requirement need to be explained better for useful replies

Also let us know the sort product used
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6251
Location: Mumbai, India

PostPosted: Thu May 09, 2013 1:27 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10695
Location: italy

PostPosted: Thu May 09, 2013 1:48 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Thu May 09, 2013 1:56 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1566
Location: Andromeda Galaxy

PostPosted: Thu May 09, 2013 4:18 pm
Reply with quote

Also how do want to write the output ?

row wise or column wise?
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10695
Location: italy

PostPosted: Thu May 09, 2013 4:31 pm
Reply with quote

Quote:
row wise or column wise?
icon_eek.gif

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 icon_cool.gif
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1566
Location: Andromeda Galaxy

PostPosted: Thu May 09, 2013 4:34 pm
Reply with quote

I was asking that because TS said a1,a2

I was also wondering this what if file has duplicates icon_confused.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> JCL & VSAM
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
No new posts Copying data from prev record using SORT SYNCSORT 19
No new posts Combining more 4 files with sorted or... DFSORT/ICETOOL 3
This topic is locked: you cannot edit posts or make replies. Parsing more than 1000 columns in a s... SYNCSORT 10
This topic is locked: you cannot edit posts or make replies. SORT the records based on the second ... SYNCSORT 1

Back to Top