The <> operator just stops on EOF or error.  

You have to explicitly access the error codes.  Try printing the system variable
$! at this point.  I wouldn't be terribly surprised if the return from that
variable isn't entirely helpful in this case, however.  You may have to resort
to sysopen and sysread or even reading the data in with low-level VMS calls to
really get to the bottom of a problem such as this.

Good luck.

> -----Original Message-----
> From: Atkinson, Robert [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 03, 2003 7:21 AM
> To: [EMAIL PROTECTED]
> Subject: File Read Error
> 
> I am using a bit of Perl script to try and examine a corrupt RMS file.
> 
> The file has a few invalid records in it, where the record length exceeds
> the
> maximum record length in the file header.
> 
> Although there are a lot more records in the file than reported, the
> program
> seems to stop at the first corrupt record, but does not report any kind of
> error.
> 
> I assume the file corruption is causing the program to fail, but surely it
> should report some kind of VMS error status?
> 
> Any ideas?
> 
> Robert.
> 
> *****************************************************
> 
> $thefile = "GAMSYF:[RAA.DAT]DCLLOG.ROB";
> open(INFILE, "$thefile") or die "The file $thefile could not be found.\n";
> 
> $LineCount = 0;
> 
> while(<INFILE>) {
> 
>     $TheLine = $_;  # Save the line's contents
> 
>     chomp($TheLine);  # Get rid of the line break
> 
>     $LineCount = $LineCount + 1;  # This is the easy part!
> 
>     $LineLen = length($TheLine);
> 
>     if ($LineLen > 100) {print "Line $LineCount is $LineLen long\n"};
>     if ($LineCount > 2096657) {print "= $TheLine\n"};
> }
> 
> print "Number of lines       $LineCount\n";
> 
> *****************************************************
> 
> 
> 
> **************************************************************************
> *********
> The Random House Group Ltd.
> Registered address 20 Vauxhall Bridge Road,
> London
> SW1V 2SA
> http://www.randomhouse.co.uk
> Telephone +44 (0) 20 7840 8400.
> Any opinions expressed in email are those of the individual and not
> necessarily those of the company. This email and any files transmitted
> with it are confidential and solely for the use of the intended recipient
> or entity to who they are addressed. It may contain material protected by
> attorney-client privilege. If you are not the intended recipient, or a
> person responsible for delivering to the intended recipient, be advised
> that you have received this email in error and that any use is strictly
> prohibited.
> Random House Group IT Department helpdesk +44 (0) 1206 255900.
> **************************************************************************
> *********

Reply via email to