A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.
Moderators: chulett , rschirm , roy
subhasis.raha
Participant
Posts: 10 Joined: Tue Apr 03, 2012 9:19 am
Post
by subhasis.raha » Thu Sep 04, 2014 3:55 am
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.
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Thu Sep 04, 2014 8:00 am
Kindly help us out as well. What job information are you after, exactly?
-craig
"You can never have too many knives" -- Logan Nine Fingers
Mike
Premium Member
Posts: 1021 Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL
Post
by Mike » Thu Sep 04, 2014 8:00 am
Have you tried the DSJobController macro?
Mike
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Thu Sep 04, 2014 8:01 am
Hey, stop following me around and posting at the exact same time!
-craig
"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Thu Sep 04, 2014 4:52 pm
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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
subhasis.raha
Participant
Posts: 10 Joined: Tue Apr 03, 2012 9:19 am
Post
by subhasis.raha » Fri Sep 05, 2014 1:40 am
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 )
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 05, 2014 7:17 am
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?
-craig
"You can never have too many knives" -- Logan Nine Fingers
subhasis.raha
Participant
Posts: 10 Joined: Tue Apr 03, 2012 9:19 am
Post
by subhasis.raha » Fri Sep 05, 2014 7:32 am
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.
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 05, 2014 7:41 am
Details, please. Show us your routine. Oh and once you get the name, what exactly are you planning on doing with it?
-craig
"You can never have too many knives" -- Logan Nine Fingers
subhasis.raha
Participant
Posts: 10 Joined: Tue Apr 03, 2012 9:19 am
Post
by subhasis.raha » Fri Sep 05, 2014 9:07 am
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 ?
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 05, 2014 9:20 am
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.
-craig
"You can never have too many knives" -- Logan Nine Fingers
subhasis.raha
Participant
Posts: 10 Joined: Tue Apr 03, 2012 9:19 am
Post
by subhasis.raha » Fri Sep 05, 2014 9:27 am
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.
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 05, 2014 9:57 am
Full standard Windows-style help is built into the product. It's also online, for example
here for what we're discussing. That 'information'?
-craig
"You can never have too many knives" -- Logan Nine Fingers
subhasis.raha
Participant
Posts: 10 Joined: Tue Apr 03, 2012 9:19 am
Post
by subhasis.raha » Fri Sep 05, 2014 10:08 am
Could you please let me know what is not valid in the below statement :
jobname = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 05, 2014 10:16 am
Nothing, so obviously we're missing something. Can you show us your entire routine?
-craig
"You can never have too many knives" -- Logan Nine Fingers