Passing TSM return codes back to AIX?

GeoffW

ADSM.ORG Member
Joined
May 12, 2005
Messages
7
Reaction score
0
Points
0
Website
Visit site
We are trying to execute TSM scripts from AIX using the dsmadmc command line:



e.g.

$ dsmadmc -id=XYZ -pa=ABC 'run TSM_SCRIPT'



The problem we're having is trying, somehow, to retrieve return codes from the script back to AIX.



What is currently happening, understandably, is the above command always returns a 0 because it was successful in executing the command argument provided - it doesn't care what happens in the script.



What we would like to happen is that, should any non-zero return codes be encountered by the script, they would be reflected in the return code of the above command.



Has anyone ever done this, or is it even possible?



Thanks,



Geoff
 
From memory I believe the error/exit code will be on the ?# variable, put it right after the TSM command you execute.
 
You have to parse standard out for the line "The highest return code was: " and read the exit code from there. This will only work on scripts that will run in the forground. If you submit the command to TSM and it runs in the background (within TSM), it will still return a exit code of 0 since it was submitted successfully.



Rather then run a TSM script from the AIX command line, just run the command and capture it's output and exit code.



-Aaron
 
Not sure if you got anywhere on your script but you can to it like this. Let me know if you have any other questions. I'm pretty familiar running tsm on aix but now I'm on windows and using vbscript.



dsmadmc -id=$username -pass=$password backup stgpool 1stpool 2ndpool wait=yes

if [[ $? = 0 || $? = 11 ]]; then

echo "\n This worked\n" >> $report

else

echo "\n This didn't work\n" >> $report

fi
 
If you use perl :



open (PROC, dsmadmc select butterfly from volume) or die "cannot open dsmadmc: $!";

while (<PROC>) {

print $_;

# do whatever business you have to do

}

close PROC;

$process_return_code = $! >> 8;

# $kill_process_signal = $? & 127;

# Ref: PERL Black Book, Steven Holzner pg. 434



have a nice day!

neil
 
Back
Top