Wrong Routine value returned

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
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Wrong Routine value returned

Post by snassimr »

Hi !

I invoke routine from Job Sequence and pass value to job.
When I test routine it return right value.
But when I see in Director Job Parametr the value is returned wrong
TempDateN=(SDTToDateNumeric('2001-01-01') )
TodayDateN=(SDTToDateNumeric('2003-01-01') )

IF TempDateN<TodayDateN THEN Ans=TempDateN else Ans=TodayDateN ;
In roitine test the value is 20030101 but in log of job 20010101

Anu ideas?

Thanks in advance
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,
You are getting through the job sequence the correct value.

TempDateN=(SDTToDateNumeric('2001-01-01') )
TodayDateN=(SDTToDateNumeric('2003-01-01') )

IF TempDateN<TodayDateN THEN Ans=TempDateN else Ans=TodayDateN ;


As '2001-01-01' is less than '2003-01-01', the answer is '2001-01-01' ?

Do you expect something different?

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

Post by Sainath.Srinivasan »

Your logic appears to be defined to pick the least of the 2.

The result is therefore the least of the two.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

So what does this SDTToDateNumeric routine do? Plus you don't want to use the ( ) around your function, either.
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Post by snassimr »

Sorry I mistake in my formulation

In roitine test the value is 20010101 but in log of job 20030101

My SDTToDateNumeric('2001-01-01') return 20010101

Any other ideas
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Can you provide
a.) The code of the routine
b.) The step by which you called it
c.) Values passed
d.) Value returned
e.) Reason what makes you think it is wrong
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

snassimr,

as Sainath and others have stated, the source of this routine would be nice as it seems to be the only place, from what you've described, where something might be working differently between your two different types of run.
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,
What are the values of following parameters you are using in your job?

TempDateN

TodayDateN

Thanks

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

Post by ray.wurlod »

The computer is incapable of doing anything but exactly what you tell it to do. Therefore, what you have coded is not what you expected to code. That is the main reason we need to see the code of the routine.

Based on your description, it appears that the code is selecting the lesser of the two dates, which is 20010101 (or 2001-01-01). If this is not what you expect, then your algorithm needs refinement.

Can you also post your algorithm design (the document you created before writing the routine)?
Last edited by ray.wurlod on Wed Aug 24, 2005 8:13 pm, 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... document design before coding... have to write that one down. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply