Routine for DSJOBGETINFO

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
bobbysridhar
Premium Member
Premium Member
Posts: 41
Joined: Sun Mar 09, 2008 8:12 pm

Routine for DSJOBGETINFO

Post by bobbysridhar »

Hi,
I need to populate an audit table with columns
job start time
job end time
elapsed time
inserted records
updated records
rejected records
I need to have at job level for each job.
I tried different routines like DSJOBGETINFO,DSJOBLINKINFO AND SO ON
But not getting the desired results.
Could somebody please provide me with the routine.
k.v.sreedhar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How about you show us what you tried?

And maybe start by getting the routine names correct. For example, it's DSGetJobInfo(), not DSJobGetInfo().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Download ETLstats from Kim Duke's website - this package does all that and more. (And it's free.)
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 »

As noted, sharing with us what exactly you've tried so far and what in the heck "not getting the desired results" means can help us help put you on the right track.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bobbysridhar
Premium Member
Premium Member
Posts: 41
Joined: Sun Mar 09, 2008 8:12 pm

Post by bobbysridhar »

Hi,
This is the code to get reject link I wrote.
Could somebody help me in getting the desired result

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
$INCLUDE DSINCLUDE DSJ_XFUNCS.H

vActiveStages = 0
i = 0 ; n=0
SrcStageName = 0
SrcStage = 0
ThisJobName = 0
vActiveStageslink = 0
SrcRecCount=0

      ** Check if the job is the current one. In this case do not try to attach but use DSJ.ME

      ThisJobName= DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
      If ThisJobName<>JobName Then
         JobHandle = DSAttachJob(JobName, DSJ.ERRFATAL)
      End Else
         JobHandle=DSJ.ME
      End

      Result = DSGetJobInfo (JobHandle, DSJ.JOBSTATUS)

vActiveStages = DSGetJobInfo (JobHandle, DSJ.FULLSTAGELIST)

CountOfStages = DCount(vActiveStages,",")

*** Getting the target stage name and the no. of records processed by the link preceding the stage.

***Please note that the target stage name should be standardised.

For n = 1 to CountOfStages
        TgtStage = Field(vActiveStages,",",n)
        UNTIL RIGHT(TgtStage,4) = "REJT"
NEXT n

TgtStageName = TgtStage

TgtStageLnk = DSGetStageInfo (JobHandle, TgtStageName, DSJ.LINKLIST)

TgtRecCount = DSGetLinkInfo (JobHandle, TgtStageName, TgtStageLnk, DSJ.LINKROWCOUNT)

Ans=TgtRecCount
k.v.sreedhar
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I'm not at a place where I can check, but I've done this type of log information several times before and it has always been a bit work to get functioning correctly. The code you've posted looks good and you haven't stated which part isn't working - I would guess that everything but the innermost GetLinkInfo() is working as expected, is that the case? You will need to add the calls to get the passive stage information in order to see if you will correctly read the reject link data.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As Arnd notes, which part of this does not seem to be working? What values are you passing in to the routine - JobName? Anything else?
-craig

"You can never have too many knives" -- Logan Nine Fingers
bobbysridhar
Premium Member
Premium Member
Posts: 41
Joined: Sun Mar 09, 2008 8:12 pm

Post by bobbysridhar »

I have error handling after oci stage. Target stage count gives total number of records. But I want to get inserted records,update records,rejected records seperately. Need to modify my routine to get those records seperately. I would be greatful if someone provide me the modifications.
k.v.sreedhar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do you have separate links for inserts, updates and deletes? If so you can capture those link row counts separately. If not, there is no solution.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bobbysridhar
Premium Member
Premium Member
Posts: 41
Joined: Sun Mar 09, 2008 8:12 pm

Post by bobbysridhar »

yes i have seperate links for insert,update,reject records.
i need to have job start time,end time and elapsed time also.
k.v.sreedhar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do they follow a consistent naming convention like you seem to be doing with "REJT" records? If so, you could just expand what you are doing to recognize and classify those as well while you loop through the lists you are building.

You can use the DSGetJobInfo() routine to capture both the DSJ.JOBSTARTTIMESTAMP and DSJ.JOBLASTTIMESTAMP strings. Computing the elapsed time is up to you as far as I know.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

SecondsSinceFromTimestamp() function.
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