DSGetJobInfo

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

DSGetJobInfo

Post by subrat »

Hi,

Requirement: To get Sequence name(output) corresponding to Job name(input) through below routine.

$include DSINCLUDE JOBCONTROL.H

JobName=Arg1
JobHandle = DSAttachJob ("JobName", DSJ.DSJ.ERRFATAL)
controllerList=DSGetJobInfo(JobHandle, DSJ.STAGENAME)
ErrCode=DSDetachJob(JobHandle)
Ans=controllerList

But everytime i am executing it by passing a job name, it returning 0/-1 etc.... not the sequence name.

Please suggest me where i am wrong.

Thanks
Subrat
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Try

Code: Select all

controllerlist=DSGetJobInfo(JobHandle,DSJ.JOBCONTROLLER)
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

STAGENAME will not retun the sequence name.

if you can get the newest event id for and then this command

dsjob -logdetail <Project name> <job Name> <newest event id -4> <newest event id>|grep DSJobController

this will return the sequence of the job
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

Post by subrat »

Thanks for the replay.

I used the " controllerList=DSGetJobInfo(JobHandle,DSJ.DSJobController)" as well but getting the same output (-1/0 etcc...)

Seeking ur suggestion
keshav0307 wrote:STAGENAME will not retun the sequence name.

if you can get the newest event id for and then this command

./dsjob -logdetail <Project name> <job Name> <newest event id -4> <newest event id>|grep DSJobController

this will return the sequence of the job
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

keshav0307 wrote:STAGENAME will not retun the sequence name.

if you can get the newest event id for and then this command

dsjob -logdetail <Project name> <job Name> <newest event id -4> <newest event id>|grep DSJobController

this will return the sequence of the job
Hi Keshav,
One simple question.."grep DSJobController" will give all the jobs used in the a particular sequence.. :? Since i cannot test "logdetail" command ....that's why i am asking.. :)
http://findingjobsindatastage.blogspot.com/
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Are you passing in
"Jobname"
or the actual name of the job you want to find the controller for? Can you do a test and either print out or return the JobHandle variable value?
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

the requirement is to get Sequence name corresponding to a Job

so you will passing a job name and get the sequence name where this job is called
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

JobName should not be quoted in DSAttachJob - this means that you are trying to attach a job that is actually called "JobName".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

Post by subrat »

Thanks Ray. Now it is working....

I have one more question.. I have some 1000 DS Jobs.
I hav created a simple job where it will take these 1000 jobs in sequential file and in Transformaer of the job i have used the above routine to get the corresponding sequence which will be come in my output sequential file.

But when i am running this job i am getting the below error.

SEQTEST..Transformer_4 (fatal error from DSAttachJob): Job control fatal error (-12)
(DSOpenJob) Cannot open job DLY_Load_ABC_ABC040_Cust_OAT. - not a runnable job

This may be happening bcos some of the jobs are not compiled.. But anyhow i want my job should run and give me my desired output(sequence name)...

Please suggest..

Thanks
Subrat


ray.wurlod wrote:JobName should not be quoted in DSAttachJob - this means that you are trying to attach a job that is actually called "JobName". ...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You simply can not attach a job that is in a "not compiled" state.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
skumar
Participant
Posts: 88
Joined: Thu May 25, 2006 5:11 am
Location: Hyderabad

Post by skumar »

Ray,

I am also having the same issue and i am able to get the output if both the job and sequence are in finished state.Can u please suggest me will it return the sequence name only with "Finished" state or "Compiled" state also???

Thanks in advance.....

Regards,
skumar.
Post Reply