Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quotes in a TSM Perl command

Status
Not open for further replies.

jwholey

Technical User
May 8, 2001
4
US
I'm unable to get the syntax of the following command working. I need Perl to interpret the command as follows as I know it works:
dsmadmc -se=$instance -id=$id -pass=$pass -datao=yes -tabd "select volume_name,access from volumes where volume_name='VOLUME_1'"

i.e.the application needs the single tic marks around "VOLUME_1", but when I pass the command into Perl as below, it does not interpret as expected and I get the syntax error from the TSM. Any ideas?


#!/usr/bin/perl
$id=tsmhsk;
$pass=tsmhsk;
$tsmsrv_cmd0="select volume_name,access from volumes where volume_name='VOLUME_1'";

foreach my $arg (@ARGV) { # Capturing command line Variables

$instance=$ARGV[0]; # This will be the TCPSERVERADDRESS
$node_namee=$ARGV[1]; # This will be the TCPPORT

}

open(LOGIN3, "dsmadmc -se=$instance -id=$id -pass=$pass -datao=yes -tabd $tsmsrv_cmd0|") || die "open: $!";
@get_restore_vol_list=<LOGIN3>;
close(LOGIN3);
print "@get_restore_vol_list\n";
 
At the end of your open, do you need a trailing space before the pipe "$tsmsrv_cmd0|" or maybe "$tsmsrv_cmd0 |"?
 
As a general troubleshooting point, I would recommend building up your command into a variable before trying to execute it, like this:

Code:
my $cmd ="dsmadmc -se=$instance -id=$id -pass=$pass -datao=yes -tabd $tsmsrv_cmd0|";
open(LOGIN3, $cmd) || die "open: $!";

That way it's easy to add debug code to show what command you're actually sending, as opposed to what you think you're sending:

Code:
my $cmd ="dsmadmc -se=$instance -id=$id -pass=$pass -datao=yes -tabd $tsmsrv_cmd0|";
print "executing: $cmd\n";   # Remove this line once it's working
open(LOGIN3, $cmd) || die "open: $!";

In your case, in addition to the trailing pipe that PinkeyNBrain pointed out, you won't have the double quotes you need around the SQL statement. To get them, you'll need to do something like this:

Code:
my $cmd ="dsmadmc -se=$instance -id=$id -pass=$pass -datao=yes -tabd \"$tsmsrv_cmd0\"|";

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
1. You should chomp the data coming from CLI.
2. How do you know the ipaddress/port are in the correct format?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top