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 

2 file comparision using ICETOOL
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Fri Sep 15, 2006 3:18 pm    Post subject: 2 file comparision using ICETOOL Reply with quote

I need help to compare 2 files and create a third file that should contain only the changed records and new records, using ICETOOL or SORT.
Except the first 7 bytes any field value may change in File-2. All fields are alphanumeric and the file is 500 bytes fixed rec length.
Third file must be created from file-2.
Any help ASAP please !!!

FILE-1
Code:

1111111123456789A  01021999 
1111111987654321A  02031998 
2222222123456789A  03112000 
2222222987654321A  04121934 
3333333123456789A  05232006 
3333333987654321A  06132001 
4444444123456789A  06152002 
4444444333333333A  07222004 
5555555454545455A  08152003 
5555555123456789A  09172006 
6666666987654321A  04302005 
7777777123456789A  03222005 
7777777987654321A  01262001 


FILE- 2
Code:

1111111123456789Axx01021999
1111111987654321A  02031998
2222222123456789A  03112000
2222222121212122A  03112000
2222222987654321b  04121934
3333333123456789A  05212006
3333333987654321cyy07132001
4444444123456789A  06152002
4444444333333333A  07222004
5555555454545455d  08152003
5555555123456789A  09172006
6666666987654321A  05302005
7777777123456789A  03222005
7777777987654321A  01262001
8888888887654321A  01262001
9999999997654321A  01262001
8888888887654321A  01262001
2222222121212122A  03112000

The field lengths are as follows

Field-1: From 1, 7 bytes
Field-2: From 8, 10 bytes
Field-3: From 18, 2 bytes
Field-4: From 20, 2 bytes
Field-5: From 22, 2 bytes
Field-6: From 24, 2 bytes
Field-7: From 26, 2 bytes
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Sep 15, 2006 4:13 pm    Post subject: Reply with quote

It would have helped if you'd showed your expected output.

If I understand correctly, you want the records from file2 that are not in file1 based on the first 27 bytes. If so, here's a DFSORT/ICETOOL job that will give you that:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/500)
//IN2 DD DSN=...  input file2 (FB/500)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/500)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,27,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(501:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(501:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(501,1,CH,EQ,C'2'),
    BUILD=(1,500)
