Problem in defining one business rule in transformer

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
shalini11
Participant
Posts: 74
Joined: Thu Jan 22, 2009 3:00 am

Problem in defining one business rule in transformer

Post by shalini11 »

Hi All,

I have to give one condition in transformer. I am using a stage variable to do this.But the job is getting aborted because of that particular condition.I am not able to find out whats wrong in the below condition.

If Trim(Move_Xfm.Make)='Chevrolet' And Trim(Move_Xfm.Model)='Impala' And Trim(Move_Xfm.ModelYear) >='2006' And Trim(Move_Xfm.prfx) [4,2]= 'WS' Then 'E'

Else If (Trim(Move_Xfm.Make)='Chevrolet' Or Trim(Move_Xfm.Make)='GMC') And Trim(Move_Xfm.ModelYear) > '2007' And (Trim(Move_Xfm.prfx) [5,2]= 'C0' Or Trim(Move_Xfm.prfx) [5,2]= 'K0') Then 'E' Else ''


Can anybody help me out.

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

Post by ray.wurlod »

Advise the data types of all the fields mentioned in the expression. Without that we can't really help.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shalini11
Participant
Posts: 74
Joined: Thu Jan 22, 2009 3:00 am

Post by shalini11 »

All are VARCHARs
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Try a Trim(Variable[from,len]) rather than Trim(Variable)[from,len].
shalini11
Participant
Posts: 74
Joined: Thu Jan 22, 2009 3:00 am

Post by shalini11 »

Thank you Sir,

It worked.
Such a small thing and it created a havoc.

Can you explain me what's the difference in writing Trim(Variable[from,len]) and Trim(Variable)[from,len].
s_boyapati
Premium Member
Premium Member
Posts: 70
Joined: Thu Aug 14, 2003 6:24 am
Contact:

Re: Problem in defining one business rule in transformer

Post by s_boyapati »

shalini11 wrote:Hi All,

I have to give one condition in transformer. I am using a stage variable to do this.But the job is getting aborted because of that particular condition.I am not able to find out whats wrong in the below condition.

If Trim(Move_Xfm.Make)='Chevrolet' And Trim(Move_Xfm.Model)='Impala' And Trim(Move_Xfm.ModelYear) >='2006' And Trim(Move_Xfm.prfx) [4,2]= 'WS' Then 'E'

Else If (Trim(Move_Xfm.Make)='Chevrolet' Or Trim(Move_Xfm.Make)='GMC') And Trim(Move_Xfm.ModelYear) > '2007' And (Trim(Move_Xfm.prfx) [5,2]= 'C0' Or Trim(Move_Xfm.prfx) [5,2]= 'K0') Then 'E' Else ''


Can anybody help me out.

Thanks
Also consider providing initial values to stage variables, will help you...
Sree Boyapati
Sr. ETL Architect
Certified Developer in DataStage, QualityStage, Information Analyzer.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

shalini11 wrote:Thank you Sir,

It worked.
Such a small thing and it created a havoc.

Can you explain me what's the difference in writing Trim(Variable[from,len]) and Trim(Variable)[from,len].
The obvious difference is where Variable contains leading trimmable characters. The first syntax strips the first len characters (whatever they are) and trims the remainder. The second syntax trims the trimmable characters before performing the substring operation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply