Hi....
I Run a DS Job in unix shell programing use "dsjob -run" command. After Execute this command i got "Status code = 0" like. I need to assign that Status code into a variable.
Thanks in advance.
Regards,
Ragunathan J
How to assign job status into variable in shell programing
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 50
- Joined: Mon Sep 25, 2006 11:18 pm
- Location: Chennai
- Contact:
What do you mean 'assign that Status code into a variable'? Do you mean have the script return that code as its exit status? Or just use it internally? How are you running a 'DS job in unix shell programming' if your server is on Windows?
Perhaps:
For whatever you'd like this X to actually be called. 'X' gets assigned the value of the status code returned by dsjob and then that is passed out as the exit status of the script as an added bonus.
![Shocked :shock:](./images/smilies/icon_eek.gif)
Perhaps:
Code: Select all
dsjob -run blah-blah-blah
X=$?
exit $X
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 50
- Joined: Mon Sep 25, 2006 11:18 pm
- Location: Chennai
- Contact:
Hi chulett ,
i would like to thank for reply. we r running the dsjobs in the unix command window. It is return job status externally ,My Requirement: the corresponding output will assign as a user defined variable.
for example: i will run the shell progrmm and output of this program generate some status code. i want to assign that status code to a user defined variable like
A=staus code.
if is it possible to do this? if yes please give some idea regarding this.
with regards,
Ragunathan J
i would like to thank for reply. we r running the dsjobs in the unix command window. It is return job status externally ,My Requirement: the corresponding output will assign as a user defined variable.
for example: i will run the shell progrmm and output of this program generate some status code. i want to assign that status code to a user defined variable like
A=staus code.
if is it possible to do this? if yes please give some idea regarding this.
with regards,
Ragunathan J
If you want the retrieve the status code of the dsjob command then do as Craig advised. And, if you want to retrieve the status code of the job then add -jobstatus to Craigs advised commands. i.e,
This way you will get a status code of 1 if job is successful, 2 if it finished with warnings, 3 if it aborted, yada yada yada.
Code: Select all
dsjob -run -jobstatus blah-blah-blah
X=$?
exit $X
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Pretty sure that's exactly what I gave you.ragunathan13 wrote:if is it possible to do this? if yes please give some idea regarding this.
![Confused :?](./images/smilies/icon_confused.gif)
In my example, your A = my X, with X getting assigned the status code from the dsjob run. If that's not enough then you'll need to explain your problem a little better... like exactly where this assignment should be happening.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
When you use the -jobstatus option, the exit status of dsjob is the exit status of the job that was run. You need to know that for the efficacy of Craig's solution to be explained.
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.