IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Padding with variable number of SPACES in SYNCSORT


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cybertaurean

New User


Joined: 22 Dec 2008
Posts: 85
Location: US

PostPosted: Wed Oct 28, 2015 11:22 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Wed Oct 28, 2015 11:49 pm
Reply with quote

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
View user's profile Send private message
cybertaurean

New User


Joined: 22 Dec 2008
Posts: 85
Location: US

PostPosted: Thu Oct 29, 2015 12:25 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Thu Oct 29, 2015 2:21 am
Reply with quote

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
View user's profile Send private message
cybertaurean

New User


Joined: 22 Dec 2008
Posts: 85
Location: US

PostPosted: Thu Oct 29, 2015 3:08 am
Reply with quote

Cool. When you say "actual data", are you referring to any byte that is not X'00'?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Thu Oct 29, 2015 3:20 am
Reply with quote

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
View user's profile Send private message
cybertaurean

New User


Joined: 22 Dec 2008
Posts: 85
Location: US

PostPosted: Thu Oct 29, 2015 5:16 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Thu Oct 29, 2015 7:04 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Syncsort- Merging two records into on... SYNCSORT 3
No new posts Copying large number of datasets to m... JCL & VSAM 17
No new posts COUNT the number of duplicates DFSORT/ICETOOL 3
No new posts fetch the record number from FMNMAIN ... CLIST & REXX 10
This topic is locked: you cannot edit posts or make replies. Suppressing only leading zeros (not s... DFSORT/ICETOOL 9
Search our Forums:

Back to Top