IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Update a column to HEX value from DB2


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Tue Jan 17, 2012 4:09 pm
Reply with quote

Hi ,
I need to update a column in the table whose Hex equivalent should be equal to 01.

Quote:
UPDATE Table A
SET Col1 = (SUBSTR(Col1,11,1),X'01')
WHERE A= 999
and B= 99
and c = 'ST';COMMIT;;;;

when ran the above query in SPUFI it gives me the below error

Quote:

SQLCODE = -104, ERROR: ILLEGAL SYMBOL ",". SOME SYMBOLS THAT MIGHT
BE LEGAL ARE: MICROSECONDS MICROSECOND SECONDS SECOND MINUTES MINUTE
HOURS


even I tried with the
Quote:

UPDATE Table A
SET Col1 = (SUBSTR(Col1,11,1),HEX'01')
WHERE A= 999
and B= 99
and c = 'ST';COMMIT;;;


Is there any way that i directly update the value to a HEX equivalent
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Jan 17, 2012 5:08 pm
Reply with quote

Hex Function -
The HEX function returns a hexadecimal representation of a value.
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Wed Jan 18, 2012 10:20 am
Reply with quote

Hi,

your requirement is not clear.

What exactly you want to do?
you want to update COL1 when it's Hex equivalent should be equal to 01 or you want to update COL1 to hex equivalent of 01

Can you please elaborate on requirement
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Wed Jan 18, 2012 2:50 pm
Reply with quote

I want to update the col1 to hex equivalent of 01
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jan 18, 2012 7:12 pm
Reply with quote

Technokrat,

Observations:

1.You said you wanted to updated hex equivalnet of 01 but it is SUBSTR(Col1,11,1),X'01') ( Still I am clueless what is needed here)
2.Col1 = (SUBSTR(Col1,11,1),X'01') guess it should be Col1 = SUBSTR(Col1,11,1)||X'01'
3.In your next reply please use code tags and show us sample input data and sample output data considering X'01' is a '.'
4.Failing reply for the above observations you may not get a reply
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jan 18, 2012 7:52 pm
Reply with quote

[quote="premkrishnan"]3.In your next reply please use code tags and show us sample input data and sample output data considering X'01' is a '.'


No x'01' is not a '.' it is a non-displayable character that often is displayed as a '.' but it is definitely not a '.' which in EBCDIC is a hex'4b' or in ASCII is a x'2e'.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jan 18, 2012 7:58 pm
Reply with quote

Hi Craq,

I understand that but I just wanted Technokrat to display the x'01' as '.'
like assume icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts first column truncated in search result IBM Tools 13
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
Search our Forums:

Back to Top