Home: Perl Programming Help: Win32 Programming Help:
Extended attibutes inconsistent error



lall
Novice

Feb 24, 2009, 1:48 AM


Views: 12872
Extended attibutes inconsistent error

Hello

I have a perl utility running on Windows 2003 server as a service.From past few days I am facing error as

"qm_rr_rplctr.plx rc=255 Extended attibutes inconsistent" error.Can some one help me how can I address this case.


FishMonger
Veteran / Moderator

Feb 24, 2009, 2:11 AM


Views: 12870
Re: [lall] Extended attibutes inconsistent error

Impossible to say without knowing what your script is doing.

Show us your code.


lall
Novice

Feb 24, 2009, 2:14 AM


Views: 12868
Re: [FishMonger] Extended attibutes inconsistent error

The code is just logging on to Oracle database.

Updating an indicator fiels in a table.



The utilities used are as



use DBI;
use Win32;
use Win32::Process;


lall
Novice

Feb 24, 2009, 2:18 AM


Views: 12867
Re: [FishMonger] Extended attibutes inconsistent error

code for your reference:


use DBI;
use Win32;
use Win32::Process;

# -----------------------------
# Include standard subroutines
# -----------------------------

**************
# ----------------------------------------------------------------------
# Get Command-Line Parameters: Process ID, Sleep time and Program Name
# ----------------------------------------------------------------------

$prcs_cd = $ARGV[0];
$sleeptime = $ARGV[1];
$pgm_nm = $ARGV[2];

# ---------------------
# Initialize Variables
# ---------------------

$log_file = $QMR_PR_LOG_DIR . $pgm_nm . ".log";
$cmd_line = "perl " . $QMR_PR_BIN_DIR . $pgm_nm . " " . $prcs_cd;
$me_cmd_line= "perl " . $QMR_PR_BIN_DIR . "qm_pr_process.plx " .
$prcs_cd . " " . $sleeptime . " " . $pgm_nm;

# --------------------------------
# Connect to the Staging Database
# --------------------------------

UDF_connect_STAGING();

# ---------------------------
# Prepare all SQL Statements
# ---------------------------

# Get Requested Status

