How to pass parameters to a generic job script?
Moderators: chulett, rschirm, roy
How to pass parameters to a generic job script?
I am developing generic UNIX script to call DataStage Job and stuck with how to form the logic for $paramlist because one job is having one parameter, another job has 3 job parameters and 3 parameter sets and it is not fixed. Currently I am passing one parameter for script (i.e job name)
${DS_HOME}/dsjob -domain ${DS_DOMAIN} -user ${DSRUN_USR} -password ${DS_RUN_USER_PW} -server ${DS_SERVER} -run $paramlist -jobstatus ${PROJECT_NAME} ${jobname}
Also - in one of the posts I saw a generic script to call a DataStage job. I am not able to find it now. Could anybody provide link for that?
${DS_HOME}/dsjob -domain ${DS_DOMAIN} -user ${DSRUN_USR} -password ${DS_RUN_USER_PW} -server ${DS_SERVER} -run $paramlist -jobstatus ${PROJECT_NAME} ${jobname}
Also - in one of the posts I saw a generic script to call a DataStage job. I am not able to find it now. Could anybody provide link for that?
Re: datastage job generic script clarification
1 -> Maybe you can put all the parameters you have to process as last parameters of the UNIX script calling the DataStage job.
ex :
2 ->
viewtopic.php?t=85578
ex :
- 1st param : job name
2nd param : user
3rd param : psw
All the other params are parameters to pass to the job
2 ->
Maybe this one ?vamsi_4a6 wrote:2)In one of the post in dsexchange i saw generic script to call datastage job.Not able to find now.could anybody provide link for that?
viewtopic.php?t=85578
BI Consultant
DSXConsult
DSXConsult
Code: Select all
dsjob -lparams $DSProject $JobName
Code: Select all
ParamDefault=`$DSPath/dsjob -paraminfo $DSProject $JobName $ParamName 2>/dev/null | grep "Default Value" | cut -d":" -f2 | awk '{print $1}'`
If you have parameter sets then all this gets a little more complex.
Mamu Kim
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The dsjob command takes multiple occurrences of -param name=value
So your paramlist variable will contain something like
So your paramlist variable will contain something like
Code: Select all
-param name1=value1 -param name2=value2 -param name3=value3 ...
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Expanding on Ray's point...
We have a complex parameter usage. The following are script code examples without further explanation because you really must have someone familiar with your system make the detailed decisions.
We source in project variables from a .ssi file as well. The first loop takes parameters passed from the calling system, in my case a Control-M command line. The next loops reference the variables from the .ssi file.
The final command line has other references which are explained in the DataStage manuals. Please note the lack of an authorization parameter. I can't show complete code for obvious reasons.
We have a complex parameter usage. The following are script code examples without further explanation because you really must have someone familiar with your system make the detailed decisions.
We source in project variables from a .ssi file as well. The first loop takes parameters passed from the calling system, in my case a Control-M command line. The next loops reference the variables from the .ssi file.
The final command line has other references which are explained in the DataStage manuals. Please note the lack of an authorization parameter. I can't show complete code for obvious reasons.
Code: Select all
###
# process input parameters.
###
while getopts d:e:g:p:j:w:r:P:Rh param
do
case ${param} in
d) envparam1=${OPTARG};;
e) envparam2=${OPTARG};;
g) prjparam1=${OPTARG};;
p) prjparam2=${OPTARG};;
j) jobname=${OPTARG};;
w) WARN_LIMIT="-warn ${OPTARG}";;
r) ROWS_LIMIT="-rows ${OPTARG}";;
P) PARAMSTRING="${PARAMSTRING} -param ${OPTARG} ";;
R) J_RESET=1;;
h) Usage; exit 0;;
\?) Usage; exit 8;;
esac
done
###
for VAR in ${PUBLIC_PARAMETERS}
do
PARAMSTRING="${PARAMSTRING} -param ${VAR}"
done
###
for VAR in ${OTHER_PARAMETERS}
do
PARAMSTRING="${PARAMSTRING} -param ${VAR}"
done
###
${DSHOME}/bin/dsjob ${PORT_NUMBER} -run -jobstatus ${WARN_LIMIT} ${ROWS_LIMIT} ${PARAMSTRING} ${prjname} ${jobname}
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
I am able to form the logic for parameters successfully when we have parameters.
Let us say i do not have any parameters for Job what i need to do to make it run for below command.I mean $paramlist is empty
${DS_HOME}/dsjob -domain ${DS_DOMAIN} -user ${DSRUN_USR} -password ${DS_RUN_USER_PW} -server ${DS_SERVER} -run $paramlist -jobstatus ${PROJECT_NAME} ${jobname}
Let us say i do not have any parameters for Job what i need to do to make it run for below command.I mean $paramlist is empty
${DS_HOME}/dsjob -domain ${DS_DOMAIN} -user ${DSRUN_USR} -password ${DS_RUN_USER_PW} -server ${DS_SERVER} -run $paramlist -jobstatus ${PROJECT_NAME} ${jobname}
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Sure but basically the same thing. Either set it an empty string first regardless and then set it to your parameter list when it needs it or simply leave it not set in the process's environment and then only set it when needed. In either case it be "empty" and will just basically not appear in the final, built command line.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Be careful when setting an environment variable, especially for PX Engine's APT_ variables. We use "isDefined()" internally to determine if it is actually defined, regardless of the value provided, for the vast majority of those environment variables.
So if you set "" as a value, you may run a risk of the system actually defining the environment variable. Use $UNSET within the job framework, or "unset" on the command line.
So if you set "" as a value, you may run a risk of the system actually defining the environment variable. Use $UNSET within the job framework, or "unset" on the command line.
That's funny - all these years living over a UNIX basement and I don't ever really think of using "unset". I'm typically defining variables unique to process environments outside of our daily job runs and either not setting them unless needed or for Boolean values explicitly setting them to false before deciding if they ever need to be true or not.
Note to self...
Note to self...
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
That's quite understandable, but what is "on"? What is "off"?
1? 0? Yes? No? True? False? Hai? Iie? Our products are used worldwide, so it is far easier to explain, "unset it", then it is to set a value that only an English speaker may understand.
If you look closely at the already defined environment variables, you would notice that if you left the values as default, the GUI would internally unset these environment variables. You can find out this behavior by observing the message id IIS-DSTAGE-RUN-I-0126
-T.J.
P.S. Granted, I have been using unset before I joined Ascential for other things. Maybe I am just more of a shell scripting nerd than you are.
1? 0? Yes? No? True? False? Hai? Iie? Our products are used worldwide, so it is far easier to explain, "unset it", then it is to set a value that only an English speaker may understand.
If you look closely at the already defined environment variables, you would notice that if you left the values as default, the GUI would internally unset these environment variables. You can find out this behavior by observing the message id IIS-DSTAGE-RUN-I-0126
-T.J.
P.S. Granted, I have been using unset before I joined Ascential for other things. Maybe I am just more of a shell scripting nerd than you are.