Author: Bill Woodger
Subject: Reply to: Joinkeys operation betwen VB and FB file
Posted: Sun Sep 25, 2016 10:51 pm (GMT 5.5)
You have SYNCSORT FOR Z/OS 2.1.1.1R (MFX, which it has been officially for a while). This supports the Match Marker, "?", in the REFORMAT statement and it is much easier to use that that to mess with FILL.
Your F1 input is variable-length.
Your F2 input is fixed-length.
This gives you the choice of a variable- or fixed-length REFORMAT. You choose which best matches your output.
Your output is to be the same length and format as your F1. So making your REFORMAT variable-length is the easiest.
You do this by having, in the first four bytes of the REFORMAT, an RDW from a variable-length input file.
Then you need all your data from F1, as you may need it:
That says "from position 5 until the end of the current record". But, you also want some fixed-length data from F2, which it is best to put before the variable-length data (rather than pad the variable-length data and VLTRIM it later).
But then why do you need 55 bytes from F2 if you only use 14 of them?
And the match-marker
Then, change your SORT, as the sequence number position has changed on the REFORMAT record.
Then, why is your OUTFIL called F1ONLY? That is confusing.
Forget the IFOUTLEN, you want variable-length records.
That final position-without-lenght will again say "from this position to the end of the current (REFORMAT) record".
If you try that, you'll also get a good idea why it is more beneficial to tell you all this than to directly tell you what to untangle from what you had.
Once you understand the above, you should be able to understand where you were going wrong previously.
Subject: Reply to: Joinkeys operation betwen VB and FB file
Posted: Sun Sep 25, 2016 10:51 pm (GMT 5.5)
You have SYNCSORT FOR Z/OS 2.1.1.1R (MFX, which it has been officially for a while). This supports the Match Marker, "?", in the REFORMAT statement and it is much easier to use that that to mess with FILL.
Your F1 input is variable-length.
Your F2 input is fixed-length.
This gives you the choice of a variable- or fixed-length REFORMAT. You choose which best matches your output.
Your output is to be the same length and format as your F1. So making your REFORMAT variable-length is the easiest.
You do this by having, in the first four bytes of the REFORMAT, an RDW from a variable-length input file.
Code: |
REFORMAT FIELDS=(F1:1,4, |
Then you need all your data from F1, as you may need it:
Code: |
REFORMAT FIELDS=(F1:1,4,5 |
That says "from position 5 until the end of the current record". But, you also want some fixed-length data from F2, which it is best to put before the variable-length data (rather than pad the variable-length data and VLTRIM it later).
Code: |
REFORMAT FIELDS=(F1:1,4,F2:1,55,F1:5 |
But then why do you need 55 bytes from F2 if you only use 14 of them?
Code: |
REFORMAT FIELDS=(F1:1,4,F2:16,14,F1:5 |
And the match-marker
Code: |
REFORMAT FIELDS=(F1:1,4,F2:16,14,?,F1:5) |
Then, change your SORT, as the sequence number position has changed on the REFORMAT record.
Then, why is your OUTFIL called F1ONLY? That is confusing.
Forget the IFOUTLEN, you want variable-length records.
Code: |
OUTFIL FNAMES=someusefulname, IFTHEN=(WHEN=(19,1,CH,EQ,C'1'), BUILD=(1,4,26)), IFTHEN=(WHEN=NONE, BUILD=(1,4,5,14,positionoftheF1fromREFORMATthatyouwabn)) |
That final position-without-lenght will again say "from this position to the end of the current (REFORMAT) record".
If you try that, you'll also get a good idea why it is more beneficial to tell you all this than to directly tell you what to untangle from what you had.
Once you understand the above, you should be able to understand where you were going wrong previously.