Batch-Batchrun
view release on metacpan or search on metacpan
Batchrun.pm view on Meta::CPAN
if ( $Batch::Batchrun::DBHTMM{DBPROC} )
{
$Batch::Batchrun::DBHTMM{DBPROC}->disconnect;
}
exit $rc;
}
else
{
exit $Batch::Batchrun::NoErrors;
}
}
sub execute
{
my $rca =extract_task();
if ($rca != $Batch::Batchrun::NoErrors)
{
print $Batch::Batchrun::ErrorSeparator . "** $Batch::Batchrun::Msg \n" . $Batch::Batchrun::ErrorSeparator;
return $rca;
}
if ( $Batch::Batchrun::Counter == 1 )
{
my $rcd = print_execution_map();
}
if ($Batch::Batchrun::CheckOnly)
{
validate();
print "===SYNTAX CHECK COMPLETE===\n";
exit;
}
my $rcb = process_steps();
return $rcb;
}
sub EndOfTaskReport
{
$Batch::Batchrun::TaskEndTime = time;
my $TimeDiff = $Batch::Batchrun::TaskEndTime
- $Batch::Batchrun::TaskStartTime;
$Batch::Batchrun::TotalTaskTime = $TimeDiff;
my($hours) = int($TimeDiff/3600);
my($minutes) = int(($TimeDiff - ($hours * 3600))/60);
my($seconds) = int (($TimeDiff - ($hours * 3600) - ($minutes * 60)));
my $time_date =
sprintf("%2.2d:%2.2d:%2.2d",$hours,$minutes,$seconds);
my $timestr = localtime();
my $steparray;
my $stepnum = 0;
my $i;my $j;
my $connect;
my $cpu;
my $iterations;
my $status;
my $cmd;
print $Batch::Batchrun::EventSeparator;
print "\n";
print " ######################################################################\n";
print " #### END OF TASK REPORT ####\n";
print " #### ( In order of execution ) ####\n";
print " ######################################################################\n";
print " Command Connect CPU \n",
" Step# Name Time Time Iterations Status \n";
print " ----------------------------------------------------------------------\n";
eval <<'____END_OF_PLAIN_STUFF';
format STDOUT =
@<<<<<<<< @<<<<<<<<<<<<<< @<<<<<<< @<<<<<<<<<< @<<<< @<<<<<<
$stepnum,$cmd,$connect,$cpu,$iterations,$status
.
____END_OF_PLAIN_STUFF
my %seen;
foreach $num ( @Batch::Batchrun::StatsOrder )
{
$stepnum = $num;
$iterations = $Batch::Batchrun::Stats{$stepnum}{'Iterations'};
next if $seen{$stepnum};
$seen{$stepnum} = 1;
if ($iterations > 0)
{
($hours) = int($Batch::Batchrun::Stats{$stepnum}{StepTimes}/3600);
($minutes) = int(($Batch::Batchrun::Stats{$stepnum}{StepTimes} - ($hours * 3600))/60);
($seconds) = int (($Batch::Batchrun::Stats{$stepnum}{StepTimes} - ($hours * 3600) - ($minutes * 60)));
$connect = sprintf("%2.2d:%2.2d:%2.2d",$hours,$minutes,$seconds);
($hours) = int($Batch::Batchrun::Stats{$stepnum}{StepCPUTimes}/3600);
($minutes) = int(($Batch::Batchrun::Stats{$stepnum}{StepCPUTimes} - ($hours * 3600))/60);
($seconds) = ($Batch::Batchrun::Stats{$stepnum}{StepCPUTimes} - ($hours * 3600) - ($minutes * 60));
($hundreds) = ($Batch::Batchrun::Stats{$stepnum}{StepCPUTimes} - ($hours * 3600) - ($minutes * 60) - $seconds);
$cpu = sprintf("%2.2d:%2.2d:%04.2f",$hours,$minutes,$seconds);
$status = $Batch::Batchrun::Stats{$stepnum}{Status};
$status = 'Success' if ($status == $Batch::Batchrun::NoErrors);
$status = 'Error ' if ($status == $Batch::Batchrun::ErrorCode);
$status = 'Warning' if ($status == $Batch::Batchrun::WarningCode);
$cmd = $Batch::Batchrun::Stats{$stepnum}{'CommandName'};
if ($cmd =~ /^DO|^GOSUB/io)
{
#$iterations = $Batch::Batchrun::Stats{$stepnum}{'LoopIterations'};
$iterations-- if $iterations > 1;
}
$iterations = '' if $iterations < 2;
#else
# {
# $iterations = '';
# }
write;
}
}
print " ----------------------------------------------------------------------\n";
print " Task: $Batch::Batchrun::Control{$Batch::Batchrun::Counter}{'TASK'} ",
" Application: $Batch::Batchrun::Control{$Batch::Batchrun::Counter}{'APP'} \n";
print " Total Task Time: $time_date Completed: $timestr \n";
print " ######################################################################\n";
}
1;
__END__
# Autoload methods go after =cut, and are processed by the autosplit program.
# Below is the stub of documentation for your module. You better edit it!
=head1 NAME
Batch::Batchrun - Batch Control language
=head1 SYNOPSIS
use Batch::Batchrun;
blah blah blah
=head1 DESCRIPTION
Stub documentation for Batch::Batchrun was created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.
Blah blah blah.
=head1 AUTHOR
A. U. Thor, a.u.thor@a.galaxy.far.far.away
=head1 SEE ALSO
perl(1).
=cut
( run in 0.611 second using v1.01-cache-2.11-cpan-71847e10f99 )