Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Padding with variable number of SPACES in SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: Padding with variable number of SPACES in SYNCSORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Oct 28, 2015 11:49 pm    Post subject: Reply to: Padding with variable number of SPACES in SYNCSORT
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Oct 29, 2015 2:21 am    Post subject: Reply to: Padding with variable number of SPACES in SYNCSORT
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Oct 29, 2015 3:20 am    Post subject: Reply to: Padding with variable number of SPACES in SYNCSORT
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Oct 29, 2015 7:04 am    Post subject: Reply to: Padding with variable number of SPACES in SYNCSORT
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us