View previous topic :: View next topic |
Author |
Message |
mfuser Banned
Joined: 01 Mar 2005 Posts: 105 Topics: 58
|
Posted: Sat Jul 08, 2006 4:48 am Post subject: Char data type not being displayed properly |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12385 Topics: 75 Location: San Jose
|
Posted: Sat Jul 08, 2006 7:13 am Post subject: |
|
|
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
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 |
|
 |
|
|