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

Comparison of two files of larger length around 3500


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Thu Dec 10, 2009 8:55 pm
Reply with quote

Hi Skolusu,

One of your suggestion in previous posts i found a post like this for comparison of two files of larger length around 3500.

Code:
//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
HDR                                                               
//SORTOUT  DD DSN=&&H,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)         
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC OVERLAY=(4500:X)                                           
  OUTFIL FTOV                                                     
/*                                                                 
//STEP0200 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT         
//         DD DSN=Your input file1,DISP=SHR 
//         DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT         
//         DD DSN==Your input file2,DISP=SHR   
//FILEC    DD SYSOUT=*                                             
//FILED    DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C'0',22,10,5)),               
  IFTHEN=(WHEN=GROUP,BEGIN=(16,3,CH,EQ,C'HDR'),PUSH=(5:ID=1))     
  SORT FIELDS=(1,4,BI,A,6,3510,BI,A)                               
  SUM FIELDS=(5,1,ZD)                                             
  OUTFIL FNAMES=FILEC,INCLUDE=(5,1,ZD,EQ,1),BUILD=(1,4,16)         
  OUTFIL FNAMES=FILED,INCLUDE=(5,1,ZD,EQ,2),BUILD=(1,4,16)         
/*


This code is giving me the different records in two different files....is there any chance to get common records which are in both files into a file along with this?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Dec 10, 2009 11:27 pm
Reply with quote

Kolusu is on vacation.

If you want me to help you, you need to start over and give me the details of what you're trying to do.

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Fri Dec 11, 2009 9:15 am
Reply with quote

frank,

Thanks a lot.

I have a requirement as below :

I need to comapre two files and list out differences in to two files as well matching records into one file. files are of length 4504 and VB. comparison should be on 1 to 3500 bytes rest of the bytes we can leave.

File1 :

Code:
BBBBBBBBBBBBBBBBB12345672BBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCC12345671CCCCCCCCCCCCCCCCCCCCCC
XXXXXXXXXXXXXXXXXXX12345678XXXXXXXXXXXXXXXXXXXXXXXXX
AAAAAAAAAAAAAAAAA12345673AAAAAAAAAAAAAAAAAAAAAA


File2:

Code:
AAAAAAAAAAAAAAAAA12345673AAAAAAAAAAAAADDDDDDDD
BBBBBBBBBBBBBBBBB12345672BBBBBBBBBBBBBAAAAAAAA
CCCCCCCCCCCCCCCCC12345671CCCCCCCCCCCCCCCCCCCCC
XXXXXXXXXXXXXXXXXXX12345678XXXXXXXXXXXXXXXXXXXXXXXXX


I need to compare byte by byte and list out the differences in output files

i need three out put files
1) Records which are there in file1 but not in file 2 (OUTPUT1)
Code:
BBBBBBBBBBBBBBBBB12345672BBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCC12345671CCCCCCCCCCCCCCCCCCCCCC
AAAAAAAAAAAAAAAAA12345673AAAAAAAAAAAAAAAAAAAAAA

2) Records which are there in file1 but not in file 2 (OUTPUT2)
Code:
AAAAAAAAAAAAAAAAA12345673AAAAAAAAAAAAADDDDDDDD
BBBBBBBBBBBBBBBBB12345672BBBBBBBBBBBBBAAAAAAAA
CCCCCCCCCCCCCCCCC12345671CCCCCCCCCCCCCCCCCCCCC

3) REcords which are in both the files (OUTPUT3)
Code:
XXXXXXXXXXXXXXXXXXX12345678XXXXXXXXXXXXXXXXXXXXXXXXX


Skolusu's code givng me two output files (OUTPUT1) and (OUTPUT2). I am in requirement of (OUTPUT3) also. Please suggest
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Fri Dec 11, 2009 12:49 pm
Reply with quote

1) There are no dublicate records in file1 and file2
2) Both files are VB files with RECLN=4504
3) Comparision should happen in between 18 to 3500 bytes
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Fri Dec 11, 2009 5:46 pm
Reply with quote

frank,

If you dont mind can you please explain the below code also from skolusu's suggestion.

Code:
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C'0',22,10,5)),               
  IFTHEN=(WHEN=GROUP,BEGIN=(16,3,CH,EQ,C'HDR'),PUSH=(5:ID=1))     
  SORT FIELDS=(1,4,BI,A,6,3510,BI,A)                               
  SUM FIELDS=(5,1,ZD)                                             
  OUTFIL FNAMES=FILEC,INCLUDE=(5,1,ZD,EQ,1),BUILD=(1,4,16)         
  OUTFIL FNAMES=FILED,INCLUDE=(5,1,ZD,EQ,2),BUILD=(1,4,16) 
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 11, 2009 10:41 pm
Reply with quote

Going by what Kolusu did (and the assumptions he made), to add FILEE with the records in both files, you would just need to modify his job by adding the FILEE DD and an additional OUTFIL statement as follows:

Code:

...
//FILEE DD SYSOUT=*
...
  OUTFIL FNAMES=FILEE,                                         
     INCLUDE=(5,1,ZD,EQ,3,AND,16,3,CH,NE,C'HDR'),BUILD=(1,4,16)
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 11, 2009 10:49 pm
Reply with quote

Quote:
If you dont mind can you please explain the below code also from skolusu's suggestion.


Kolusu is adding a 'HDR' at the start of File1 and File2 so he can identify which file each set of records come from. He uses GROUP to put an id of '1' in position 5 of the records from File1 and an id of '2' in position 5 of the records from File2. Then he use SUM to get '1' in position 5 for records that are only in File1, '2' in position 5 for records that are only in File2 and '3' ('1'+'2') in position 5 for records that are in File1 and File2. The OUTFIL statements then write the records to the correct output file based on the id in position 5.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Fri Dec 11, 2009 10:53 pm
Reply with quote

Quote:
2) Records which are there in file1 but not in file 2 (OUTPUT2)

Code:
  Code:
AAAAAAAAAAAAAAAAA12345673AAAAAAAAAAAAADDDDDDDD
BBBBBBBBBBBBBBBBB12345672BBBBBBBBBBBBBAAAAAAAA
CCCCCCCCCCCCCCCCC12345671CCCCCCCCCCCCCCCCCCCCC 


Sure of this?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 11, 2009 11:22 pm
Reply with quote

Look again. The records in File1 and File2 are different in the last characters (A's for the A record in File1 and D's for the A record in File2).
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Fri Dec 11, 2009 11:33 pm
Reply with quote

Quote:
2) Records which are there in file1 but not in file 2 (OUTPUT2)


Just the sentence to change in
2) Records which are there not in file1 but in file 2 (OUTPUT2)

Sorry but I am a Tester, so ...

Or is it Friday?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Dec 12, 2009 12:02 am
Reply with quote

Oh, I see what you mean. It should be:

1) Records which are in file1 but not in file 2 (OUTPUT1)
2) Records which are in file2 but not in file 1 (OUTPUT2)
3) REcords which are in both files (OUTPUT3)
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Sun Dec 13, 2009 12:34 pm
Reply with quote

Franks,

Thanks a lot. it worked for me.

Just need some clarifications so that i wont bug you guys for other requirement as like this

Code:
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C'0',22,10,5)),               


Here we are making 1 to 4 rdw to be zeros, then 22 to 10 positions to sort the records based on these 10 bytes, what is 5 in this statement?

Code:
  SORT FIELDS=(1,4,BI,A,6,3510,BI,A)                               

6,3510 will make us to compare the records based on these 3500 bytes right? if yes, it should be 16,3510 as we are adding 22,10 (10 bytes after RDW for sort) right? Please suggest if i am wrong
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Dec 15, 2009 4:21 am
Reply with quote

You're not interpreting the INREC statement correctly.

1,4,C'0',22,10,5 reformats the records like this:

Code:

|rrrr|0|22,10|5       <--- fields
 4    1 10    n       <--- length in bytes


where rrrr is the 4-byte RDW, 0 is a character 0, 22,10 is input positions 22-31, and 5 is input positions 5 to the end of the record.
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Fri Dec 18, 2009 11:42 pm
Reply with quote

Thank You Very Much
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
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 VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top