Transformer Logic Error

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

Transformer Logic Error

Post by Raftsman »

I asked a question about setting defaults when joining two tables (HASH and DB2) and some codes aren't found.

I coded the transform as this and keep getting an error.

Two questions:

Can I set two variables in the Then and else statements
Can I remove the else and end and the code will pass through to the function call with the new values. Thanks

If IsNull(DSLink15.Wloc_Cd)
Then DSLink15.Sav_Strt_tm = '02:00:00.000000'
DSLink15.Sav_End_tm = '02:00:00.000000'
Else
DSLink15.Sav_Strt_tm
DSLink15.Sav_End_tm
End
ConvertToTimeZone(DSLink2.PSG_ACTVT_SDTTM,DSLink15.Sav_Strt_tm,DSLink15.Sav_End_tm,"PST")
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

Create two stage variables, each with an IF THEN ELSE. Drop the END.

Put the ConvertToTimezone() call in your derivation.
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post by ds_developer »

This isn't a direct answer to your question, but an observation on the IF THEN ELSE you posted:

Code: Select all

If IsNull(DSLink15.Wloc_Cd) Then
   DSLink15.Sav_Strt_tm = '02:00:00.000000' 
   DSLink15.Sav_End_tm = '02:00:00.000000'
Else 
   DSLink15.Sav_Strt_tm 
   DSLink15.Sav_End_tm 
End 
ConvertToTimeZone(DSLink2.PSG_ACTVT_SDTTM,DSLink15.Sav_Strt_tm,DSLink15.Sav_End_tm,"PST")
In the THEN clause do not try to set the value of the source field, just supply the value you want.

As Chuck suggested, use 2 stage variables:
SaveStartTime
SaveEndTime

The derivation of SaveStartTime would be:

Code: Select all

If IsNull(DSLink15.Wloc_Cd) Then
  '02:00:00.000000' 
Else 
  DSLink15.Sav_Strt_tm 
End 
The derivation of SaveEndTime would be:

Code: Select all

If IsNull(DSLink15.Wloc_Cd) Then
  '02:00:00.000000' 
Else 
  DSLink15.Sav_End_tm 
End
Then the derivation of the target field would call ConvertToTimeZone (using the stage variables).

Hope this helps,
John
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

Post by Raftsman »

Thanks for the input. I made the changes and all is correct.
Post Reply