Hi
I have a Multiple Instance enabled job which runs for 60 tables. Table name is used as Invocation ID.
I have created a sequence to form a loop which executes the job for all 60 Invocation IDs( Target table name). There is no dependency between one table load to any of other table load from these 60 table loads.
Though i have formed loop to execute the job one after another Invocation ID, I am not checking completion of one load to start another load to let the loads continue in parallel. I need to form another loop to get Job Status for the 60 Invocation IDs.
The following step is what stopping me to complete the sequence.
At the end of job sequence, I want to get the Job Status for each Invocation ID. If any of the loads for an Invocation ID has got aborted, I need to abort the sequence.
I am sure that I need to use kind of unix commands in an Execute Command Activity to get it done with in the second loop. As the original job status is in compiled staus, I dont know how to get Job Status for Invocation ID.
Please help me on this.
Thanks in Advance
TPons
To get Job Status for jobs with Invocation ID
Moderators: chulett, rschirm, roy
There are a couple of methods of implementing this, but in your case you already have a loop in your job sequence to start the jobs so you have a list of instance names - so I would suggest you write a BASIC function which accepts your 60 table names as an input parameter and looks as follows:
(Parameter "InstanceList", comma separated)
I never use GOTO in my programs, but I thought I'd keep this simple and not use the BASIC "DEL" function to strip elements from a dynamic array.
If Ans = 0 then none of the jobs failed, otherwise it returns the number of failed jobs.
(Parameter "InstanceList", comma separated)
Code: Select all
Ans = 0
FOR i = 1 TO DCOUNT(InstanceList,",")
JobName = 'MyJobName.':FIELD(InstanceList,',',i)
JobHandle = DSAttachJob(JobName,DSJ.ERRNONE)
TryAgain:
JobStatus = DSGetJobInfo(JobHandle,DSJ.JOBSTATUS)
IF (JobStatus=DSJS.JOBRUNNING)
THEN
SLEEP 10
GOTO TryAgain:
END
IF NOT(JobStatus=DSJS.RUNOK OR JobStatus=DSJS.RUNWARN) THEN Ans += 1
Dummy = DSDetachJob(JobHandle)
NEXT i
If Ans = 0 then none of the jobs failed, otherwise it returns the number of failed jobs.
I am running the job through Job Activity which is set Invocation ID as Table Name and Triggering Expression Type as Unconditional.
As Job Activity output link is given to End Loop Activity and this link has unconditional trigger type, I believe that the loop continues till all Invocation IDs without waiting for completion of one load.
Please correct me if i am wrong.
Thanks
TPons
As Job Activity output link is given to End Loop Activity and this link has unconditional trigger type, I believe that the loop continues till all Invocation IDs without waiting for completion of one load.
Please correct me if i am wrong.
Thanks
TPons