How do I access Job Parameters from Subroutine
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Job parameters are not global parameters so they are not available to the routines called up by a server or sequence job. The way to retrieve job parameters within a routine is to either pass them in as arguments or to attach the job within the routine and use the DSGetParamInfo command to retrieve parameter values. According to the server job programming guide the DSGetParamInfo routine with the DSJ.PARAMVALUE option will return the current value of the parameter for a running job or the last job run if the job is finished.
I think the first method is better and more robust, if someone renames or removes the job parameter the job recompile will inform the user that they need to change the argument as well.
Vincent McBurney
Data Integration Services
www.intramatix.com
I think the first method is better and more robust, if someone renames or removes the job parameter the job recompile will inform the user that they need to change the argument as well.
Vincent McBurney
Data Integration Services
www.intramatix.com
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
We are going to have to drop you back to four stars. [:D]
Vincent McBurney
Data Integration Services
www.intramatix.com
Vincent McBurney
Data Integration Services
www.intramatix.com
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Check out Parameter Manager for DataStage, from the folks who provide this Forum. [;)]
There's a link at the top of this screen to get you there. You can watch a (video) demo, do a tutorial, download a 30 day evaluation, determining pricing information (it's very reasonable), and even buy it!
Among other things, you can get some kind of globalization of job parameters happening, though not at run time (which is what you were after).
[Potential Conflict of Interest]
If the buyer is outside the Americas, I can supply this software and would earn a commission thereon.
All that said, there's something not right about an assertion in this thread. See my next post.
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
There's a link at the top of this screen to get you there. You can watch a (video) demo, do a tutorial, download a 30 day evaluation, determining pricing information (it's very reasonable), and even buy it!
Among other things, you can get some kind of globalization of job parameters happening, though not at run time (which is what you were after).
[Potential Conflict of Interest]
If the buyer is outside the Americas, I can supply this software and would earn a commission thereon.
All that said, there's something not right about an assertion in this thread. See my next post.
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
One of my pet peeves is folks not checking the return status of DataStage functions. In the current example, this would provide instant identification about why a parameter called FilePath could not have its value returned by DSGetParamInfo (possibilities include invalid job handle, no such parameter (misspelled/miscased), invalid value (supplied value not a pathname) and so on).
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
ParamName = "FilePath"
PathName = DSGetParamInfo(hJob, ParamName, DSJ.PARAMVALUE)
Begin Case
Case PathName = DSJ.BADHANDLE
Msg = "Job not attached (DSGetParamValue)."
Case PathName = DSJ.BADPARAM
Msg = "Parameter " : Quote(ParamName) : " not found in job."
* ... and so on
End Case
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
ParamName = "FilePath"
PathName = DSGetParamInfo(hJob, ParamName, DSJ.PARAMVALUE)
Begin Case
Case PathName = DSJ.BADHANDLE
Msg = "Job not attached (DSGetParamValue)."
Case PathName = DSJ.BADPARAM
Msg = "Parameter " : Quote(ParamName) : " not found in job."
* ... and so on
End Case
Raggid
Vincent is correct. You need to pass it as an argument. If I am reading your message correctly the problem may be that a parameter name should not have spaces in it. If you have a parameter named file path then change it to FilePath. Next call your routine like this MyRoutine(FilePath) in a derivation. If you are calling it from job control then the syntax is a little different.
Thanks Kim.
Kim Duke
DwNav - ETL Navigator
www.Duke-Consulting.com
Vincent is correct. You need to pass it as an argument. If I am reading your message correctly the problem may be that a parameter name should not have spaces in it. If you have a parameter named file path then change it to FilePath. Next call your routine like this MyRoutine(FilePath) in a derivation. If you are calling it from job control then the syntax is a little different.
Thanks Kim.
Kim Duke
DwNav - ETL Navigator
www.Duke-Consulting.com
when you call routine, you have to pass job parameters to routine parameter. Then you can access job parameter.
quote:Originally posted by raggid
[br]I have a lot of parameters defined and it would be messy to have to redefine then in the subroutine I am using.
How do I access the values in already defined job parameters?
Thanks in advance,
Raggy
quote:Originally posted by raggid
[br]I have a lot of parameters defined and it would be messy to have to redefine then in the subroutine I am using.
How do I access the values in already defined job parameters?
Thanks in advance,
Raggy