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

comparing a field in two files using sort card


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pavani G

New User


Joined: 21 Apr 2010
Posts: 10
Location: Hydearabad

PostPosted: Wed May 12, 2010 2:03 pm
Reply with quote

Hi,

I have two files with LRECL=236, I want to compare a specific field in each record of file1 with each record in file2. if there is more than one hit in file2 then delete the matched records in file2 by keeping only one record for that field. Is there any way of doing this using Sort card.

your help is really appreciated.



Thanks,
Pavani
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 12, 2010 2:09 pm
Reply with quote

YES. But you need need to provide following...

1 What is sort product you are using at your shop?

2 Show sample records with( relevant fields only) expected output for the same

3 RECFM for the files?

4 length\position of the key value.

5: Can file1 have duplicates?
Back to top
View user's profile Send private message
Pavani G

New User


Joined: 21 Apr 2010
Posts: 10
Location: Hydearabad

PostPosted: Wed May 12, 2010 3:13 pm
Reply with quote

find the below answers
RECFM=FB
the field length is 17 bytes
FILE1
01010101 202
03030303 303
89467236 890

FILE2
01010101 202
01010101 202
01010101 202
43256700 786
64352767 876
03030303 303
03030303 303
89467236 890
89467236 890
89467236 890
89467236 890
11111111 765
the expected o/p file should have
01010101 202
43256700 786
64352767 876
03030303 303
89467236 890
11111111 765

is there any way of acheving above using JCL


Thanks,
Pavani
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 12, 2010 3:23 pm
Reply with quote

Where file one is playing any role here? Output you have shown is just file2 records without duplicates...
Now show the ouput with same file1 and
file2 as
Code:

01010101 202
01010101 202
01010101 202
43256700 786
64352767 876
03030303 303
03030303 303
89467236 890
89467236 890
89467236 890
89467236 890
11111111 765
11111111 765
11111111 765

Basically I have added duplicates for records not present in file1

Also you have not answered all of my questions...
Back to top
View user's profile Send private message
Pavani G

New User


Joined: 21 Apr 2010
Posts: 10
Location: Hydearabad

PostPosted: Wed May 12, 2010 3:41 pm
Reply with quote

The output should be
01010101 202
03030303 303
89467236 890
64352767 876
43256700 786
11111111 765
11111111 765
11111111 765
basically i have all unwanted records in file1. I jus want to chk whether that unwanted rec is present more than once in file2. the file2 should have all unwanted records only once along with other records of file2.
instead of writing a cobol pgm i am jus trying it using a jCL.
Back to top
View user's profile Send private message
Pavani G

New User


Joined: 21 Apr 2010
Posts: 10
Location: Hydearabad

PostPosted: Wed May 12, 2010 3:43 pm
Reply with quote

file1 will not have any duplicates
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed May 12, 2010 6:28 pm
Reply with quote

Pavani G,

Its not clear what you have told. What about file-2 records which do NOT have a match in file-1 and which are duplicates? Show a complete example with all possible scenarios.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 13, 2010 6:19 am
Reply with quote

Hello,

Quote:
1 What is sort product you are using at your shop?
And still the first question is unanswered.

If you want help from the forum, you have to provide the requested info. . .
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top