NAME

DBD::TSM - Perl DBD driver for TSM admin client

SYNOPSIS

use DBI;

my ($server_name,$user,$password)=(...); #or set DBI_DSN,DBI_USER,DBI_PASS

my $dbh=DBI->connect("DBB:TSM:$server_name",$user,$password,
                     {RaiseError => 0,
                     PrintError => 0}) or die $DBI::errstr;
#If you use environment variable $dbh=DBI->connect();

my $sth=$dbh->prepare("select node_name from nodes") or
        die $dbh->errstr;
$sth->execute() or die $sth->errstr();

print "@{$sth->{NAME}}\n";
$sth->dump_results();

DESCRIPTION

DBD::TSM is a DBI Driver to interface DBI with dsmadmc. You could use all the command possible with dsmadmc with the Power of DBI. I don't test all the DBI capabilities.

To work you need to have:

  • A TSM server started

  • A TSM Client full operationnal. i.e.:

    • TSM Binary installed (dsmadmc is the much important for me)

    • dsm.sys or/and dsm.opt set to work with your tsm server.

      • Check it before with a manual test with:

        dsmc query session command
      • Check it before with a manual test with:

        dsmadmc -id=<user> -pa=<password> -se=<Your Server Name stanza> query status

AutoCommit

When you set AutoCommit (the default), I add -itemcommit in command line.

Exception

You have to ways to track execute error in script. It's mandatory with TSM because, it send a 11 return code for empty statement. I propagate this return code.

So you have two methods to not exit from script:

1. First, set RaiseError => 0 in connect method

my $dbh = DBI->connect($dbi_dsn, $dbi_user, $dbi_pass, {
        RaiseError => 0,
    });

2. Use eval {}; block for execute fonction

eval {
    $sth->execute($select);
};

EXPORT

None by default.

SEE ALSO

DBI(3).

TSM Client Reference Manual.

BUGS

I'm not using TSM API. So, I do one session for each statement. It's a Pure Perl Module.

Be carefull with join statement because we could have duplicate field name. I detect this duplicate field and send a warning message.

NEXT

Rewrite fetch to use a filehandle to read dsmadmc output line by line to redure memory requirement. I have some idea, need just time to do it. Not sure it works on Windows.

AUTHOR

Laurent Bendavid, <lbendavid@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Laurent Bendavid

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.