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?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
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.
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
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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:
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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)
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