Facing issue with joinkey operation for F1 (VB file with len 80) and F2 (FB file of len 55) , when F1s 1,14 mathces with F2s 2,14 then write F2s 16,14 and f1s 15 to end of record to F1only file. (In case no match then write complete F1 record to F1ONLY.)
Output file F1ONLY need to be of lrecl and format same as F1 file.
In this same step JNF1CNTL is used to add SEQNUM of 10 bytes to F1 file
XXX.XXXX.XXXXX.XXXX.VB.V1
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.
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.
Thanks Bill for your suggestions, I am working on it, having a doubt..
what does when None means , does it mean match found. it seems so by seeing the build card.
Also does it always return 1 as the marker value when no match found.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
The match-marker can have B, 1 or 2. Where B means "on both". WHEN=NONE means when no conditions are true, like an ELSE in this situation or OTHER on EVALUATE when multiple conditions. Assuming you know COBOL.
The NONE should be in your SyncSORT documentation, the match-marker probably not.