How to remove trailing spaces in a mainframe file

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
nishant
Member
Posts: 1
Joined: Tue Sep 13, 2016 7:28 am

How to remove trailing spaces in a mainframe file

Post by nishant » Tue Sep 13, 2016 7:38 am

I have a file having below data. I want to remove the trailing spaces after the value of the filed and before the comma(,).

Please suggest a way using Sort utitility

Accountno,name,address,
1001,aa bb cc dd ,abc street ,
1002,xxyy zz ,xyz street bergen avenue ,
1003,xxyz ,xyz street braverly hills ,


I want data in the output file as
Accountno,name,address,
1001,aa bb cc dd,abc street,
1002,xxyy zz,xyz street braverly hills,
1003,xxyz,xyz street bergen avenue,

magesh_j
Member
Posts: 16
Joined: Wed Aug 31, 2016 8:32 am

Post by magesh_j » Wed Sep 14, 2016 4:27 am

nishant,

Use FINDREP

Code: Select all

INREC FINDREP=(INOUT=(C' ,',C',')) 
if you have more than one space before comma then you can having multiple replace like below

Code: Select all

INREC  FINDREP=(INOUT=(C'                ,',C',',   
                       C'               ,',C',',    
                       C'              ,',C',',     
                       C'             ,',C',',      
                       C'            ,',C',',       
                       C'           ,',C',',        
                       C'          ,',C',',         
                       C'         ,',C',',          
                       C'        ,',C',',           
                       C'       ,',C',',            
                       C'      ,',C',',             
                       C'     ,',C',',              
                       C'    ,',C',',               
                       C'   ,',C',',                
                       C'  ,',C',',                 
                       C' ,',C',')))                
Thanks
Magesh

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others