Author: Bill Woodger
Subject: Reply to: Matching with Key at different postions.
Posted: Thu Nov 10, 2016 12:29 pm (GMT 5.5)
DFSORT doesn't have arrays, nor looping constructs.
Two ways: "keys only", three steps, final output in key order; "keys+data", two steps, final output not in key order.
With the expected multiple hits, you may want to consider knowing how the match was done.
Keys Only
Extract 11 key records for each input record on the full file: main key plus the 10 additional keys. Output to include original key and key-for-matching only (10 bytes).
JOINKEYS with F1 (already in sequence, so use SORTED,NOSEQCK) as your file to cause extracts and F2 (with the duplicates and you need to let the JOINKEYS SORT it, the default action) as file created above. Output can be cut in half by not dropping the key that was matched on.
JOINKEYS with you original main file (SORTED,NOSEQCK) and the output from the first JOINKEYS (needs to be SORTed, the default action).
Keys+Data
The same as the first two steps above, no need to finally reattach the data, as you've dragged it with you all the time.
How to create the multiple records? Discussed recently, there's REPEAT on OUTFIL, ICETOOL's RESIZE, or a simple COPY with BUILD and the slash-operator (/).
Subject: Reply to: Matching with Key at different postions.
Posted: Thu Nov 10, 2016 12:29 pm (GMT 5.5)
DFSORT doesn't have arrays, nor looping constructs.
Two ways: "keys only", three steps, final output in key order; "keys+data", two steps, final output not in key order.
With the expected multiple hits, you may want to consider knowing how the match was done.
Keys Only
Extract 11 key records for each input record on the full file: main key plus the 10 additional keys. Output to include original key and key-for-matching only (10 bytes).
JOINKEYS with F1 (already in sequence, so use SORTED,NOSEQCK) as your file to cause extracts and F2 (with the duplicates and you need to let the JOINKEYS SORT it, the default action) as file created above. Output can be cut in half by not dropping the key that was matched on.
JOINKEYS with you original main file (SORTED,NOSEQCK) and the output from the first JOINKEYS (needs to be SORTed, the default action).
Keys+Data
The same as the first two steps above, no need to finally reattach the data, as you've dragged it with you all the time.
How to create the multiple records? Discussed recently, there's REPEAT on OUTFIL, ICETOOL's RESIZE, or a simple COPY with BUILD and the slash-operator (/).