#!/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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.