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

Updating specified bytes in column of 200 bytes


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

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Thu Jul 16, 2009 9:04 am
Reply with quote

Hi,
I have to update transaction_details column in a DB2 table.
This column conatins hex values.I have to find the date part in this column and update it with another date.
Can anybody tell me how to achieve this.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 16, 2009 9:22 am
Reply with quote

Hello,

No.

The date should be in a separate field, preferable defined as a "date". . .

One of the biggest reasons to design a database is to eliminate exactly this sort of data.

If you simply try to find/identify a "hex" date somewhere in the 200 bytes, using program code, it will be quite difficult. As you've posted in the db2 part of the forum, i suspect you want to do this some kind of query. I also suspect this will not happen. . .

Possibly, i misunderstand?
Back to top
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Thu Jul 16, 2009 9:57 am
Reply with quote

hello dick..thanks for the reply..
yes i want to write a DB2 query to update the date part.
Actually the transaction details column contains 3 different values year,days date and some other values.
I have to change the days to 0 and this is contained in 3rd byte of this column and 2 bytes of length ( that is 3rd byte of the transaction details column which is of 200 bytes) and there is a date part that starts from 8th byte and is 5 bytes of length which also needs an updation with another date that is being calculated in the query.

Can this be done in a query or do i need to write a DB2 program?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 16, 2009 9:36 pm
Reply with quote

Hello,

If it was my requirement to work with this 200-byte "thing", i would write code.

Also, if it was my requirement, i'd change the table definition, so there would be no 200-byte conglomeration. . .
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Thu Jul 16, 2009 9:46 pm
Reply with quote

You can not update a part of a column! Search this sort of dumb idea has been discussed before.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 16, 2009 11:39 pm
Reply with quote

Hello,

Quote:
You can not update a part of a column!
Yup, not directly. . .

If this 200-byter was in WS and redefined as the multiple fields, the individual values could be modified as needed and the whole thing then updated back in the database.

My preference would surely to properly define the table/columns instead of working with this unmanagable mess. Try performing impact analysis on this icon_confused.gif
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Fri Jul 17, 2009 7:21 am
Reply with quote

Db2 offers several functions like POSITION, HEX, SUBSTR using which you can tryout something. Not sure if possible. Look in SQL Reference manual.

But this idea seems silly to me.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 17, 2009 12:20 pm
Reply with quote

shchan wrote:
Hi,
I have to update transaction_details column in a DB2 table.
This column conatins hex values.I have to find the date part in this column and update it with another date.
Can anybody tell me how to achieve this.


I would speak directly with the idiot that designed this.
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 Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top