$sthGET = $dbh->prepare(
"select rqst_stts_cd, crnt_stts_cd from qmown.t_rpt_prcs
where prcs_cd = ?");
if ($DBI::errstr) {
UDF_die(6,"sthGET Prepare failed");
}

# Update Current Status

$sthUPD = $dbh->prepare(
"update qmown.t_rpt_prcs
set crnt_stts_cd = ?,
rec_updt_uid = 'QMBATCH',
rec_updt_dt = sysdate,
rec_updt_pgm_id = ?
where prcs_cd = ?");
if ($DBI::errstr) {
UDF_die(6,"sthUPD Prepare failed");
}

# Find out if it has been at least 60 minutes since the
# process last logged an "active" message.

$sthGETtime = $dbh->prepare(
"select decode(sign((sysdate - (prcs_msg_dt + 60/1440))),1,'yes','no')
from qmown.t_rpt_prcs_log
where prcs_log_id in
(select max(prcs_log_id)
from qmown.t_rpt_prcs_log
where prcs_cd = ? and
prcs_msg_id = 4)");
if ($DBI::errstr) {
UDF_die(6,"sthGETtime Prepare failed");
}

# --------------------------------------------------------
# Post an "active" message to the log every 60 minutes.
# --------------------------------------------------------

$sthGETtime->execute($prcs_cd);
if ($DBI::errstr) {
UDF_die(7,"sthGETtime Execute failed");
}
$check = $sthGETtime->fetchrow_array();
if ($sthGETtime->rows == 0) {
$check = 'yes';
}

if ($check eq 'yes') {
UDF_Logger($prcs_cd,4,$null);
$dbh->commit;
}

# ----------------------------------------------
# Get the Requested Status Code for the Process
# ----------------------------------------------

$sthGET->execute($prcs_cd);
if ($DBI::errstr) {
UDF_die(7,"sthGET Execute failed");
} else {
@data = $sthGET->fetchrow_array();
$rqst_stts_cd = @data[0];
$crnt_stts_cd = @data[1];
}

if ($rqst_stts_cd ne $crnt_stts_cd) {

# ------------------------------------------------------------
# Update the Current Status Code to the Requested Status Code.
# ------------------------------------------------------------

$sthUPD->execute($rqst_stts_cd, $pgm_nm, $prcs_cd);
if ($DBI::errstr) {
UDF_die(7,"sthUPD Execute failed");
} else {
$prcs_msg_data = "From: " . $crnt_stts_cd . " To: " . $rqst_stts_cd;
UDF_Logger($prcs_cd,8,$prcs_msg_data);
$dbh->commit;
$crnt_stts_cd = $rqst_stts_cd;
}
}

# --------------------------------------------------
# If the Process is in Active status, then spawn
# and WAIT for specified Process to complete.
# --------------------------------------------------

if ($crnt_stts_cd eq 'A') {

$i = Win32::Process::Create($PObj,
$QMR_PERL_EXE,$cmd_line,0,
$Win32::Process::DETACHED_PROCESS
+ $Win32::Process::CREATE_NO_WINDOW,".");
if (!$i) {
UDF_die(5,$pgm_nm . " " . Win32::FormatMessage( Win32::GetLastError()));
} else {
$pid = $PObj->GetProcessID();
$PObj->Wait(INFINITE);
$PObj->GetExitCode($ExitCode);

if ($ExitCode != 0) {
$prcs_msg_data = $pgm_nm . " rc= " . $ExitCode . " " .
Win32::FormatMessage($ExitCode);
UDF_Logger($prcs_cd,3,$prcs_msg_data);
$dbh->commit;
}
}
} # End of Spawning process.

# ----------------------------------------------------
# Spawn another generation of this process controller
# ----------------------------------------------------

UDF_reproduce();

# -------------------
# Close this process
# -------------------

#$sthLOG->finish;
$sthGETtime->finish;
$sthGET->finish;
$sthUPD->finish;
$dbh->disconnect;

# ------------------
# Local Subroutines
# ------------------

sub UDF_die {
UDF_reproduce(); # Reproduce before dying
UDF_Logger($prcs_cd,$_[0],$_[1] . " " . $DBI::errstr); # Try to log the error
$sthLOG->finish;
$sthGET->finish;
$sthUPD->finish;
$dbh->disconnect;
die;
}

sub UDF_reproduce {
# ----------------------------------------------------------------
# If the current status is Active or Dormant, then spawn
# another instance of this process after sleeping for the
# specified time and shut the current one down. otherwise,
# just shut down.
# ----------------------------------------------------------------

if ($crnt_stts_cd ne 'K') {

sleep($sleeptime);

$i = Win32::Process::Create($PObj,$QMR_PERL_EXE,$me_cmd_line,0,
$Win32::Process::DETACHED_PROCESS
+ $Win32::Process::CREATE_NO_WINDOW,".");
if (!$i) {
UDF_die(5,'qm_pr_process.plx ' . Win32::FormatMessage( Win32::GetLastError()));
}
}
}

exit;


FishMonger
Veteran / Moderator

Feb 24, 2009, 5:24 AM


Views: 12862
Re: [lall] Extended attibutes inconsistent error

Please wrap your code with the code tags. The code tags force the posted code to retain its formatting/indentation, which makes it easier to read.

It appears that qm_rr_rplctr.plx is failing. What is that script doing?

Your script is missing 2 very important pagmas which should be in EVERY script you write.
use warnings;
use strict;


Start by adding the warnings pragma and fix all of the warnings that your code generates.

I know you've stripped out portions of your script when you posted it, but as is these are the warnings it produces.

Quote
C:\testing>perl -c lall.pl
Scalar value @data[0] better written as $data[0] at lall.pl line 102.
Scalar value @data[1] better written as $data[1] at lall.pl line 103.
Name "main::QMR_PR_LOG_DIR" used only once: possible typo at lall.pl line 23.
Name "main::log_file" used only once: possible typo at lall.pl line 23.
Name "main::sthLOG" used only once: possible typo at lall.pl line 173.
Name "main::pid" used only once: possible typo at lall.pl line 137.
Name "main::null" used only once: possible typo at lall.pl line 89.


Once the warnings are fixed, then add the strict pragma and fix all of the errors that it points out.


lall
Novice

Feb 24, 2009, 11:26 PM


Views: 12848
Re: [FishMonger] Extended attibutes inconsistent error

Hi

I have used nor the warning text and strict in my file

I am now getting messgae as

Global symbol "$pgm_nm" requires explicit package name at qm_pr_prcs.plx

similar for all variables and then

Execution of qm_pr_prcs.plx aborted due to compilation errors.

Please help


lall
Novice

Feb 24, 2009, 11:27 PM


Views: 12847
Re: [FishMonger] Extended attibutes inconsistent error

along with teh previous error the below thing when only warnings is used



E:\projects\qmbatch\push\bin>perl qm_pr_prcs.plx RU
Use of uninitialized value in concatenation (.) or string at qm_pr_prcs.plx line
53.
Use of uninitialized value in concatenation (.) or string at qm_pr_prcs.plx line
54.
Use of uninitialized value in concatenation (.) or string at qm_pr_prcs.plx line
55.
Use of uninitialized value in concatenation (.) or string at qm_pr_prcs.plx line
55.


FishMonger
Veteran / Moderator

Feb 25, 2009, 3:32 AM


Views: 12844
Re: [lall] Extended attibutes inconsistent error


Quote
Global symbol "$pgm_nm" requires explicit package name at qm_pr_prcs.plx


When you use the strict pragma, you need to declare your vars before using them, normally they're declared with the my keyword.

e.g., these
$prcs_cd = $ARGV[0];
$sleeptime = $ARGV[1];
$pgm_nm = $ARGV[2];

become
my $prcs_cd = $ARGV[0];
my $sleeptime = $ARGV[1];
my $pgm_nm = $ARGV[2];


Quote
Use of uninitialized value in concatenation (.) or string at qm_pr_prcs.plx line
53.

This is coming from the warnings pragma and means that line is using a variable that hasn't been assigned a value.

The use of these 2 pragmas aid in pointing out bugs that can be difficult to track down as well as helping you to write better quality code.


FishMonger
Veteran / Moderator

Feb 25, 2009, 3:43 AM


Views: 12843
Re: [lall] Extended attibutes inconsistent error


Quote
"qm_rr_rplctr.plx rc=255 Extended attibutes inconsistent" error.


That's coming from this section:

Code
if ($ExitCode != 0) { 
$prcs_msg_data = $pgm_nm . " rc= " . $ExitCode . " " .
Win32::FormatMessage($ExitCode);
UDF_Logger($prcs_cd,3,$prcs_msg_data);

Which means you need to look at qm_rr_rplctr.plx to see what would cause it to have a return of 255 and a reason of "Extended attibutes inconsistent"