Page 1 of 1

How to get Job Type (Sequence, Server or EE Job)

Posted: Tue Jun 27, 2006 12:01 am
by nick.bond
Given a job name is it possible and if so what is the BASIC code to find out what the "type" of job it is from within a routine.

i.e. is it a Server Job, an Enterprise Job or a Sequence Job.

Thanks, Nick.

Posted: Tue Jun 27, 2006 12:38 am
by ArndW
The job type resides in a column in the DS_JOBS file. I don't know of any published API routine such as DSGetJobInfo() whre this information is available, so the only way to get this would be to read the DS_JOBS file - and that will only work until the repository is changed at version 8.

You can either open the DS_JOBS file and read the record or you can issue a SELECT statement. The SELECT is easier and more future-proof in that it might be easily changed, reading the DS_JOBS is somewhat faster.

You might need to change my code around, as I am not at a DataStage machine and am typing freehand.

Code: Select all

   OPEN '','DS_JOBS' TO DsJobsFilePtr ELSE CALL DSLogFatal('Unable to open DS_JOBS file, status is ':STATUS(),'')
   READV JobType FROM DsJobsFilePtr, JobName, 6
   ELSE
      JobType = '?'
      CALL DSLogWarn('Unable to find job "':JobName:'" in DS_JOBS.','')
   END
   CLOSE DSJobsFilePtr
JobType 0 is a Server, 2 is a Sequence and 3 is a PX Job.

The other method is to issue a

Code: Select all

   EXECUTE 'SELECT JOBTYPE FROM DS_JOBS WHERE JOB = ':JobName:';' CAPTURING Output RETURNING ErrorCode
The string "Output" will have the text and you need to parse the job type from that string.

Posted: Tue Jun 27, 2006 12:41 am
by kumar_s
You have JOBTYPE in DS_JOBS to indicate this.

Server jobs - 0
JobSequnce - 2
PX Jobs - 3

Posted: Tue Jun 27, 2006 12:51 am
by ray.wurlod
In case anyone is wondering, 1 is mainframe job.

Posted: Tue Jun 27, 2006 6:55 am
by DSguru2B
Actually i was. Thanks Ray. You really working on the RMM stage arent you :wink:

Posted: Tue Jun 27, 2006 7:01 am
by chulett
That stage may be here sooner than you think! :lol:

Posted: Tue Jun 27, 2006 7:04 am
by DSguru2B
Wow. An intelligent computer that can read a persons mood just by the motion of the eyebrows. O they will have to do better than that to even come close to RMM stage :twisted:

Posted: Tue Jun 27, 2006 7:51 pm
by nick.bond
Thanks.

p.s. what's RMM?

Posted: Tue Jun 27, 2006 7:55 pm
by kcbland
Read My Mind