View previous topic :: View next topic
|
Author |
Message |
cybertaurean
New User
Joined: 22 Dec 2008 Posts: 87 Location: US
|
|
|
|
Hi All,
I have a scenario where it's not possible to know the exact offset from where I should start the padding -
Code: |
OUTREC FIELDS=(1:1,20,21:JP0)
|
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.
Code: |
OFFSET:<# of bytes>X
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
INREC OVERLAY=(21:JP0,80:X) |
As long as your JP0 can't be more than 59 bytes.
If that doesn't do it for you, LRECL and RECFM of input. Sample input with expected and received output.
Look at the Fields Box sticky in this forum please. |
|
Back to top |
|
|
cybertaurean
New User
Joined: 22 Dec 2008 Posts: 87 Location: US
|
|
|
|
Hi Bill,
That worked like a charm. When you say 80:X, are you asking for 80 spaces to be padded? In this case, since the remaining spaces to be padded is < 80, is it truncating accordingly?
Code: |
Table Name : EXIST
E88984D8984444444474CECEE44444444444444444444444444444444444444444444444
312350514500000000A05792300000000000000000000000000000000000000000000000
|
That being said, it's working fine for me. All the values till the end of the line are padded with X'40'. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
No, you're misreading it.
80X is 80 spaces. 80:X is one space at position 80. Any intervening bytes between the last actual data and the 80th position will be space-filled. |
|
Back to top |
|
|
cybertaurean
New User
Joined: 22 Dec 2008 Posts: 87 Location: US
|
|
|
|
Cool. When you say "actual data", are you referring to any byte that is not X'00'? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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. |
|
Back to top |
|
|
cybertaurean
New User
Joined: 22 Dec 2008 Posts: 87 Location: US
|
|
|
|
Code: |
// SET TBL='EXIST'
//STEP001 EXEC PGM=SORT,PARM='JP1"&TBL"'
//SYSOUT DD SYSOUT=*
//SYMNOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD *
Table Name :
//SORTOUT DD DSN=SNMSD1Y.TEMP,
// DISP=(NEW,CATLG,DELETE),
// UNIT=TESTDA,
// SPACE=(TRK,(10,5),RLSE),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,20,21:JP1,80:X)
|
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. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Did you look at this?
Also, where fields abut each other directly, there is no need to specify columns.
Also, if the only data you are using in a BUILD is copied from the same position and length, then there is no need to use BUILD, user OVERLAY for clarity (and at times, but not this one, performance).
Again, don't specify the DCB information in the JCL. You end up with two places to maintain the LRECL. If you change the JCL to 81, you'll get an X'00' again.
If you give some examples of your multiple steps, rationalisation may well be possible. |
|
Back to top |
|
|
|