IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
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

Superior Member


Joined: 22 Apr 2006
Posts: 6250
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
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: 7309
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

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
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

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top