Multi-instance job

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
ashcar
Charter Member
Charter Member
Posts: 28
Joined: Mon Feb 09, 2004 11:54 am
Location: Minneapolis

Multi-instance job

Post 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..
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post 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.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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>
Mamu Kim
Post Reply