MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

padding of $$

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
erasani
Beginner


Joined: 02 Oct 2021
Posts: 17
Topics: 7

PostPosted: Tue Aug 15, 2023 1:59 pm    Post subject: padding of $$ Reply with quote

Hi,

We have a space delimited file as below. Based on the length of the field it needs to pad appropriate number of '$'. In some cases its left padding and in other cases its right. Any inputs on how to acheive this?

Input:
Code:
11510000 ABC
22330000 BCC
44332255 DEF
1111 CDC
2222 NED
3333 MM


Output:
Code:
|$$$$11510000|ABC$$$$$|
|$$$$22330000|BCC$$$$$|
|$$$$44332255|DEF$$$$$|
|$$$$$$$$1111|CDC$$$$$|
|$$$$$$$$2222|NED$$$$$|
|$$$$$$$$3333|MM$$$$$$|



Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Aug 16, 2023 9:53 am    Post subject: Reply with quote

erasani,

Use the following DFSORT JCL which will give you the desired results.
Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                                 
11510000 ABC                                   
22330000 BCC                                   
44332255 DEF                                   
1111 CDC                                       
2222 NED                                       
3333 MM                                         
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC PARSE=(%01=(ENDBEFR=C' ',FIXLEN=12),   
               %02=(ENDBEFR=C' ',FIXLEN=08)),   
        BUILD=(C'|',                           
               %01,JFY=(SHIFT=RIGHT),           
               C'|',                           
               %02,JFY=(SHIFT=LEFT),           
               C'|')                           
                                               
  OUTREC FINDREP=(INOUT=(C' ',C'$'))           
/*                                             

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
erasani
Beginner


Joined: 02 Oct 2021
Posts: 17
Topics: 7

PostPosted: Wed Aug 16, 2023 1:00 pm    Post subject: Reply with quote

Thanks a lot kolusu for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group