Created
November 13, 2023 15:45
-
-
Save jeansymolanza/fcb19ab56e5a0aa5dda0f0be3f17fb3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub CreateFile { | |
printLog("Started creating file", "MAIN"); | |
open INFILE, $rds_file or die("Failed to open $rds_file ($!)"); | |
$outfile = "Sudthome/batch/logs/fx_rate_bcp_load_" . time . "out"; | |
open (my $Sout, ">", $outfile) or printSyslog("Failed to open BCP out file $outfile"); | |
while (<INFILE>) { | |
chomp; | |
$row = $_; | |
$row = EscapeSpecialCharacters($row); | |
$rows++; | |
if ($rows != 1 && $row =~ /\S/) { | |
my @columns = split(/\s+/, $row); | |
my $date = $columns[2]; | |
my ($year, $month, $day) = split('/', $date); | |
$columns[2] = "$year/$day/$month"; | |
$row = join(' ', @columns); | |
print $Sout $row . "In"; | |
} | |
} | |
close ($Sout); | |
close INFILE; | |
$dbh = { RaiseError => 1 }; | |
printLog("File created at $outfile"); | |
printLog("Finished creating file", "MAIN"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment