Page 1 of 2

Job Information required in before subRoutine

Posted: Thu Sep 04, 2014 3:55 am
by subhasis.raha
Hi All,

How Can I get the information of a calling job in Before Sub Routine.

example , if I am running job A,
This Job A is got attached with a before Subroutine and through this subroutine how can I get the information of the calling job (JOB A).


Kindly help me out.

Posted: Thu Sep 04, 2014 8:00 am
by chulett
Kindly help us out as well. What job information are you after, exactly?

Posted: Thu Sep 04, 2014 8:00 am
by Mike
Have you tried the DSJobController macro?

Mike

Posted: Thu Sep 04, 2014 8:01 am
by chulett
Hey, stop following me around and posting at the exact same time! :P

Posted: Thu Sep 04, 2014 4:52 pm
by ray.wurlod
Once you're in the before-job subroutine the job is already attached and is available via the job handle DSJ.ME.

Therefore you can use the DataStage API functions to do any discovery using that as the job handle (first argument). For example

Code: Select all

TrueJobName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
Place the following at the beginning of your code.

Code: Select all

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
The JOBCONTROL.H header record contains definitions of all the constants and prototypes for DataStage API functions.

Posted: Fri Sep 05, 2014 1:40 am
by subhasis.raha
I have tried DSJ.ME , to get the job name detail but not able to find the job name , I want the job name in Before sub routine ( the job which is attached with before sub routine )

Posted: Fri Sep 05, 2014 7:17 am
by chulett
Exactly how did you try this? You should be calling DSGetJobInfo() with that as the JobHandle and using the DSJ.JOBNAME as the InfoType. Is that the path you took?

Posted: Fri Sep 05, 2014 7:32 am
by subhasis.raha
Yes.

I have tried with the same option what you described, but I am not able to get the valid job name.

Job name is coming as null.

Posted: Fri Sep 05, 2014 7:41 am
by chulett
Details, please. Show us your routine. Oh and once you get the name, what exactly are you planning on doing with it?

Posted: Fri Sep 05, 2014 9:07 am
by subhasis.raha
I tried to get the job name information as below :

jobName = DSGetJobInfo( DSJ.ME,JOBNAME )


I need the job in the before sub routine .

When before subroutine is getting called , that time the job has not been started, is this the reason that I am not getting the job information ?

Posted: Fri Sep 05, 2014 9:20 am
by chulett
Your InfoType parameter is invalid, see my post or the docs. And the job itself has started at that point but nothing on the canvas has run.

Posted: Fri Sep 05, 2014 9:27 am
by subhasis.raha
Sorry , I used the following command :

jobname = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)

Kindly let me know the link where from I can get the information.

Posted: Fri Sep 05, 2014 9:57 am
by chulett
Full standard Windows-style help is built into the product. It's also online, for example here for what we're discussing. That 'information'?

Posted: Fri Sep 05, 2014 10:08 am
by subhasis.raha
Could you please let me know what is not valid in the below statement :

jobname = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)

Posted: Fri Sep 05, 2014 10:16 am
by chulett
Nothing, so obviously we're missing something. Can you show us your entire routine?