Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need Help in Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Need Help in Sort
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: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 09, 2013 8:23 am    Post subject:
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: 6258
Location: Mumbai, India

PostPosted: Thu May 09, 2013 1:27 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu May 09, 2013 1:48 pm    Post subject: Reply to: Need Help in Sort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu May 09, 2013 1:56 pm    Post subject: Reply to: Need Help in Sort
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: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 09, 2013 4:18 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu May 09, 2013 4:31 pm    Post subject: Reply to: Need Help in Sort
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: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 09, 2013 4:34 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us