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 

Replace comma between paired quotes

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


Joined: 15 Jan 2016
Posts: 20
Topics: 7

PostPosted: Fri Jan 20, 2017 6:53 am    Post subject: Replace comma between paired quotes Reply with quote

Hi,
an input file contains comma seperated values.
The charcter fields are enclosed in double quotes.
Code:

"EUR",0,"EUR",0,"EUR","060",20160625,20160625,20160705,,"0"

i now remove the quotes from the (VB) input record with
Code:

INREC OVERLAY=(5:5,32004,SQZ=(SHIFT=LEFT,PREBLANK=C'"'))

the quotes are now removed and the csv's are read with another utility.
When there would have been a comma in the quoted character field, the utility will run wrong because of faulty parsing.
Question : how can i change a comma in dot-comma (replace , with ; ) between the paired quotes?
Kind Regards, Gerd.[/code]
Back to top
View user's profile Send private message
BCallens
Beginner


Joined: 10 Jan 2017
Posts: 1
Topics: 0
Location: Belgium

PostPosted: Fri Jan 20, 2017 9:22 am    Post subject: Reply with quote

Using PAIR=QUOTE the same SQZ statement can be used to replace the comma's.
Code:

INREC OVERLAY=(5:5,32004,SQZ=(SHIFT=LEFT,PAIR=QUOTE,
               PREBLANK=C',',MID=C';'))             

This should give:
Code:

"EUR",0,"EUR",0,"E;R","060",20160625,20160625,20160705,,"0"
Back to top
View user's profile Send private message
Gerd Hofmans
Beginner


Joined: 15 Jan 2016
Posts: 20
Topics: 7

PostPosted: Mon Jan 23, 2017 2:46 am    Post subject: Reply with quote

Thanks for your reply, but i think that you have tested that with a FB file.
The input file is VB, therefor the squeezing starts at position 5.
The proposed statement will replace all commas with dot-commas, and leaves all commas between the quotes untouched.
I simplified it a bit with a FB infile :
Code:

"E,R",0,"E,R",0,"E,R","060",20160625,20160625,20160705,,"0"

Code:

INREC OVERLAY=(1:1,80,SQZ=(SHIFT=LEFT,PAIR=QUOTE,
                PREBLANK=C',',MID=C';'))         
OUTFIL BUILD=(1,80)                             

will return following output :
Code:

"E,R";0;"E,R";0;"E,R";"060";20160625;20160625;20160705;"0"

Kind Regards, Gerd.
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