MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compare 2 files without sorting excluding some fields

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Tue Aug 08, 2006 9:51 pm    Post subject: Compare 2 files without sorting excluding some fields Reply with quote

Hi ,

I'm having this problem and have been unable to crack it.

Ex:- I have 100k records in 2 files which need to be compared.

I need to match all the fields except for COLS 118:125

File 1: -
x1
x2
x3
x4
.
.
.
.
.
.
x100K

File 2 :- ( The problem here is that X1,X2 .. .records cannot be sorted as there are other records which are created dynamically... ( using the run time of the job).

Here's the file looks like..

x99
x89
x71
.
.
.
.
.
x1
.
.
.
.
.
.
x2

Now is there a way I can compare these two files.

IN general is there a way to compare 2 records If they are not sorted? I may sound stupid... But this really something that has eaten away lot my time...

I tried to solve this by using INSYNC utility, But it didn't solve the problem.

- Martin
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Aug 09, 2006 7:17 am    Post subject: Reply with quote

Quote:

records cannot be sorted as there are other records which are created dynamically... ( using the run time of the job).
IN general is there a way to compare 2 records If they are not sorted? I may sound stupid... But this really something that has eaten away lot my time...


so you want to compare line 1 of file 1 with line 1 of file 2 , line2 with line 2 and so on ?

If that is the case you can simply add a seqnum at the end of record using SEQNUM and use that as the key and compare the files.

Kolusu

PS: Try to be more descriptive with your topic titles. A simple "sort problem" is too generic. An approriate title would "Compare 2 files without sorting excluding some fields". I am changing the title.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Wed Aug 09, 2006 12:33 pm    Post subject: Reply with quote

Kolusu,

The porblem here is :-

File 1 is sorted and File 2 cannot be sorted, Becasue of the time paramater.

So .. Is there a way to compare a sorted file with an unsorted one ?

X1 is the first line in File1... But the same can 100 rec or 1000 rec on file 2.

Gotta.. I will be more careful while choosing the titles. Exclamation

- Martin
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Aug 09, 2006 2:11 pm    Post subject: Reply with quote

Martin,

After compare, what is that you want to do? Give a description of what you would want in the output?
________
silversurfer reviews


Last edited by coolman on Sat Feb 05, 2011 1:46 am; edited 1 time in total
Back to top
View user's profile Send private message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Wed Aug 09, 2006 2:24 pm    Post subject: Reply with quote

coolman,

I want write out the non matching records on to flat file.

Out put file:-

File 1 - Rec # abc
XXXXXXXXXXXXXXXXXXXXXXXXXX

File 2 - Rec # xyz
XXXXXXXXXXXXXXXXXXXXAXXXXX

- Martin
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Aug 09, 2006 3:00 pm    Post subject: Reply with quote

Martin,

Here's my suggestion on how to do it:

1. Pad '1' and SEQNUM for file 1 , '2' and SEQNUM for file2

Code:

  INREC FIELDS=(1,80,C'1',SEQNUM,8,ZD)
  INREC FIELDS=(1,80,C'2',SEQNUM,8,ZD)



2. Merge files 1 and 2
3. SELECT FROM(CON) TO(IN1) ON(1,2,CH) NODUPS
4.From IN1,
Code:

     SORT FIELDS=(82,8,ZD,A)
     OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1')
     OUTFIL SAVE,FNAMES=OUT2
 


OUT1 - would contain non matching records from file 1
OUT2 - would contain non matching records from file 2
________
easy vape


Last edited by coolman on Sat Feb 05, 2011 1:46 am; edited 1 time in total
Back to top
View user's profile Send private message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Sun Aug 13, 2006 3:49 am    Post subject: Reply with quote

Hi All,

Now there is a new requirement where in the new fields will be inserted into file 1 as well ( these new fields are synamically generated using the run time).

Can any one help me with this.

- Martin
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Mon Aug 14, 2006 8:15 am    Post subject: Reply with quote

Martin,

Post an example of your input and output that you are looking for.
________
Hino Dutro
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group