use HTTP::Date qw(time2iso str2time time2iso time2isoz);
use POSIX;
use DBI;
my $dbName = 'tlyy';
my $dbUser = 'tlcbuser';
my $dbUserPass = 'tlcbuser';
my $dbhload = DBI->connect("dbi:Oracle:$dbName", $dbUser, $dbUserPass) or die "can't connect to database ";
my @files=glob "./success.msg*";
my $year = strftime("%Y",localtime());
print $SDATE."
";
foreach $a (@files){
local $/="[$year-";
open (FILE,"<",$a) || die "$!";
while(<FILE>){
chomp;
my $b=$/.$_;
if ($b =~/XMLs+ibps.101.001.02s+d{41}D/i){
print "$b".'->'.$b."
";
if ($b =~/s*[(d{1,4}-d{1,2}-d{1,2}s+d{1,2}:d{1,2}:d{1,2}).d+].*<MsgId>(.*?)</MsgId>.*/smi){
my $a=$1;
my $b=$2;
print $b.'->'.$a."
";
my $sql=qq{insert into ibps_in values ('$b',to_date('$a','YYYY-MM-DD HH24:MI:SS'))};
$dbhload->do($sql) ;
}
};
if ($b =~/XMLs+ibps.102.001.01s+d{41}U/i){
if ($b =~/s*[(d{1,4}-d{1,2}-d{1,2}s+d{1,2}:d{1,2}:d{1,2}).d+].*<OrgnlMsgId>(.*?)</OrgnlMsgId>.*/smi){
my $a=$1;
my $b=$2;
print $b.'->'.$a."
";
my $sql=qq{insert into ibps_out values ('$b',to_date('$a','YYYY-MM-DD HH24:MI:SS'))};
$dbhload->do($sql) ;
};
};
};
close FILE;
};