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 

Junk Characters in Db2.

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


Joined: 23 Feb 2006
Posts: 5
Topics: 4

PostPosted: Fri Dec 28, 2007 3:24 pm    Post subject: Junk Characters in Db2. Reply with quote

Hi ,

I executed one Db2 Query in Batch mode with delimiter(,). And I outputted the result of Query to Sequential file.

When I Opened the data set in browse mode the character values are starting with junk characters.

Query :

Select (Digits(eno)),substr(','),Ename,substr(','),(Digits(eage))
from Employee;

Ex:

O/P Dataset Values
1,..xyz,23
2,..abc,45

Please help me how to write the data to O/P dataset without Junk characters.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Dec 28, 2007 3:38 pm    Post subject: Reply with quote

kirankumargupt,

They are NOT junk characters. The extra 2 bytes you see is the length field of a varchar column. So You need the char function to treat them as Char columns which has fixed length.

Code:


Select CHAR((Digits(eno)))
      ,CHAR(',')
      ,CHAR(Ename)
      ,CHAR(',')
      ,CHAR((Digits(eage)))
from Employee;


Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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