subtract 1 microsecond from incoming timestamp

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
bhargav_dd
Premium Member
Premium Member
Posts: 57
Joined: Tue Jun 30, 2009 9:38 am

subtract 1 microsecond from incoming timestamp

Post by bhargav_dd »

Hi all

In transformer I want to subtract -1 microsecond from the incoming timestamp '2011-02-24 07:53:08.266692' after comparison and I should get output as '2011-02-24 07:53:08.266691' Can you let me know how to achieve this is Datastage?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Are you not able to find any db2 functions to handle this?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Pretty straightforward. Strip off the microseconds, if non-zero subtract 1 and re-attach. If microseconds are zero use 999999 and subtract 1 from the seconds (perhaps using TimestampFromSecondsSince() function) before re-attaching.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Klaus Schaefer
Participant
Posts: 94
Joined: Wed May 08, 2002 8:44 am
Location: Germany
Contact:

use function TimestampOffsetByComponents

Post by Klaus Schaefer »

At least in DataStage 11.x there is a function called TimestampOffsetByComponents, which also supports microseconds to be added/subtracted in the seconds-component... :D

Cheers
Klaus
Post Reply