CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Salnum val code

 



mskaran
New User

Nov 20, 2008, 12:53 AM

Post #1 of 1 (1412 views)
Salnum val code Can't Post

Hi,

Find here the Salarynumber validation code for your reference:

require Maintlib;

my $ReturnCode = FALSE;
my $SalNum;
my $rss_type;
my $PolicyCount = 0;

#Main

my $SalNum = "$ARGV[1]";
my $rss_type = "$ARGV[2]";
print main_sub($SalNum, $rss_type);

sub main_sub
{
if ((length($SalNum) != 0) && ($SalNum !~ /^(\s+)$/))
{
if (length($rss_type) != 0)
{
our $ReadDescSitetable = "READ_ALL description FROM site_table WITH type=\"SLRY_NUM_CHK\" name=\"EXCLUSIONS_$rss_type\";";

my $ReadDescSitetableOP = &Maintlib::batchrun($ReadDescSitetable);
if ($ReadDescSitetableOP eq "record not found" || $ReadDescSitetableOP eq "error")
{
&Maintlib::message("ERROR: Unable to read site table data..");
return "EXP";
}
$ReadDescSitetableOP =~ tr/\n//d;
$ReadDescSitetableOP =~ tr/~//d;
@ReadDescSitetableOPArr = split(/\|/,$ReadDescSitetableOP);
my %hash;
@hash{@ReadDescSitetableOPArr}=();
if (exists $hash{$SalNum})
{
return TRUE;
}
}
our $ReadNumPolicy = "READ_ALL name FROM site_table WITH type=\"SLRY_NUM_CHK\" name =POLICY_\*;";

my $ReadNumPolicyOP = &Maintlib::batchrun($ReadNumPolicy);
if ($ReadNumPolicyOP eq "record not found" || $ReadNumPolicyOP eq "error")
{
&Maintlib::message("ERROR: Unable to read site table data..");
return "EXP";
}
@ReadNumPolicyOPArr = split(/\n/, $ReadNumPolicyOP);

foreach (@ReadNumPolicyOPArr) {$hash{$_}++};
foreach (sort keys %hash) {push @ReadNumUniqueOPArr, $_};
$ReadNumUniqueOPArr = $#ReadNumUniqueOPArr + 1;

POLICYCOUNT: foreach $PolicyList (@ReadNumUniqueOPArr)
{
chop($PolicyList);
our $ReadDescPolicy = "READ_ALL description FROM site_table WITH type=\"SLRY_NUM_CHK\" name=\"$PolicyList\";";
my $ReadDescPolicyOP = &Maintlib::batchrun($ReadDescPolicy);

if ($ReadDescPolicyOP eq "record not found" || $ReadDescPolicyOP eq "error")
{
&Maintlib::message("ERROR: Unable to read site table data..");
return "EXP";
}

chop($ReadDescPolicyOP);
$ReadDescPolicyOP =~ s/\n//g;
$ReadDescPolicyOP =~ s/~/\|/g;
$ReadDescPolicyOP =~ s/SLRY_NUM/\$SalNum/g;
$ReadDescPolicyOP =~ s/\|/\&\&/g;
$ReadDescPolicyOP =~ s/TILDA/~/g;
# $ReadDescPolicyOP =~ s/numeric/\(\\d\)/g;

$forifcond = eval("($ReadDescPolicyOP)");
if(($forifcond))
{
$ReturnCode = TRUE;
last;
}
else
{
$ReturnCode = FALSE;
}
}
return $ReturnCode;
}
else
{
return FALSE;
}
}

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives