I have a scenario where it's not possible to know the exact offset from where I should start the padding -
The parm value passed to JPn above is not of constant length. Hence, I have no way to know the offset after JPn, where the padding should be all SPACES.
Since I wanted the output file to be with LRECL=80, I tried to allocate with LRECL=80. However, it seems like SYNCSORT pads with X'00' by default. If I had known the exact offset, I could have used the following, however, that isn't the case here.
No. That's why I was asking about your input RECFM and LRECL.
I think you had LRECL of 80 in your output in the JCL, and your input is shorter. That will cause the X'00' padding.
X'00' is of no particular meaning, it is still data. If there were X00' on the input, they would have retained.
Say your input was 40-byte FB, and your output is 80 in the JCL and is not specifically set in your Control Cards. There is "nothing" (which is not X'00') after position 40. But when you get SORT to write to to an LRECL 80 for a RECFM F/FB then SORT will pad with X'00'.
If you had let SORT define the LRECL, rather than have it in the JCL, then you'd have got "different" results.
That's my JCL, after the modification that you suggested. In this case, my input would be 'Table Name : EXIST' i.e. 25 bytes. I have multiple steps like this, which will create multiple outputs with varying lengths, but less than 80 for sure. In the end, I would collate them all into a single 80 LRECL.