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

need to remove quotes from output db2 query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sonali12_9

New User


Joined: 13 Feb 2009
Posts: 20
Location: United States of america

PostPosted: Mon May 03, 2010 6:42 pm
Reply with quote

I am retrieving the data from db2 table.
one of the field (length is 30) can have values like
a.) asfshf
b.) "jdfhsjf,jfhf"

I need to send the retrieved data to comma separated file.
for first type value , my output is having "asfshf"
for second type of value , my output will have ""jdhsjf,jfhf" ",

If i try to retrieve value from spufi it will return "jdhsjf,jfhf "

i want single quotes for second type of value. Please suggest if it is possible to get data without quotes while retrieving from db2 table itself.

Thanks in advance for help
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 03, 2010 6:58 pm
Reply with quote

post the query you are using... and sample columns values in the table...
Back to top
View user's profile Send private message
sonali12_9

New User


Joined: 13 Feb 2009
Posts: 20
Location: United States of america

PostPosted: Mon May 03, 2010 7:04 pm
Reply with quote

Code:
SELECT * FROM ISDBA.table1;

     ACN       REC_TYPE                   CUST_ NAM                 
------+---------+---------+---------+---------+---------+-
         14        07                            JDE PURPOSES ONLY
   27197         01                            "PRICKETTS DISTRIBUTING, INC."
Back to top
View user's profile Send private message
sonali12_9

New User


Joined: 13 Feb 2009
Posts: 20
Location: United States of america

PostPosted: Mon May 03, 2010 7:06 pm
Reply with quote

first field ACN is 9(09). second is char (02). cust_name is char 30
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 03, 2010 7:08 pm
Reply with quote

What would be expected output for about data?
would it be..
Code:

14 07 JDE PURPOSES ONLY
27197 01 PRICKETTS DISTRIBUTING, INC.
Back to top
View user's profile Send private message
sonali12_9

New User


Joined: 13 Feb 2009
Posts: 20
Location: United States of america

PostPosted: Mon May 03, 2010 7:17 pm
Reply with quote

yeah , thats what i am expecting.
Back to top
View user's profile Send private message
sonali12_9

New User


Joined: 13 Feb 2009
Posts: 20
Location: United States of america

PostPosted: Mon May 03, 2010 7:33 pm
Reply with quote

i can do it by
INSPECT OUT-RECord
REPLACING ALL '"' BY ' ' .

Please let me know if there any other way.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon May 03, 2010 7:57 pm
Reply with quote

What about the sql translate function.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon May 03, 2010 8:41 pm
Reply with quote

I just played a bit with a sample csv file and got interesting results:
Code:
1,AA,aa
2,AD,bb
3,AJ,"cc,ee"
4,AM,dd
5,BC,  gg
6,BF, "hh,kk"
7,BK, 'jj,mm'
8,BO, 'pp,rr'

Line 3: quoted text correctly loaded in one cell, double quotes have been removed.
Line 6: quoted text loaded in 2 cells, 1st part is "hh second part is kk"
Line 7: quoted text loaded in 2 cells, 1st part is 'jj 2nd part is mm'
Line 8: also loaded in 2 cells.
In lines 5 to 8, the leading space becomes part of the cell value.

I hope you can deduce by yourself what you need to do.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon May 03, 2010 8:43 pm
Reply with quote

Code:
select replace(cust_nam,'"', '') from
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts RC query -Time column CA Products 3
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Remove leading zeroes SYNCSORT 4
Search our Forums:

Back to Top