Following Davids suggestion (thanks) this is the code that is causing the
problem - please note I am very much the 'middle man' here but if anyone has
any further suggestions/questions I can pass them on to the developer
Thanks
Austen
#!/usr/bin/perl -w
# Connect to MIDAS
#
# Note that this script requires a range of Oracle Environment variables to
# be set before starting, and will only work on workstations where the
# oracle client software is installed. I.e. hc1900.
#
use strict;
use DBI;
# Choose production (orap) or test (orat) databases
$ENV{TWO_TASK}='orap';
#$ENV{'NLS_LANG'}='american_america.we8iso8859p1';
#$ENV{'NLS_LANG'}='american_america.we8ebcdic1047';
# Get user name and password from users .netrc
my ($UserName,$Password);
open(DIN,"$ENV{HOME}/.netrc") or die "Can't open $ENV{HOME}/.netrc";
while(<DIN>) {
my @fields=split;
if($fields[1] eq 'ukmet') {
$UserName = $fields[3];
$Password = $fields[5];
}
}
close(DIN);
unless( defined($UserName) && defined($Password)) {
die "Failed to extract COSMOS username and password from
$ENV{HOME}/.netrc";
}
# Connect to the database
my $dbh = DBI->connect("DBI:Oracle:",
$UserName,$Password,
{PrintError => 1, RaiseError => 1}) or
die $DBI::errstr;
# Do some processing - let's get some marine data.
my $Sql_statement = "select to_char(sea_temperature,'99999') from
midasvu.marine_ob ".
"where OB_TIME between to_date('01-JAN-1989 0000',".
"'dd-mon-yyyy hh24mi') and to_date('01-JAN-1989 2359',".
"'dd-mon-yyyy hh24mi')";
my $Statement = $dbh->prepare($Sql_statement);
$Statement->execute();
# Process the results - let's calculate the mean.
my $count = 0;
my $Accumulate=0;
while(my @sstA = $Statement->fetchrow_array()) {
unless(defined($sstA[0])) { next; }
$Accumulate += $sstA[0];
$count++;
}
$Statement->finish();
printf "Mean SST was %5.2f, from %6d
measurements\n",$Accumulate/$count,$count;
# Close the database connection
$dbh->disconnect();
exit(0);
> -----Original Message-----
> From: Birchall, Austen [SMTP:[EMAIL PROTECTED]]
> Sent: 16 October 2002 16:58
> To: [EMAIL PROTECTED]
> Subject: HP-UX - Perl DBI - mainframe issue
>
> Hello all
>
> I have an user who is trying to connect to a database on a ZOS 8.1.7.3
> mainframe database using Perl DBI:DBD on a HP-UX 11.0 client
>
> He can get character data back without any problems but all other types
> come
> back as rubbish. The message he gets is given below - anyone got any
> ideas,
> can help, etc.
>
> Austen
>
>
>
> DBD::Oracle::st fetchrow_array failed: ORA-24345: A Truncation or null
> fetch
> error occurred (DBD ERROR: ORA-01406 error on field 67 of 109, ora_type 2)
> at
> ../midas_link.perl line 49.
>
>
> Austen Birchall Database Administrator
> Met Office London Road Bracknell Berkshire RG12 2SZ United Kingdom
> http://www.metoffice.com
>