Page 1 of 1

Multi-instance job

Posted: Mon Jan 24, 2005 10:26 am
by ashcar
Hi,

I have a multi-instance sequence job which runs for N number of load id's which vary everyday, only after this all the N load id's are done i would like to start another Multi-instance sequence which processes all the load -ids processed by the earlier job .....is there anyway in DataStage where my second job knows that the multi-instance job is complete for all the load ids from the previous job and picks those load ids again ..the second job aggregates claims from Oracle table..

Posted: Mon Jan 24, 2005 10:30 am
by Sainath.Srinivasan
If the number if runs of first job are in parallel and are fixed number of times, you can use the 'Sequencer' stage in Job Sequence with 'ALL' option and connect a link from your first job into it and second job from it.

If you cannot determine the number of runs or timings, you may be better off creating a temporary table to contain all the run detail to control the flow and a job that is scheduled periodically to check whether you have obtained all necessary entries to kick-off the next set.

Posted: Mon Jan 24, 2005 1:54 pm
by kduke
Here is a code snipet which gets all the invocation ids for a job. It should get you close.

Code: Select all

      JobStatuses = ''
      open 'DS_JOBS' to DS.JOBS else goto TheEnd
      open 'DS_JOBOBJECTS' to DS.JOBOBJECTS else goto TheEnd
* ----------------------------------------------------------------------
      ecmd='SSELECT DS_JOBS UNLIKE "\\..." WITH CATEGORY = "':JobCategory:'" TO 1'
      execute ecmd capturing output
      Cnt = 0
* ----------------------------------------------------------------------
      loop while readnext id from 1
         Cnt += 1
         JobName = id
         JobStatuses<1, Cnt> = JobName
         read JobRec from DS.JOBS, JobName then
            JobNo = JobRec<5>
            read RootRec from DS.JOBOBJECTS, 'J\':JobNo:'\ROOT' then
* ----------------------------------------------------------------------
               if RootRec<59> = '1' then
                  ecmd='SSELECT RT_STATUS':JobNo:' WITH F1 = "INVOCATION" TO 2'
                  * print ecmd
                  execute ecmd capturing output
                  * print output
* ----------------------------------------------------------------------
                  loop while readnext InvocId from 2
                     Cnt += 1
                     * print InvocId
                     JobName = InvocId
                     JobStatuses<1, Cnt> = JobName
                  repeat
               end
            end
         end
      repeat
* ----------------------------------------------------------------------
      NoJobs = Cnt
      for Cnt=1 to NoJobs
         JobName = JobStatuses<1, Cnt>