dsjob (status code)
Moderators: chulett, rschirm, roy
That is the job return code. When you stick in "-jobstatus" to your dsjob command, the status code will be the job return code. When you execute the dsjob command without the "-jobstatus", the command exit code will be returned.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Code: Select all
eval dsjob -lognewest $Project $JobName | awk -F"\=" '{print $2}' | read EventId
if [ $? -ne 0 ]
then
echo "Error."
exit 2
fi
.....Next command.......
Code: Select all
eval dsjob -lognewest $Project $JobName | awk -F"\=" '{print $2}' | read EventId
if [ $? -ne 0 ]
then
echo "Error."
exit 2
fi
.....Next command.......
Thats fine, you can ignore that.
With the above code you are acomplising both, getting the event id and checking the status of your command.
The status code will still be spit out onto stdout, which is your screen. That shouldnt be of any concern, its harmless.
With the above code you are acomplising both, getting the event id and checking the status of your command.
The status code will still be spit out onto stdout, which is your screen. That shouldnt be of any concern, its harmless.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
$? is the exit status of the final command in the pipeline - in your case the read command. You need different logic to have the shell script exit with the value of the dsjob exit status.
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.