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
 

 

Updating specified bytes in column of 200 bytes

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Updating specified bytes in column of 200 bytes
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

Site Director


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

PostPosted: Thu Jul 16, 2009 9:22 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Jul 16, 2009 9:36 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Jul 16, 2009 11:39 pm    Post subject:
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    Post subject:
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    Post subject: Re: Updating specified bytes in column of 200 bytes
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    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 Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
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
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am


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