Right function with date

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
halpavan2
Participant
Posts: 31
Joined: Fri Apr 18, 2008 5:44 am
Location: Hyderabad

Right function with date

Post by halpavan2 »

Hi All,

I have a small requirment in parallel jobs. I want output to be like this.
2010-12-30 05:50:30.000001 - - - - for first record
2010-12-30 05:50:30.000002 - - - - for second record

I have used the following function in transformer stage but didn't work.
CurrentTimestampMS() :"." :Right(Mod(@INROWNUM,1000), "6'0'R")...i am getting the output like this 2010-12-30 05:01:44.

Can any one help me with this.

You help will be much appreciated.

Regards
Pavan
pavan
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

Post by Sreedhar »

Hi,

Option 1: change data type from Date to Varchar
Option 2: At the project level change the Date format to include the Micro seconds
Regards,
Shree
785-816-0728
halpavan2
Participant
Posts: 31
Joined: Fri Apr 18, 2008 5:44 am
Location: Hyderabad

Post by halpavan2 »

I am using datatype as timestamp(26,6).....but that didn't work...output is coming like this 2010-12-30 05:01:44

But i need the output like this.

2010-12-30 05:50:30.000001 and the last one should be incremented for each new record like below.

2010-12-30 05:50:30.000001
2010-12-30 05:50:30.000002
2010-12-30 05:50:30.000003
2010-12-30 05:50:30.000004

Can any one please help me out
pavan
halpavan2
Participant
Posts: 31
Joined: Fri Apr 18, 2008 5:44 am
Location: Hyderabad

Post by halpavan2 »

The same function is working in server jobs
Oconv(Date(), "D-YMD[4,2,2]") :" ": Oconv(Time(), "MTS:") :"." :FMT(Mod(@INROWNUM,1000), "6'0'R")

i am using the below function in parallel jobs but no luck
CurrentTimestampMS() :"." :Right(Mod(@INROWNUM,1000), "6'0'R")
pavan
css.raghu
Participant
Posts: 18
Joined: Thu Jan 28, 2010 9:34 pm

Post by css.raghu »

While using the @INROWNUM in Transformer this problem may occur because of the partitioning. Try to change the partition.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The "6'0'R" formatting construct only works in BASIC expressions - only works in server jobs or BASIC Transformer stage.

In parallel jobs prefer

Code: Select all

Right("000000":InLink.TheString, 6)
Last edited by ray.wurlod on Fri Dec 31, 2010 3:29 am, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
halpavan2
Participant
Posts: 31
Joined: Fri Apr 18, 2008 5:44 am
Location: Hyderabad

Post by halpavan2 »

Hello ray,

As i didn't have a premium aaccount, could you please send me that command which works in parallel jobs. Sorry for troubling.

Thanks
Pavan
pavan
halpavan2
Participant
Posts: 31
Joined: Fri Apr 18, 2008 5:44 am
Location: Hyderabad

Post by halpavan2 »

Hi,

I resolved the issue with the below function.

CurrentTimestampMS() :"." :Right("000000" : @INROWNUM,6)

Thanks for all who have replied to my query.
pavan
Post Reply