Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Update a column to HEX value from DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Tue Jan 17, 2012 4:09 pm    Post subject: Update a column to HEX value from DB2
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    Post subject:
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: 269
Location: Mumbai

PostPosted: Wed Jan 18, 2012 10:20 am    Post subject:
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: 158
Location: Bangalore

PostPosted: Wed Jan 18, 2012 2:50 pm    Post subject:
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

Moderator


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

PostPosted: Wed Jan 18, 2012 7:12 pm    Post subject:
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    Post subject:
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

Moderator


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

PostPosted: Wed Jan 18, 2012 7:58 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us