Posted: Wed Dec 08, 2010 1:24 pm Post subject: Unpaired Records from File2 using Syncsort
Hi everyone, I have a join step which must process only the paired keys, then I need to check the other values for changes. If any other value has changed I need to write the output from my F2 file. If I have no changes I need to ignore the record.
My data:
F1:01,05,CH,
F1:06,05,CH,
F1:11,05,CH,
F1:16,05,CH.
Post some sample data from both input files and the output you want from that sample input. If either/both file(s) may contain duplicates, show this in the sample data.
Explain any processing rules.
Why not just use 1,20 instead of 4 fields. . . _________________ All the best,
I need to join both old and new files paired on the first 5 bytes.
Then I need to analyze the paired record and check if the remaining bytes are equal.
If they are equal I need to ignore the paired record and analyze the next one.
But if the remaining bytes are not equal I need to write the output file from FILE_NEW.
Well, if my input don't have duplicates, don't you think that if I look for the unpaired from FILE_NEW could solve the problem? _________________ The more I learn, the more I want to learn.
FILE_OLD contains duplicates but FILE_NEW doesn't.
The keys are the first 5 bytes from each file.
If I have matching keys I need to update the record from FILE_OLD(6,10) using the data from FILE_NEW(6,10) and write it to the output.
I need to do that with every matching record from FILE_OLD.
So, my output will have the same records from FILE_OLD but with positions 6,10 updated from FILE_NEW when matching keys.
JOINKEYS FILE=F1,FIELDS=(1,05,A) OLD FILE
JOINKEYS FILE=F2,FIELDS=(1,05,A) UPDATES
JOIN UNPAIRED,F1 F1 MATCHED AND UNMATCHED
REFORMAT FIELDS=(F1:01,95, OLD FILE
F2:01,20) NEW FILE
OUTREC IFOUTLEN=95, OUT FILE LENGTH
IFTHEN=(WHEN=(01,5,CH,EQ,96,5,CH), TEST EQUALS
BUILD=(001,020, FROM F1
101,015, FROM F2
036,060)) FROM F1
SORT FIELDS=(01,05,CH,A,
06,05,CH,A,
11,10,CH,A)
_________________ The more I learn, the more I want to learn.
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