Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Quotes in a TSM Perl command

Quotes in a TSM Perl command

Quotes in a TSM Perl command

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?

$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: $!";
print "@get_restore_vol_list\n";

RE: Quotes in a TSM Perl command

At the end of your open, do you need a trailing space before the pipe "$tsmsrv_cmd0|" or maybe "$tsmsrv_cmd0 |"?

RE: Quotes in a TSM Perl command

As a general troubleshooting point, I would recommend building up your command into a variable before trying to execute it, like this:


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:


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:


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

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd

RE: Quotes in a TSM Perl command

1. You should chomp the data coming from CLI.
2. How do you know the ipaddress/port are in the correct format?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close