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 

Char data type not being displayed properly

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


Joined: 01 Mar 2005
Posts: 105
Topics: 58

PostPosted: Sat Jul 08, 2006 4:48 am    Post subject: Char data type not being displayed properly Reply with quote

Members,

There is a column in one of the DB2 table which is declared as POS CHAR(4).When i query the DB2 table by using
Code:

SELECT POS FROM TABLENAME;

I get the display as non displayable characters in QMF, what could be the possible reason for that .Moreover there is a Control card in which the query is written for the same as
Code:
SELECT HEX(POS) FROM TABLENAME
which when i run i get the display for the column in proper displayable mode.What could be the reason for using HEX in the query for a simple select ?
If i need to insert into the table a value for the column , it is that i should use
Code:

INSERT INTO TABLENAME (POS) VALUES('ABCD') OR
INSERT INTO TABLENAME (POS) VALUES(HEX('ABCD'))

If i use SELECT CHAR(POS) FROM TABLENAME; i get the display in a non readable format .
If i want to see the HEX version of a field i use
Code:

SELECT HEX(POS) FROM TABLENAME which gets me the desired result in character representation ?

In a similar way if i want to see the reverse of it If HEX value is 08300900 the character data is what ?
Code:

SELECT CHAR(POS) FROM TABLENAME; results in displaying graphical character

Alternately i tried using to extract the query output to a flat file and still i find the column value in a non displayable type , why is the reason behind to not getting a character field displayed ,can anybody help me in this problem ?

Please suggest what is this type of possibility happen for queries ? What could be the logic behind this to have such criteria ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sat Jul 08, 2006 7:13 am    Post subject: Reply with quote

mfuser,

If a column is defined as Char you can insert any thing to it. Some of the shops use Char columns to store dates. A typical Date column occupies 10 bytes , however if your store the date in packed decimal format then you can store it 5 bytes.

For : today's date is 20060708

It can be stored in 5 bytes char colums as packed decimal

Code:

00678
2000C


When you select such column QMF/Spufi will not Show it in displayable characters.
Quote:

In a similar way if i want to see the reverse of it If HEX value is 08300900 the character data is what ?


Search before posting. Check the 3rd solution in this link

http://www.mvsforums.com/helpboards/viewtopic.php?p=11074#11074

Hope this helps...

Cheers

Kolusu
_________________
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