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

How to Select Spaces using DB2 query


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

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Mon Oct 11, 2010 12:57 pm
Reply with quote

Hi,
If i have a table say X, which has 10 columns(fields), I want to fetch 5 fields using select clause which i can do,These 5 columns have total lenght of 50, I want it to write in output file, this i can do thru IKJEFT01 utility, but the output file is of 150 length that means 50 lenght i can get from fields of table but remaining 150 fields i want it to write as spaces.
Now 1 way is to do is -
SELECT 5 fields,CHAR( 150 spaces ) FROM table(X) .... But this will cost me to type 150 spaces in CHAR field, Is there anyway to fetch 150 spaces?
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Mon Oct 11, 2010 12:58 pm
Reply with quote

Just to add correction in above query, output file is of 200 length.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon Oct 11, 2010 2:51 pm
Reply with quote

do you mean repeat(' ',200) ?
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Mon Oct 11, 2010 4:03 pm
Reply with quote

Sorry GuyC, i havent understood ur reply .. But my output file's LRECL is 200 in SYSREC(i m using IKJEFT01). When i will fetch 5 fields, 50 legth's data will written to file(as each field's length is 10), but for remaining 150 length, i want to write space, so how i will fetch that 150 space using select query. 1 way i already mentioned in my 1st post.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 11, 2010 4:14 pm
Reply with quote

Ashutosh,

since you wrote this
Quote:
IKJEFT01 utility
it is not surprising that you do not understand GuyC's solution,
because that would require looking in a manual for the db2 utility that you are invoking thru the terminal monitor program,
or simply knowing sql.
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Mon Oct 11, 2010 5:49 pm
Reply with quote

I got it now .. thanks GuyC .. !!
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 RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
Search our Forums:

Back to Top