The DSJ.JOBELAPSED 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
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

The DSJ.JOBELAPSED bug

Post by thurmy34 »

Hi,
I just discovered that DSJ.JOBELAPSED return 0 when a job start before midnight and end after.
It bother me a little so i wrote this :

Code: Select all

* Gestion du passage de Minuit (pas de l'execution sur plusieurs jour)
                     JobStart=DSGetJobInfo(Action <ActionOrder, ParallelOrderWait, COL_HANDLE>,DSJ.JOBSTARTTIMESTAMP)
                     JobEnd=DSGetJobInfo(Action <ActionOrder, ParallelOrderWait, COL_HANDLE>, DSJ.JOBLASTTIMESTAMP)
                     DayJobStart=Iconv(Field(JobStart," ",1),"D-YMD[4,2,2,")
                     DayJobEnd=Iconv(Field(JobEnd," ",1),"D-YMD[4,2,2,")
                     NbDay=DayJobEnd-DayJobStart
                     HMJobStart=Iconv(Field(JobStart," ",2),"MTS")
                     HMJobEnd=Iconv(Field(JobEnd," ",2),"MTS")
                     if NbDay=0 then
                        TempExec=HMJobEnd-HMJobStart
                     end
                     else
                        Midnight=Iconv("23:59:59","MTS")
                        HMJobStart=Midnight-HMJobStart
                        TempExec=HMJobEnd+HMJobStart
                     end
                     TempExec=Oconv(TempExec,"MTS")
Hope This Helps
Regards
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Had you downloaded my date routines you might have saved yourself some design effort.

Reuse, recycle.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

Hi Ray
Your routines are fine but i don't understand the bold part of this code
(from the AddYears routine)

Ans = Iconv(NewYear "R%4" : "-" : OriginalMonth : "-" : NewDay "R%2", "DYMD")
Hope This Helps
Regards
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's a way of formatting to ensure leading zeroes. Look at the Fmt() function for possible values. Following an expression with a space and a format designator is another way in DataStage BASIC to achieve the same result. I could equivalently have written:
Ans = Iconv(Fmt(NewYear,"R%4") : "-" : Fmt(OriginalMonth,"R%2") : "-" : Fmt(NewDay,"R%2"), "DYMD")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

There is a routine included with EtlStats which will calculate the elapsed time because of this bug.
Mamu Kim
Post Reply