Modify Stage- DaysSinceFromDate syntax

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
venkat_kp
Charter Member
Charter Member
Posts: 33
Joined: Sun May 07, 2006 8:16 am

Modify Stage- DaysSinceFromDate syntax

Post by venkat_kp »

I am trying to count the of days between the Transaction date and the date posted. What is the correct syntax for the modify stage.


NumofDays = DaysSinceFromDate (DatePosted,TransDate)

Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

NumDays:integer=days_since_from_date[source_date](date)
DaysSinceFromDate() is a Transformer stage function, not a Modify stage function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
luie
Premium Member
Premium Member
Posts: 16
Joined: Sun Jan 25, 2004 3:48 pm

Post by luie »

Does the source_date argument of days_since_from_date function accept only hard-coded value? I want to use it but when I pass a date column for source_date, I get the following error. It works though if I use a hard-coded date like "2007-01-01" but this is not the way I want it.

NEW_DATE and TRANSACTION_DATE are my arguments which are both date columns.

-------------------------------------------------------------------------
main_program: Error parsing modify adapter: Error in binding: Parsing parameters "NEW_DATE" for conversion "int32=days_since_from_date[**********](date)": APT_Conversion_DaysSince_Date: Invalid Date [NEW_DATE] used for days_since_from_date type conversion
Expected destination field selector, got: ")"; input:
DIFF = days_since_from_date[NEW_DATE] (TRANSACTION_DATE)
;
[sil/step_il.C:3446]
luie
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In Modify stage functions can take only one argument.

In days_since_from_date() the source date must be a constant. It can not be an input column.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Re: Modify Stage- DaysSinceFromDate syntax

Post by ag_ram »

venkat_kp wrote:I am trying to count the of days between the Transaction date and the date posted. What is the correct syntax for the modify stage.


NumofDays = DaysSinceFromDate (DatePosted,TransDate)

Thanks.
if you are looking for the transformer function , here is a sample of how to use that
DaysSinceFromDate(Inputcol.EffDate, DateToString(CurrentDate(),"%yyyy-%mm-%dd"))
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Given the original request
venkat_kp wrote:What is the correct syntax for the modify stage.
I do not believe the OP was looking for the Transformer stage function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gbusson
Participant
Posts: 98
Joined: Fri Oct 07, 2005 2:50 am
Location: France
Contact:

Post by gbusson »

this founction exist in a modify stage. In the modify, the 2nd parameter must be a constant, not in the transformer.

In the transformer, if the 2nd paramter is not a constant, performance is very poor!
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

gbusson wrote: In the transformer, if the 2nd paramter is not a constant, performance is very poor!
The performance has been drastically improved in all 7.x versions. Hence you cannot claim that transformer is "very poor" in performance, unless your using a version lower than 7.x. It still cannot beat modify stage, so I have heard, but its come a long way.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gbusson
Participant
Posts: 98
Joined: Fri Oct 07, 2005 2:50 am
Location: France
Contact:

Post by gbusson »

i used it with 7.0, and it is poor!

my solution : difference between the daysfom the constant and the 2 columns
gbusson
Participant
Posts: 98
Joined: Fri Oct 07, 2005 2:50 am
Location: France
Contact:

Post by gbusson »

This function is poor, not the transformer! Well used, it is a very powerful stage!
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

O ok. For some reason I thought the transformer was under attack, yet again.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gbusson
Participant
Posts: 98
Joined: Fri Oct 07, 2005 2:50 am
Location: France
Contact:

Post by gbusson »

In France, IBM/Ascential consultants attack in their best practice,

but experience shows that it is not justified.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Thats the very reason I wanted to give my 2 cents on transformer. But it all sprung from a misunderstanding.
Cheers.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gbusson
Participant
Posts: 98
Joined: Fri Oct 07, 2005 2:50 am
Location: France
Contact:

Post by gbusson »

It is not useless, it was a useful chat!

See you!
Post Reply