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
 

 

Removing Extra Spaces in a comma separated file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Removing Extra Spaces in a comma separated file
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: 158
Location: Chennai

PostPosted: Tue Sep 13, 2016 11:10 am    Post subject: Reply to: Removing Extra Spaces in a comma separated file
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: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Sep 13, 2016 1:52 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Sep 13, 2016 11:56 pm    Post subject:
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.
http://ibmmainframes.com/about59491.html
http://ibmmainframes.com/about46336.html
http://ibmmainframes.com/about47014.html
http://www.ibmmainframeforum.com/syncsort-synctool/topic6600.html
http://www.ibmmainframeforum.com/syncsort-synctool/topic6630.html
http://www.ibmmainframeforum.com/dfsort-icetool-icegener/topic2388.html
http://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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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