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 Select Spaces using DB2 query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to Select Spaces using DB2 query
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    Post subject:
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: 1278
Location: Belgium

PostPosted: Mon Oct 11, 2010 2:51 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 Join in SQL Query vickey_dw DB2 0 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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