Documentum 6.6 Errors

After last week’s post about the dm_error script, I dug out an old Perl script I had that reads the same *.e files and produces an HTML list, and CSV file with all the errors and their causes.  I ran the Perl script against a new 6.6 Content Server and produced a list of all the errors here Note: This is a 1.8MB HTML file and takes a little time to load.   The Perl script and the files it produces can all be downloaded here (PDF too!).

If you are interested in the Perl script, here it is:

#!/usr/local/bin/perl

# ###################################
#
# (c) 2010 M. Scott Roth
# dm_misc blog, msroth.wordpress.com
#
# ####################################

use Cwd;

#$DEBUG = 1;
$SQL = 0;

$ERR_MSG_DIR = "c\:\\Documentum\\Product\\6.6\\MESSAGES";
@ERR_FILES = "";

$CSV_FILE = cwd() . "\\dm_err.csv";
$HTML_FILE = cwd() . "\\dm_err.html";

print "\n\nCreating CSV file...$CSV_FILE\n";
print "Creating HTML file...$HTML_FILE\n\n";

$CSV_HEADER = "\"Documentum 6.6 Errors\"\n\"FACILITY\",\"SEVERITY\",\"ERROR\",\"NAME\",\"DESCRIPTION\",\"CAUSE\",\"ACTION\",\"PARAMETERS\"\n";
$HTML_HEADER = "<HTML><HEAD><TITLE>dm_err</TITLE></HEAD><BODY><H1>Documentum 6.6 Errors</H1><P/>\n";

%ERR_HASH = ();
$fac = "";
$sev = "";
$err = "";
$desc = "";
$action = "";
$cause = "";
$params = "";

# read error files
opendir(ERR_DIR,"$ERR_MSG_DIR") || die "Could not open dir $ERR_MSG_DIR: $!";
    @ERR_FILES = grep(/\w+\.e/i,readdir(ERR_DIR));
closedir(ERR_DIR);

# open output files
open(CSV,">$CSV_FILE")  || die "Could not open file $CSV_FILE: $!";
print CSV $CSV_HEADER;

open(HTML,">$HTML_FILE")  || die "Could not open file $HTML_FILE: $!";
print HTML $HTML_HEADER;

# process hash of error files
foreach (@ERR_FILES) {
    print "$ERR_MSG_DIR\\$_...\n";

    open(ERR_FILE,"<$ERR_MSG_DIR\\$_") || die "Could not read $ERR_MSG_DIR\\$_: $!";
        @err_contents = (<ERR_FILE>);
    close(ERR_FILE);

    foreach (@err_contents) {

        s/\"//g;
        s/\'//g;
        s/\;//g;
        s/\n/ /g;
        s/\t/ /g;

        if (/^\.facility\s+(\w+)/) {
            $fac = uc($1);
            $sev = "";
            $err = "";
            $cause = "";
            $action = "";
            $params = "";
            $last_match ="f";

        } elsif (/^\.severity\s+(\w+)/) {
            $sev =  uc($1);
            $err = "";
            $cause = "";
            $action = "";
            $params = "";
            $last_match ="s";

        } elsif (/^([A-Z0-9_]+)\s+((.+))/) {

            $err = $1;
            $desc = $2;

            if ($err =~ /\w+/) {
                $cause = "";
                $action = "";
                $params = "";
                $last_match ="e";
                $ERR_HASH{$fac}->{$sev}->{$err}{'desc'} = $desc;
            }

        } elsif (/\s*CAUSE:?\s+(.*)/) {
            $cause = $1;
            $action = "";
            $params = "";
            $last_match ="c";
            $ERR_HASH{$fac}->{$sev}->{$err}{'cause'} = $cause;

        } elsif (/\s*ACTION:?\s+(.*)/) {
            $action = $1;
            $params = "";
            $last_match ="a";
            $ERR_HASH{$fac}->{$sev}->{$err}{'action'} = $action;

        } elsif (/\s*PARAMETERS:?\s+(.*)/) {
            $params =  $1;
            $last_match ="p";
            $ERR_HASH{$fac}->{$sev}->{$err}{'params'} = $params;

        } elsif (/^\n$/) {
            # noop for blank line
        } elsif (/^\s*(.+)/) {
            # continued lines
            if ($last_match eq "e") {
                $ERR_HASH{$fac}->{$sev}->{$err}{'desc'} .= " $1";
            } elsif ($last_match eq "c") {
                $ERR_HASH{$fac}->{$sev}->{$err}{'cause'} .= " $1";
            } elsif ($last_match eq "a") {
                $ERR_HASH{$fac}->{$sev}->{$err}{'action'} .= " $1";
            } elsif ($last_match eq "p") {
                $ERR_HASH{$fac}->{$sev}->{$err}{'params'} .= " $1";
            } else {
                print "\nODD LINE = $_\n" if $DEBUG;
            }
        } else {
            print "\nREALLY ODD LINE=$_\n" if $DEBUG;
        }
    }
}

# produce HTML and CSV
foreach my $f (keys %ERR_HASH) {

    print HTML "<HR/>";
    print HTML "<H2>$f</H2>\n";

    foreach my $s (keys %{$ERR_HASH{$f}}) {

        foreach my $e (keys %{$ERR_HASH{$f}->{$s}}) {

            $s =~ /^\w/;

                print CSV "\"$f\"";
                print CSV ",\"$s\"";
                print CSV ",\"$e\"";
                print CSV ",\"[" . $f . "_$&_" . $e . "\"]";
                print CSV ",\"" . $ERR_HASH{$f}->{$s}->{$e}{'desc'} . "\"";
                print CSV ",\"" . $ERR_HASH{$f}->{$s}->{$e}{'cause'} . "\"";
                print CSV ",\"" . $ERR_HASH{$f}->{$s}->{$e}{'action'} . "\"";
                print CSV ",\"" . $ERR_HASH{$f}->{$s}->{$e}{'params'} . "\"";
                print CSV "\n";

                print HTML "<H3>ERROR: [" . $f . "_$&_" . $e . "]</H3>\n";
                print HTML "<B>SEVERITY:</B>  " . $s . "<BR/>\n";
                print HTML "<B>DESCRIPTION:</B> " . $ERR_HASH{$f}->{$s}->{$e}{'desc'} . "<BR/>\n";
                print HTML "<B>CAUSE:</B> " . $ERR_HASH{$f}->{$s}->{$e}{'cause'} . "<BR/>\n";
                print HTML "<B>ACTION:</B> " . $ERR_HASH{$f}->{$s}->{$e}{'action'} . "<BR/>\n";
                print HTML "PARAMS: " . $ERR_HASH{$f}->{$s}->{$e}{'params'} . "
\n";

        }
    }
}

print HTML "</BODY></HTML>\n";
close (CSV);
close (HTML);
exit

# ### EOF ### <SDG>< ### #

I have not included the CSV file here. It too is quite large but can easily be loaded into Excel. Enjoy.

Advertisements

About Scott
I have been implementing Documentum solutions since 1997. In 2005, I published a book about developing Documentum solutions for the Documentum Desktop Client (ISBN 0595339689). In 2010, I began this blog as a record of interesting and (hopefully) helpful bits of information related to Documentum, and as a creative outlet.

One Response to Documentum 6.6 Errors

  1. Pingback: Links to All of My Source Code | dm_misc: Miscellaneous Documentum Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: