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 

insert spaces between columns

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Fri Feb 09, 2007 1:28 pm    Post subject: insert spaces between columns Reply with quote

I want to unload data from a DB2 Table to a dataset and i am writing my query as :
Code:

SELECT EMPNO,EMPNAME FROM TABLENAME;

EMPNO CHAR(06)
EMPNAME CHAR(24)

so my unload dataset will have LRECL as 32 because initially one filler will be introduced and then one more filler will be introduced after enpmo so total = 1 + 6 + 1 + 24 = 32 = LRECL.

Now want i want is i want to introduce 10 spaces between EMPNO and EMPNAME ? Please help me how can i write a query which will introduce 10 spaces between EMPNO and EMPNAME .I have one solution is download to a temp dataset and then make of SORT utility to introduce 10X and then form the dataset.Please let me know how to solve the problem.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Feb 09, 2007 2:30 pm    Post subject: Reply with quote

Code:

SELECT EMPNO
     , CHAR('         ')
     , EMPNAME
FROM   TABLENAME;

with 9 spaces between the quotes.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Feb 09, 2007 3:22 pm    Post subject: Reply with quote

yadav2005,

Please search before posting. Check this link which discusses the same issue.

http://www.mvsforums.com/helpboards/viewtopic.php?t=4576&highlight=space


dbzTHEdinosauer,

You don't have to specify 9 spaces in the char function. you can just specify
Code:

CHAR(' ',9)


will give you 9 spaces.

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Feb 09, 2007 5:11 pm    Post subject: Reply with quote

thx for the syntax tip! dbz
_________________
Dick Brenholtz
American living in Varel, Germany
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 -> Database 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