I have a requirement where I need to find the records in which certain attributes have changed in the current file as compared to the prev day file ad write the delta records to a new file.
Details as below:
1) Both files have the same structure and a key in position 1:4
2) Key field cannot change in current version as compared to prev version only attributes field can change.
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
I've showed a solution for the inputs you've posted and that give this as output, which is same as you show as expected output:
Code:
AAAA 1234 BARBARA S
CCCC 9012 AIRLOUNGE Y
DDDD 5555 DAVIDOFF T
I've used the inputs as in-stream data so the assumptions are that your input files are FB, LRECL=80. If they differ we'd need to tweak the sort statements. So if the keys to be compared are at multiple positions, mention those positions at JOINKEYS statement as shown here: ibmmainframes.com/about51839.html and see if it works for you.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Code:
JOIN UNPAIRED F1,F2
I think the F1,F2 is being treated as a comment.
UNPAIRED will get F1,F2 anyway.
Since mismatches are ignored in the INCLUDE, why not drop the JOIN altogether, so you only get matched records?
frozenblood, I at least am unclear about what you mean,
Please show representative inputs, and expected output. Don't expect people to keep providing solutions as you change your inputs - or, unless told it is not possible with what you have - expect people to imagine it a good idea for you to change your data to fit a solution.
Thanks everyone, I have achieved the above requirement in 2 steps :
Code:
1) Sort the curr and prev file on the basis of key field and write only the required fields(to be compared for delta) using OUTREC to temp datasets respectively. Hence making both datasets of LRECL 40
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
Bill Woodger wrote:
frozenblood, I at least am unclear about what you mean,
I think OP is/was looking for the unpaired F1 records but I'm not very sure.
However, the way it was explained here:
Quote:
I have a requirement where I need to find the records in which certain attributes have changed in the current file as compared to the prev day file ad write the delta records to a new file.
with site specif terminology it was tough to comprehend as what is needed.