Attach DSJ.JOBPID during job

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

travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Attach DSJ.JOBPID during job

Post by travissolt »

Basically I would like to attach the PID from UNIX into our job so that the Change Data Capture log entries will contain the PID. I have looked at the DSMacro's in the transformer and they do not contain a very robust list of system variables. I have seen similar discussions on-line but no definitive answers (unless I missed them).
Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Which PID would you be interested in. The one that initiates your job? When you run a job, you will see several pid's for that one particular job.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Post by travissolt »

The one initiating the job should work.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Capture your PID using echo $$ within a before-job subroutine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Post by travissolt »

Yeah I figured that if it was not available in the job I would have to grab it out of unix. Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could employ the Transformer stage function GetEnvironment($$) when intializing a stage variable (for the Transformer stage's process ID) or GetEnvironment($PPID) for the job's process ID.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Post by travissolt »

Cool thanks ill give it a shot
travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Post by travissolt »

Can I pass a variable from an ExecSH into datastage? My plan would be to pass echo $$ into a variable which I could then call within data stage. Is this possible?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

ray.wurlod wrote:You could employ the Transformer stage function GetEnvironment($$) when intializing a stage variable (for the Transformer stage's process ID) or GetEnvironment($PPID) for the job's process ID.
That does'nt work for you :?:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Post by travissolt »

I looked up GetEnvironment in the help and this is all it tells me.


The following table lists the functions available in the Utility category (square brackets indicate an argument is optional):

Name
Description
Arguments
Output

GetEnvironment
Return the value of the given environment variable
environment variable (string)
result (string)




I also tried to find it in the transformer and it is not listed in the macros,system variables,functions etc... Without any info on how to use the GEtEnvironment in the help guide I am stumped
travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Post by travissolt »

I went back to the transformer and noticed that the stage variable selection is grayed out so maybe I do not have access to use that item. Or perhaps I need to set one up prior to it becoming available in the transformer.
travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Post by travissolt »

Slowly but surely im catching on. I see i can set a system variable in the transformer properties.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Right click ont he greyed area and define a stage variable. WHen you do, open the window , right click, go to functions, its under utility. Pass $$ as parameter to GetEnvironment().
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
travissolt
Participant
Posts: 51
Joined: Mon Feb 05, 2007 1:53 pm

Post by travissolt »

I tried to right click on the stage variable and it would not work. I can set one up in the transformer properties where it asks for NAME...INITIAL VALUE...SQLTYPE...EXTENDED...Precision...SCALE...DESCRIPTION once defined there the system variable option becomes ungrayed and I can use the variable I set up. I do not see the UTILITY option although I found it in the help section.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Yes, where you see NAME...Initial Value bla bla bla, specify a name, give an initial value of 0 specify it as integer. Hit ok. Then in the transformer you will see your stage variable on the right hand side on the top. If you dont see it, click the fourth icon from the right. That icon, present at the top, hides and shows stage variables. Inside the derivation of the stage variable you will have to right click and go to functions, extent Utility and click on GetEnvironment(). THats the only option under Utility.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply