Howdy:
Can someone tell me why I keep getting the errors:
[snip error]
D:\PERL\BIN\MY_SCPTS>db2_test1.pl
syntax error at D:\PERL\BIN\MY_SCPTS\db2_test1.pl line 35, near "my"
Global symbol "$sth" requires explicit package name at
D:\PERL\BIN\MY_SCPTS\db2_
test1.pl line 35.
Global symbol "$sql" requires explicit package name at
D:\PERL\BIN\MY_SCPTS\db2_
test1.pl line 35.
Global symbol "$sth" requires explicit package name at
D:\PERL\BIN\MY_SCPTS\db2_
test1.pl line 43.
Execution of D:\PERL\BIN\MY_SCPTS\db2_test1.pl aborted due to compilation
errors
..
[/snip error]
I'm trying to write a script to connect to the DB2 / mainframe and I don't
really see *why* I'm having a problem.
[script]
#!perl.exe
# created 05 Nov 2002
# script to connect the NT machine to DB2/ OS/390
# mainframe via db2 module (have to run on NT box for now)
# may test this with DBI:DBD:DB2
use strict;
use DBI;
use DBD::DB2::Constants;
use DBD::DB2;
my $username="joeuser";
my $password="joepasswd";
my $outfile="d:\testout.txt";
my $dbh=DBI->connect("dbi:DB2:DB2DSNE", $username, $password)
or die "Can not connect: $!";
if (!defined($dbh)) {exit;}
my $sql="SELECT
name,
tbname
from sysibm.syscolumns
where tbname = 'local_table';
; "
# test the sql and prepare to use
#
my $sth = $dbh->prepare($sql);
# generate a text file for mailing
# will have to expound upon
#
open OUTFILE, ">$outfile";
print OUTFILE "This is a test ...\n\n";
while (my @row = $sth->fetchrow) {
print OUTFILE "$row[0]\t$row[1]\n";
}
close OUTFILE;
$dbh->disconnect;
[/script]
Thanks!
-X