Using dsjob -run -param to pass parameters
Moderators: chulett, rschirm, roy
Using dsjob -run -param to pass parameters
Hi,
I need to use the dsjob -run -param to pass parameters to a DataStage job but the parameter values need to be prompts. How do i do this from the unix command line.
Tx.
Faeez
I need to use the dsjob -run -param to pass parameters to a DataStage job but the parameter values need to be prompts. How do i do this from the unix command line.
Tx.
Faeez
What do you mean by "the parameter values need to be prompts"?
You have to know what values to use from the command line, there's no 'prompting' there. And you only need to pass in values that need to be overridden, otherwise they will take their default values.
![Confused :?](./images/smilies/icon_confused.gif)
You have to know what values to use from the command line, there's no 'prompting' there. And you only need to pass in values that need to be overridden, otherwise they will take their default values.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 11
- Joined: Thu Feb 22, 2007 7:53 am
Re: Using dsjob -run -param to pass parameters
You need to create a menu program using Unix which will prompt you for the input, then you could use them as parameter value. You could find out examples how to write menu program using Unix in online search.
fkana wrote:Hi,
I need to use the dsjob -run -param to pass parameters to a DataStage job but the parameter values need to be prompts. How do i do this from the unix command line.
Tx.
Faeez
Are you sure there aren't merits to the idea of ad-hoc executions of a jobstream? I've been in environments where this has been done. In fact, the sample ksh script I've posted here verifies that all required parameters are passed when engaging the jobstream.
Last edited by kcbland on Mon Mar 19, 2007 8:43 am, edited 1 time in total.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Sorry guys for the harsh words, in a bad mood this morning. But my understanding of the question was of a gui prompt. If anything other than that then I must have missed it.
Even I have scripted solutions where the parameters are being passed during execution, but thats via another file and not a prompt.
Once again, my apologies.
Even I have scripted solutions where the parameters are being passed during execution, but thats via another file and not a prompt.
Once again, my apologies.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
THis is what i need to do:
I need to select data between variable date ranges.
MY select statement looks like this:
select *
from table
where timestamp between #StartDate# and #EndDate#;
I have non-DataStage users that get a unix script that they execute. The script includes the dsjob -run -param. SO when they double click on the script they should have the ability to add the start and end dates manually which then get passed on to the rest of the job sequencers.
Keep in mind that these guys dont have access to DataStage. Only to the unix script.
Tx.
Faeez
I need to select data between variable date ranges.
MY select statement looks like this:
select *
from table
where timestamp between #StartDate# and #EndDate#;
I have non-DataStage users that get a unix script that they execute. The script includes the dsjob -run -param. SO when they double click on the script they should have the ability to add the start and end dates manually which then get passed on to the rest of the job sequencers.
Keep in mind that these guys dont have access to DataStage. Only to the unix script.
Tx.
Faeez
You're going to want to wrap the dsjob executable in a script that has the necessary prompts and formats the dsjob command accordingly. I suggest you allow the script to look for either a fully qualified command line with options set, else go into a "prompt" mode to get the desired values.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Here's an example script that checks for a set number of command line values prior to running dsjob. Consider doing something similar, or using the options capability in ksh.
viewtopic.php?t=85578
viewtopic.php?t=85578
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
If you know shell scripting then write it yourself.
dsjob -lparams Project Job
Will get you a list of params.
dsjob -paraminfo DwNav ParameterizeDSNs pDSN2Change
Will get you parameter information like the prompt and default values for parameter pDSN2Change in job ParameterizeDSNs in project DwNav.
You can then validate the parameter name use the prompt and default to whatever the job had.
dsjob -lparams Project Job
Will get you a list of params.
dsjob -paraminfo DwNav ParameterizeDSNs pDSN2Change
Will get you parameter information like the prompt and default values for parameter pDSN2Change in job ParameterizeDSNs in project DwNav.
You can then validate the parameter name use the prompt and default to whatever the job had.
Mamu Kim
We do get the parameter values out of a file. We do validate the parameter name against
dsjob -lparams Project Job
We have a global list of parameter values which can be overridden by a job level parameter file.
We have another script which will build these parameter files from the defaults.
The same script will display the log of this job when it finishes.
Here is the code to trap a kill signal.
If you kill this script the job keeps running. This code will stop the job as well.
You are welcome Craig.
Our job in this forum is not to hand you solutions or code them for you but to point you in the right direction. These code snipets should help.
dsjob -lparams Project Job
We have a global list of parameter values which can be overridden by a job level parameter file.
We have another script which will build these parameter files from the defaults.
The same script will display the log of this job when it finishes.
Here is the code to trap a kill signal.
Code: Select all
let JobRunningSw=0
# -----------------------------------------------------------------
function ExitProcFunction
{
# -----------------------------------------------------------------
# This function will stop the DataStage job running.
# -----------------------------------------------------------------
# -----------------------------------------------------------------
# If the exit code is specified, exit with that code.
# -----------------------------------------------------------------
if (( $# > 0 ))
then
if (( ${JobRunningSw} ))
then
echo "$DSPath/dsjob -stop $ProjectName $JobName"
$DSPath/dsjob -stop $ProjectName $JobName
fi
CatLogFunction
exit $1
else
exit 0
fi
}
# -----------------------------------------------------------------
# trap everything
# -----------------------------------------------------------------
trap 'ExitProcFunction 1' 1
trap 'ExitProcFunction 2' 2
trap 'ExitProcFunction 3' 3
trap 'ExitProcFunction 4' 4
trap 'ExitProcFunction 5' 5
trap 'ExitProcFunction 6' 6
trap 'ExitProcFunction 7' 7
trap 'ExitProcFunction 8' 8
trap 'ExitProcFunction 9' 9
trap 'ExitProcFunction 10' 10
trap 'ExitProcFunction 11' 11
trap 'ExitProcFunction 12' 12
trap 'ExitProcFunction 13' 13
trap 'ExitProcFunction 14' 14
trap 'ExitProcFunction 15' 15
You are welcome Craig.
Our job in this forum is not to hand you solutions or code them for you but to point you in the right direction. These code snipets should help.
Mamu Kim