Invalid Date issue bug

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
clarcombe
Premium Member
Premium Member
Posts: 515
Joined: Wed Jun 08, 2005 9:54 am
Location: Europe

Invalid Date issue bug

Post by clarcombe »

I have a date in the format YYYYMMDD which is tested by the following routine (stolen from Ray's IsValid)

Test1 = Iconv(fieldval, "DYMD[4,2,2]")
Status1 = Status()

When I pass the value 20080931, this passes as valid which is incorrect as September only has 30 days.

When I pass 20080932 this is correctly handled and fails

Bar hardcoding month checks i.e. writing my own routine, is there any other internal function that can be used ?
Colin Larcombe
-------------------

Certified IBM Infosphere Datastage Developer
Romy
Participant
Posts: 26
Joined: Thu Nov 13, 2008 3:37 am
Location: Chennai

Post by Romy »

Hi,

In the DS Manager there is in build transform to check whether the input date is valid one or not.

Go to Transforms--> SDK-->Date-->Generic. In this you have transform name "DateGenericIsDate". Using this you can check whether the input date is recognised as valid or not. Returns 1 if a good date, 0 if a bad or unrecognised date.

Try this.
clarcombe
Premium Member
Premium Member
Posts: 515
Joined: Wed Jun 08, 2005 9:54 am
Location: Europe

Post by clarcombe »

Thanks for the suggestion.

I have tried calling this in a routine with the following [not all of the routine is shown below]

Code: Select all

      DEFFUN DateGenericToTimeStamp(InputDate) calling "DSU.DateGenericToTimeStamp"

               Status1 = DateGenericToTimeStamp(fieldval)
               Call DSLogInfo (Status1 ,"ValidLigne")
But I get the following error in Director

Code: Select all

Program "DSU.ValidLigne": Line 88, Unable to open the operating system file "DSU_BP.O/DSU.DateGenericToTimeStamp".
[ENOENT] No such file or directory
Program "DSU.ValidLigne": Line 88, Unable to load file "DSU.DateGenericToTimeStamp".
Program "DSU.ValidLigne": Line 88, Unable to load subroutine.
Attempting to Cleanup after ABORT raised in stage BI1_200_ENT016.PSN_BI_EXCEL___000033_000_BI1_200_ENT016.LectureDonneeDataStage Phantom Aborting with @ABORT.CODE = 3
Can a SDK transform be used in a routine. If not, how can I access it ?
Colin Larcombe
-------------------

Certified IBM Infosphere Datastage Developer
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, transforms of any kind cannot be used in routines. You need to include their equivalent code into the routine itself.
-craig

"You can never have too many knives" -- Logan Nine Fingers
clarcombe
Premium Member
Premium Member
Posts: 515
Joined: Wed Jun 08, 2005 9:54 am
Location: Europe

Post by clarcombe »

Any ideas how to get at the code ?

Does the fact that it is in sdk\Date\Generic mean that I can't access it ? I can't seem to find anyway to look at the code
Colin Larcombe
-------------------

Certified IBM Infosphere Datastage Developer
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There is no "code" per se with a transform as they are an interlude to existing routines. Everything they are is in the "Definition" prompt of the Details tab and that's what you'd need to include.
-craig

"You can never have too many knives" -- Logan Nine Fingers
clarcombe
Premium Member
Premium Member
Posts: 515
Joined: Wed Jun 08, 2005 9:54 am
Location: Europe

Post by clarcombe »

Thats the problem

The definition is DateGenericToTimeStamp(%InputDate%, 0). When I try to include this in my routine it fails with the error mentioned previously.

I have added hardcode which checks the number of days according to the month specified. I haven't included leapyears but too bad.
Colin Larcombe
-------------------

Certified IBM Infosphere Datastage Developer
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Hang on a minute. The DSU. prefix indicates that it's a Routine - you should be able to see it in your Repository. However the message suggests that it's not there. Can you see it in another project? If so you can export it from there (if read-only object export is enabled) and import it into the project from which it's missing.
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 »

Looks to me that the "DateGenericToTimestamp" routine may not be compiled, as what cannot be found is "DSU_BP.O/DSU.DateGenericToTimeStamp".
-craig

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