In case anyone wants it, I've written a nice perl script that gives a list of
tapes in an STK ACSLS library, the output from a 'q libvol', and a 'q vol'.
Additionally, it shows the state of a tape (readwrite,readonly,offsite,unavail...)
as well as the % full. If you know any perl, it can be easily modified for a 3494 using the tapeutil command. I wrote this because I was tired of trying to determine if a volumes was in the library volume output verse actually in the library (acsls). Here it's all in a single simple screen. enjoy. ( TSM server is 3.7 but version doesn't really matter, perl is version 5.5003, and running on AIX 4.3.3 server)
#!/usr/bin/perl
$acsls_output_file = "acsls.vols";
# get acsls tape listing
system "echo 'q vol all' > /tmp/perl.tmp";
system "/usr/bin/rsh acsls_server -l acsss /export/home/ACSSS/bin/cmd_proc < /tmp/perl.tmp > $acsls_output_file";
# already generated for now
open(FILE," $acsls_output_file");
open(OUTFILE,"> ${acsls_output_file}.short");
@acsls = ();
while (<FILE>) {
# only care about BB/DT/IT/BD tapes on spaten
if ( (/^s*(BBS+)/) || (/^s*(DTS+)/) || (/^s*(ITS+)/) || (/^s*(BDS+)/) ) {
#print " acsls volume = $1n";
push (@acsls,$1);
} #end if
} # end while
### testing ###
#foreach $tape (keys %acsls) {
# print "key = $tapen";
#}
# get TSm libvol output #
@output_libvols = `/usr/bin/dsmadmc -id=sql -password=sqlsql "select volume_name from libvolumes"`;
@libvols = ();
foreach (@output_libvols) {
chomp;
if ( /^([A-Z][A-Z]dddd)s+/ ) {
#print "libvol = $1n";
push (@libvols,$1);
}
}
# get TSM volume output
@output_vols = `/usr/bin/dsmadmc -id=sql -password=sqlsql "select volume_name, access,pct_utilized from v
olumes where devclass_name<>'DISK'"`;
@vols = ();
foreach (@output_vols) {
chomp;
if ( /^([A-Z][A-Z]dddd)s+(S+)s+(S+)/ ) {
#print "vol = $1n";
push (@vols,"$1,$2,$3");
}
}
# use TSm volume as master list of all known tapesa
# compare the vol list with libvol list and acsls list
foreach $item (@vols) {
($tape,$state,$percent) = split(",",$item);
# search for $tape in @libvol array and then pop out value
# shorten list
$found_libvol = &find_val(*libvols,$tape);
if ($found_libvol) {
$libvol_name= $tape;
} else {
$libvol_name="";
}
# search for $tape in @acsls array and then pop out value
$found_acsls = &find_val(*acsls,$tape);
if ($found_acsls) {
$acsls_name = $tape;
} else {
$acsls_name ="";
}
# print header and each line where (vol) (libvol) (acsls)
write;
}
# now go through libvol array to find like database volumes
# lastly go through acsls array to find volumes in acsls not in TSM
# things that need to be fixed in other words
###########
# subroutines #
############
# find a value array, if found return 1, else return 0 (not found)
# also removes the found element from array, to shorten it up
sub find_val {
local(*array_name,$value) = @_;
for ($i=0;$i <= $#array_name ; $i++)
{
if ($value eq $array_name[$i]) {
splice(@array_name,$i,1);
return 1;
}
} # end for loop
return 0; # didn't find
} # end sub find_val
########
# formats
#########
format top =
Volume Libvol ACSLS status % full
====== ====== ====== =========== ======
.
format STDOUT =
@>>>>> @>>>>> @>>>>> @>>>>>>>>>>> @>>>>>
$tape,$libvol_name,$acsls_name,$state,$percent
.
tapes in an STK ACSLS library, the output from a 'q libvol', and a 'q vol'.
Additionally, it shows the state of a tape (readwrite,readonly,offsite,unavail...)
as well as the % full. If you know any perl, it can be easily modified for a 3494 using the tapeutil command. I wrote this because I was tired of trying to determine if a volumes was in the library volume output verse actually in the library (acsls). Here it's all in a single simple screen. enjoy. ( TSM server is 3.7 but version doesn't really matter, perl is version 5.5003, and running on AIX 4.3.3 server)
#!/usr/bin/perl
$acsls_output_file = "acsls.vols";
# get acsls tape listing
system "echo 'q vol all' > /tmp/perl.tmp";
system "/usr/bin/rsh acsls_server -l acsss /export/home/ACSSS/bin/cmd_proc < /tmp/perl.tmp > $acsls_output_file";
# already generated for now
open(FILE," $acsls_output_file");
open(OUTFILE,"> ${acsls_output_file}.short");
@acsls = ();
while (<FILE>) {
# only care about BB/DT/IT/BD tapes on spaten
if ( (/^s*(BBS+)/) || (/^s*(DTS+)/) || (/^s*(ITS+)/) || (/^s*(BDS+)/) ) {
#print " acsls volume = $1n";
push (@acsls,$1);
} #end if
} # end while
### testing ###
#foreach $tape (keys %acsls) {
# print "key = $tapen";
#}
# get TSm libvol output #
@output_libvols = `/usr/bin/dsmadmc -id=sql -password=sqlsql "select volume_name from libvolumes"`;
@libvols = ();
foreach (@output_libvols) {
chomp;
if ( /^([A-Z][A-Z]dddd)s+/ ) {
#print "libvol = $1n";
push (@libvols,$1);
}
}
# get TSM volume output
@output_vols = `/usr/bin/dsmadmc -id=sql -password=sqlsql "select volume_name, access,pct_utilized from v
olumes where devclass_name<>'DISK'"`;
@vols = ();
foreach (@output_vols) {
chomp;
if ( /^([A-Z][A-Z]dddd)s+(S+)s+(S+)/ ) {
#print "vol = $1n";
push (@vols,"$1,$2,$3");
}
}
# use TSm volume as master list of all known tapesa
# compare the vol list with libvol list and acsls list
foreach $item (@vols) {
($tape,$state,$percent) = split(",",$item);
# search for $tape in @libvol array and then pop out value
# shorten list
$found_libvol = &find_val(*libvols,$tape);
if ($found_libvol) {
$libvol_name= $tape;
} else {
$libvol_name="";
}
# search for $tape in @acsls array and then pop out value
$found_acsls = &find_val(*acsls,$tape);
if ($found_acsls) {
$acsls_name = $tape;
} else {
$acsls_name ="";
}
# print header and each line where (vol) (libvol) (acsls)
write;
}
# now go through libvol array to find like database volumes
# lastly go through acsls array to find volumes in acsls not in TSM
# things that need to be fixed in other words
###########
# subroutines #
############
# find a value array, if found return 1, else return 0 (not found)
# also removes the found element from array, to shorten it up
sub find_val {
local(*array_name,$value) = @_;
for ($i=0;$i <= $#array_name ; $i++)
{
if ($value eq $array_name[$i]) {
splice(@array_name,$i,1);
return 1;
}
} # end for loop
return 0; # didn't find
} # end sub find_val
########
# formats
#########
format top =
Volume Libvol ACSLS status % full
====== ====== ====== =========== ======
.
format STDOUT =
@>>>>> @>>>>> @>>>>> @>>>>>>>>>>> @>>>>>
$tape,$libvol_name,$acsls_name,$state,$percent
.