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

Removing Extra Spaces in a comma separated file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Tue Sep 13, 2016 7:46 am
Reply with quote

I have a file as below
Code:

DON BRADMAN          ,AUSTRALIA        ,101,CAPTAIN   AUS
SACHIN  TENDULKAR    ,INDIA            ,99 ,CAPTAIN   IND


Need to convert the file to below format and send across to users
Code:

DON BRADMAN,AUSTRALIA,101,CAPTAIN   AUS
SACHIN  TENDULKAR,INDIA,99,CAPTAIN   IND


I used FINDREP and changed x'4040' To x'' which solved the problem to an extent (and then changing single space and comma to just a comma). However whenever there are two spaces within a column, like in example above(CAPTAIN AUS), the logic breaks.

Is there any way we can achieve this through SORT ?

Please advise.
[/quote]
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Tue Sep 13, 2016 11:10 am
Reply with quote

May be this will work.

Code:

//SYSIN  DD *                                               
  OPTION COPY                                               
  INREC IFTHEN=(WHEN=INIT,                                   
                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',')))               
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Sep 13, 2016 1:52 pm
Reply with quote

Try this sort card. See if it works for you. I don't have DFSORT, tested it on syncsort assuming both input/output are fb/80.

Input:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DON BRADMAN          ,AUSTRALIA        ,101,CAPTAIN   AUS               
SACHIN  TENDULKAR    ,INDIA            ,99 ,CAPTAIN   IND               

Sort Card
Code:
OPTION   COPY                                                       
INREC IFOUTLEN=80,                                                 
      IFTHEN=(WHEN=INIT,                                           
      BUILD=(1,21,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=23), 
            23,17,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=19), 
            41,03,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=06), 
            45,15,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=17))),
      IFTHEN=(WHEN=INIT,                                           
      BUILD=(1,65,SQZ=(SHIFT=LEFT,MID=C',',PAIR=QUOTE))),           
      IFTHEN=(WHEN=INIT,FINDREP=(IN=C'"',OUT=C''))                 

Output:
Code:
DON BRADMAN,AUSTRALIA,101,CAPTAIN   AUS
SACHIN  TENDULKAR,INDIA,99,CAPTAIN   IND
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Tue Sep 13, 2016 11:56 pm
Reply with quote

How about doing some research over here or on internet? I got few results for you. But you can always ask the producer to strip the data.
ibmmainframes.com/about59491.html
ibmmainframes.com/about46336.html
ibmmainframes.com/about47014.html
www.ibmmainframeforum.com/syncsort-synctool/topic6600.html
www.ibmmainframeforum.com/syncsort-synctool/topic6630.html
www.ibmmainframeforum.com/dfsort-icetool-icegener/topic2388.html
ibmmainframes.com/about50765.html
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top