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
 

 

How to extract from a VARCHAR COLUMN as character by SQL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
meetsupriyo

New User


Joined: 19 May 2009
Posts: 11
Location: Hyderabad

PostPosted: Sun Aug 04, 2013 8:33 pm    Post subject: How to extract from a VARCHAR COLUMN as character by SQL
Reply with quote

Hi,

I have a table on which a column is defined as VARCHAR(3500). I want to extract this column by SQL in a File. However as the column is VARCHAR, I am getting length as first two bytes which I dont want. Using CAST AS CHAR wont help as maximum character that I can extract is 255 I think. Is there anyway to extract the whole VARCHAR column as normal character without the length?

Thanks,
Supriyo.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Aug 05, 2013 2:31 am    Post subject:
Reply with quote

Hello,

One way would be to read the column into a ws-variable and then write your output file from this.
Back to top
View user's profile Send private message
meetsupriyo

New User


Joined: 19 May 2009
Posts: 11
Location: Hyderabad

PostPosted: Mon Aug 05, 2013 9:56 am    Post subject: Reply to: How to extract from a VARCHAR COLUMN as character
Reply with quote

Hi,

I dont want to write a COBOL DB2 Code for this. I was seeking if we can fulfil this requirement by a Job using SQL

Thanks,
Supriyo.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1788
Location: UK

PostPosted: Mon Aug 05, 2013 12:41 pm    Post subject:
Reply with quote

Quote:
by a Job
of course you can do this - it just depends on what programs that job is trying to execute and if those programs can do what you need. If they cannot then you will have to write a piece of code that will do it. I would suspect that that would be the most efficient way of doing it - but maybe not.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1535
Location: Andromeda Galaxy

PostPosted: Mon Aug 05, 2013 2:02 pm    Post subject:
Reply with quote

Hi,

Do you the output file as FB?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Aug 05, 2013 3:04 pm    Post subject:
Reply with quote

Supriyo,

Give a try on CLOB function,
Code:
select CLOB(columnname,3500)
from tablename

Not tested

Thanks,
Sushanth
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 6 Sun Nov 06, 2016 8:11 pm


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