/*


For your input example, OUT would have:

Code:

1111111123456789Axx01021999
2222222987654321b 04121934 
3333333123456789A 05212006 
3333333987654321cyy07132001
5555555454545455d 08152003 
6666666987654321A 05302005 
9999999997654321A 01262001 

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Fri Sep 15, 2006 10:04 pm    Post subject: Reply with quote

Thank you for your immediate response. I will try with my input files and give you the feed back.
Back to top
View user's profile Send private message
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Mon Sep 18, 2006 1:20 pm    Post subject: Reply with quote

Quote:
Thank you for your immediate response. I will try with my input files and give you the feed back.

I missed to include some additional requirement.

(1) As a first step I want to eliminate the records that are common in both the Files. Then
(2) I need to add the date in ccyymmdd in last 8 bytes in all the records (for file - 1 previous month date and for File-2 current date)
(3) Also I need to find the file that is droped from FILE-2.

FILE- 1

1111111123456789A 01021999
1111111987654321A 02031998
2222222123456789A 03112000
2222222987654321A 04121934
3333333123456789A 05232006
3333333987654321A 06132001
4444444123456789A 06152002
4444444333333333A 07222004
5555555454545455A 08152003
5555555123456789A 09172006
6666666987654321A 04302005
7777777123456789A 03222005
7777777987654321A 01262001

FILE - 2
1111111123456789A 01021999
1111111987654321ALL02031998
2222222123456789A 03112000
2222222987654321A 04121934
3333333123456789A 05232006
3333333987654321A 06132001
4444444123456789A 06152002
5555555454545455A 08152003
5555555123456789A 09172006
6666666987654321A 04302005
7777777123456789A 03222005
7777777987654321A 01262001

I
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Sep 18, 2006 2:26 pm    Post subject: Reply with quote

Please show the expected output.

Please explain more clearly what you want to do.

Quote:
I want to eliminate the records that are common in both the Files.


Common on which positions?

Quote:
I need to add the date in ccyymmdd in last 8 bytes in all the records


You mean in positions 28-35 of the output records?

Quote:
I need to find the file that is droped from FILE-2.


You mean the "records that are dropped from File2"? What exactly does that mean? Once you "find" these records, what do you want to do with them?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Tue Sep 19, 2006 1:49 pm    Post subject: Reply with quote

In-File
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 19, 2006 2:46 pm    Post subject: Reply with quote

Your new post really doesn't clarify things. You didn't answer my previous questions and you didn't explain the rules for determining if a record was "dropped", "added" or "updated". And I still don't know which bytes you're matching on.

Quote:
Q) If I use
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Tue Sep 19, 2006 2:55 pm    Post subject: Reply with quote

I want to match the entire 500 bytes, if it is not possible, we may take first 7 bytes.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 19, 2006 3:23 pm    Post subject: Reply with quote

If I match the two files on 500 bytes, I get the following non-matching records:

Code:

4444444123456789A 06152002   
7777777987654321A 01262001   
7777777987654321BB 01262001   
8888888981614321A 01262001   


The first and second records are both from file1, but you label one "dropped" and remove the other one. The third and fourth records are both from file2, but you label one "updated" and one "added". You need to explain the rules you're using to determine if a record is "dropped", "updated" or "added". I suspect it has something to do with comparing other bytes than all 500, but I can't read your mind to tell what the rules are, so you need to clarify them. I'm trying to help, but you're not giving me enough to go on.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Tue Sep 19, 2006 3:59 pm    Post subject: Reply with quote

I need 2 output files like the following

Out-File
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 19, 2006 5:19 pm    Post subject: Reply with quote

Quote:
Now we may take the first 7 bytes as the key (that will not change)


If you use the first 7 bytes, then the only record without a match is the 8888888 record from file2 (e.g. you have two 4444444 records in file1 and one 4444444 records in file2, so those match). So you can't get the output records you show based on using 7 bytes as the key.

The only way I can make sense out of what you've shown so far is to use the following rules:

Compare the records in file1 vs file2 using all 500 bytes as the "key". Keep the records that don't match and apply these rules to them:
1. If the first 16 bytes are the same for a record from file1 and file2, but a byte anywhere in positions 17-500 is different for the two records, put the record from file2 in output file2 and mark it as "updated".
2. If the first 16 bytes are only found in a record from file1, put it in output file1 and mark it as "dropped"
3. If the first 16 bytes are only found in a record from file2, put it in output file2 and mark it as "added".

That's the kind of thing I mean when I ask for the rules.

By those rules, when we match on all 500 bytes, the non-matching records are:

Code:

4444444123456789A 06152002   
7777777987654321A 01262001   
7777777987654321BB 01262001   
8888888981614321A 01262001   


The first record satisfies rule 2.
The second and third records satisfy rule 1.
The fourth record satisfies rule 3.

If those are the rules you want to use, let me know. If those are not the rules you want to use, then tell me what rules you do want to use and show how they match the input and output records in your example.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Tue Sep 19, 2006 5:37 pm    Post subject: Reply with quote

Frank,

You are correct, these are the rules that i need to use. I have more than a dozen files with different key lengths to do the same process. Also there should not be any DUPS in the output files.

I think that is it.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 19, 2006 6:29 pm    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for based on the rules I specified.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/500)
//IN2 DD DSN=... input file2 (FB/500)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN=... output file1 (FB/500)
//OUT2 DD DSN=... output file2 (FB/500)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(1,500,CH) -
  KEEPNODUPS WITH(1,501) USING(CTL3)
SPLICE FROM(T2) TO(OUT1) ON(1,16,CH) -
  KEEPNODUPS WITH(1,501) USING(CTL4)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(501:C'11')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(501:C'22')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=T2,INCLUDE=(501,2,SS,EQ,C'11,22')
/*
//CTL4CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(501,2,CH,EQ,C'11'),
    IFOUTLEN=500,
    IFTHEN=(WHEN=INIT,OVERLAY=(30:C'''Dropped rec'''))
  OUTFIL FNAMES=OUT2,SAVE,
    IFOUTLEN=500,
    IFTHEN=(WHEN=(501,2,CH,EQ,C'21'),
      OVERLAY=(30:C'''Updated rec''')),
    IFTHEN=(WHEN=NONE,
      OVERLAY=(30:C'''Added rec'''))
/*


OUT1 has:

Code:

4444444123456789A 06152002   'Dropped rec'


OUT2 has:

Code:

7777777987654321BB 01262001  'Updated rec'   
8888888981614321A 01262001   'Added rec'     

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Tue Sep 19, 2006 7:00 pm    Post subject: Reply with quote

Frank,

Thank you, exactly this what I need. Could you tell me where can I get the exact definitions for the key words like.,

IFOUTLEN
IFTHEN=(WHEN=INIT
,SAVE,
SPLICE
Back to top
View user's profile Send private message
sairamjaya
Beginner


Joined: 01 Mar 2006
Posts: 21
Topics: 6

PostPosted: Tue Sep 19, 2006 7:12 pm    Post subject: Reply with quote

could u plz explain (501,2,SS,EQ,C'11,22')
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
Goto page 1, 2  Next
Page 1 of 2

 
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