Shared Container

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
priyankalaisatwar
Participant
Posts: 11
Joined: Wed Aug 28, 2013 6:38 am

Shared Container

Post by priyankalaisatwar »

hi,
I have one reuirement that
I have one Table which contains information about all job LOGS.
Jobnam, Status, startdate, enddate

I want to develop reusable component in such a way that,
In the starting of the job I will call that shared container. It will insert one row for that Job like:- Job1,Started,2013-09-18,Null

And at the end of the job again I will call that Shared container it will just update that records with status and end date:-
Job1,Completed,2013-09-08 01:00:00,2013-09-18 10:00:00 like this.
Please suggest any feasible way to develop this?
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

You can design a job with multiple instance which will insert the job log.

Design a sequence and call this job with some instance before your main job starts and call it again with another instance after main job finishes.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

While using a shared container is feasible, I would use either the Job-Sequence approach mentioned earlier or, as I usually do, use the Before-Job and After-Job subroutine calls to perform this logging directly using BASIC-Code or to use the BASIC-Code to start up a background PX job which will do the logging.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

ArndW wrote: as I usually do, use the Before-Job and After-Job subroutine calls to perform this logging directly using BASIC-Code or to use the BASIC-Code to start up a background PX job which will do the logging.
Thats interesting,can you please share a basic code to trigger a job.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

It is trivial code, you create your Before-Job or After-Job routine, and within the routine do something like:

Code: Select all

   JobHandle = DSAttachJob('MyJob',DSJ.ERRFATAL)
   IF NOT(JobHandle)
   THEN
      CALL DSLogWarn('Oops, unable to open Job MyJob.', "JobControl")
   END
   ELSE 
      ************************************************
      ** If the job isn't running yet then start it **
      ************************************************
      JobStatus = DSGetJobInfo(JobHandle,DSJ.JOBSTATUS)
      IF JobStatus # DSJS.RUNNING
      THEN
         JobHandle = DSPrepareJob(JobHandle)
         ErrCode = DSSetParam(JobHandle,"$Param1", "$PROJDEF")
         ErrCode = DSSetParam(JobHandle,"$Param2", "$PROJDEF")
         ErrCode = DSSetParam(JobHandle,"$Param3", "$PROJDEF")
         ErrCode = DSSetParam(JobHandle,"$Param4", "$PROJDEF")
         ErrCode = DSSetDisableProjectHandler(JobHandle, @FALSE)
         ErrCode = DSSetDisableJobHandler(JobHandle, @FALSE)
         ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL)
         ErrCode = DSDetachJob(JobHandle)
      END ;** of IF-THEN-ELSE Job is already running
      Dummy = DSDetachJob(JobHandle)
   END ;** of IF-THEN-ELSE Job couldn't be attached to
priyankalaisatwar
Participant
Posts: 11
Joined: Wed Aug 28, 2013 6:38 am

Post by priyankalaisatwar »

Can you please elaborate it more
ArndW wrote:It is trivial code, you create your Before-Job or After-Job routine, and within the routine do something like:

Code: Select all

   JobHandle = DSAttachJob('MyJob',DSJ.ERRFATAL)
   IF NOT(JobHan ...[/quote]
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I did elaborate more, but that part was "Premium Content" since I felt it went into more depth than a simple answer.
Post Reply