Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!/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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-05-26 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (91 votes). Check out past polls.

    Notices?