#!/usr/local/bin/perl use strict; use Data::Dumper; print "\n\n"; print"Write the file name using / and not \\ . Verbose means all loads + will be shown non-verbose means only the ones with errors are shown" +; print "\n\n"; ###Inputfile print "File path: "; my $doc = <STDIN>; $doc =~ s/\//\\/g; #Switch / with \ my $holdTerminator = $/; undef $/; ###Parse File to $buffer open (INPUT, $doc); my $buffer = <INPUT>; close (INPUT); ###Split the input file spliting at load $/ = $holdTerminator; my @lines = split /load / , $buffer; ###Variables### my $line; my $result; my $string; my $loadline; my $index = 1; my $arraysize = @lines; # Arraysize print "\n\n"; ###Verbose?### print "Use verbose mode? Yes or No: "; my $flagbuffer = <STDIN>; print "\n\n"; ###Flag check### if ($flagbuffer=~ m/Yes|Y|yes|y/){ ###VERBOSE### foreach $line (@lines) { # The first and last one is not a load command $arraysize-1 auf if ($index<$arraysize){ print "LOAD No.: $index \n"; #parse load no. $line = $lines[$index]; if($line=~ m/(e.*?nonrecoverable)/){$result = $1}; #parse load +command print "LOAD: $result\n"; #print load no. if ($line =~ m/SQL2036N|SQL3107W|SQL3304N/) #search for error { if ($line =~ m/SQL2036N/) { print "Status: ERROR Errorcode: SQL2036N --> File or unit not f +ound\n"; } elsif($line =~ m/SQL3304N/) { print "Status: ERROR Errorcode: SQL3304N --> Table does not exi +st\n"; } } else { print "Status: OK \n"; #If no error } print "----------------------------------------------\n\n"; $index = $index +1; } } ###NON VERBOSE### } else { # The first and last one is not a load command if ($index<$arraysize){ foreach $line (@lines) { $line = $lines[$index]; if ($line =~ m/SQL2036N|SQL3107W|SQL3304N/) #Errorsearch { print "LOAD No.: $index \n"; #Print load no. $line = $lines[$index]; if($line=~ m/(e.*?nonrecoverable)/){$result = $1}; #par +se load command print "LOAD: $result\n";#print load no. if ($line =~ m/SQL2036N/) # error search { print "Status: ERROR Errorcode: SQL2036N File or Unit is w +rong!\n"; } elsif($line =~ m/SQL3304N/) { print "Status: ERROR Errorcode: SQL3304N Table does not ex +ist n\n"; } print "----------------------------------------------\n +\n"; } $index = $index +1; } } } #End
In reply to DB2 Log analyser by theroninwins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |