padding of $$
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: padding of $$ Author: erasani PostPosted: Tue Aug 15, 2023 1:59 pm
    —
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

#2:  Author: kolusuLocation: San Jose PostPosted: Wed Aug 16, 2023 9:53 am
    —
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'$'))           
/*                                             

#3:  Author: erasani PostPosted: Wed Aug 16, 2023 1:00 pm
    —
Thanks a lot kolusu for your help.



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group