View Full Version : File Declaration
dav24
07-14-2005, 03:47 PM
hi there,
I've added a section to a script and the syntax is correct:
$date = new Date::Business();
$hoy=$date->image();
unless ($rec[5]=='XETR') {$date->addb(3)}
else {$date->addb(2)};
$settlement=$date->image();
I'm trying to get $settlement to be $date +2 business days or $date +3 business days depending on the value of $rec[5].
$rec[5] is the extract of the 5th column of an text input file.It's not a fixed variable.
The problem i've got is that the input file is not declared nor recognize so the $rec[5] value is always null.
What lines should i add to 'declare' the input file and get $rec[5] matching something?
Thanks a lot for your help.
joeframbach
07-14-2005, 04:01 PM
$date = new Date::Business();
$hoy=$date->image();
if ($rec[5] ne 'XETR') {$date->addb(3)}
else {$date->addb(2)};
$settlement=$date->image();
dav24
07-14-2005, 04:25 PM
Thanks for the syntax change.
Meanwhile it's still the same because $rec[5] is returning an empty value.
How can i have $rec[5] to return the 5th column from my text input file?
Should i use a open function? a do? else?
THanks!
FishMonger
07-14-2005, 04:28 PM
my $inputfile = 'input.txt';
open (F, $inputfile) || die "can't open $inputfile $!";
my @rec = <F>;
close F;
FishMonger
07-14-2005, 04:32 PM
or
open (F, $inputfile) || die "can't open $inputfile $!";
while (<F>) {
my @rec = split;
($rec[5] ne 'XETR') ? $date->addb(3) : $date->addb(2);
$settlement=$date->image();
.....
.....
}
dav24
07-14-2005, 06:13 PM
Thanks FishMonger,
I'm getting close to it.I think i still have an issue with the input file being comma delimited:
Row,Action,ActionDesc,UserId,BranchSequence,Exchange,Date,Time,RefNum,OrdExecQuant,Status,Side,Symbo l,Currency,Account,Memo,ExecPrice,Broker
0,1,Submit,gc313407,RPN0005,XETR,30/06/2005 06:00:00,01/01/1990 08:11:18,1208410384,10000,Complete,SELL,DTEGn.DE,EUR,"G3444152",,15.17,GSCO
1,1,Submit,gc313407,RPN0007,VRTX,30/06/2005 06:00:00,01/01/1990 08:11:54,1208410401,1874,Partial,SELL,ABBN.VX,CHF,"G3444152",,8.14,GSCO
2,1,Submit,gc313407,RPN0007,VRTX,30/06/2005 06:00:00,01/01/1990 08:11:55,1208410406,48126,Complete,SELL,ABBN.VX,CHF,"G3444152",,8.14,GSCO
3,1,Submit,gc313407,RPN0011,VRTX,30/06/2005 06:00:00,01/01/1990 08:17:46,1208410504,16312,Partial,SELL,ABBN.VX,CHF,"G3444152",,8.12,GSCO
That's my code now:
sub test
{
my $date = sprintf "%02d%02d%02d",
localtime->year %100,
localtime->mon + 1,
localtime->mday;
my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$date.txt";
open (F, $inputfile) || die "can't open $inputfile $!";
my @rec = <F>;
close F;
my $date = new Date::Business();
my $hoy=$date->image();
if ($rec[5] ne 'XETR') {$date->addb(3)}
else {$date->addb(2)};
my $settlement=$date->image();
}
Do i have to add a split and something else to avoid reading the header line of the input file(in bold)?
Thanks!
FishMonger
07-14-2005, 07:37 PM
The way you currently have it written, $rec[5] will hold the 6th row not the 5th column. Also, you have declared my $date twice in the same block/scope which should generate an error. Personally, I prefer to use the POSIX module for formating date strings because it's more versitile.
See if this test is closer to what you're looking for.
#!perl -w
use Date::Business;
use POSIX;
test();
sub test {
# my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$date.txt";
# open (F, $inputfile) || die "can't open $inputfile $!";
# your code dosen't show where you plan on using this date string
my $today = strftime("%Y%m%d", localtime);
<DATA>; # throw away the header line
while (<DATA>) {
my @rec = split ',';
my $date = new Date::Business();
my $hoy=$date->image();
($rec[5] ne 'XETR') ? $date->addb(3) : $date->addb(2);
my $settlement = $date->image();
print $settlement, $/;
}
# close F;
}
__DATA__
Row,Action,ActionDesc,UserId,BranchSequence,Exchange,Date,Time,RefNum,OrdExecQuant,Status,Side,Symbo l,Currency,Account,Memo,ExecPrice,Broker
0,1,Submit,gc313407,RPN0005,XETR,30/06/2005 06:00:00,01/01/1990 08:11:18,1208410384,10000,Complete,SELL,DTEGn.DE,EUR,"G3444152",,15.17,GSCO
1,1,Submit,gc313407,RPN0007,VRTX,30/06/2005 06:00:00,01/01/1990 08:11:54,1208410401,1874,Partial,SELL,ABBN.VX,CHF,"G3444152",,8.14,GSCO
2,1,Submit,gc313407,RPN0007,VRTX,30/06/2005 06:00:00,01/01/1990 08:11:55,1208410406,48126,Complete,SELL,ABBN.VX,CHF,"G3444152",,8.14,GSCO
3,1,Submit,gc313407,RPN0011,VRTX,30/06/2005 06:00:00,01/01/1990 08:17:46,1208410504,16312,Partial,SELL,ABBN.VX,CHF,"G3444152",,8.12,GSCO
FishMonger
07-14-2005, 07:43 PM
My mistake, I do see where you're using the first date string.
my $today = strftime("%y%m%d", localtime); # 2 digit year
#my $today = strftime("%Y%m%d", localtime); # 4 digit year
my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$today.txt";
dav24
07-15-2005, 04:11 PM
I've changed $date for $today to avoid any confussion (even if it was not generating any error).
i can't get 'strftime'(module problem i think but i'm on windows XP) to work so i left it as it was.
The $rec[5] should hold the 6th column (not the 5th),are you sure it is the 6th row?
i'm a bit lost to be honest.Still can get a proper result:
this section generates '1' as a result:
sub test {
my $today = sprintf "%02d%02d%02d",
localtime->year %100,
localtime->mon + 1,
localtime->mday;
my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$today.txt";
open (F, $inputfile) || die "can't open $inputfile $!";
<DATA>;
while (<DATA>) {
my @rec = split ',';
my $date = new Date::Business();
my $hoy=$date->image();
($rec[5] ne 'XETR') ? $date->addb(3) : $date->addb(2);
my $settlement = $date->image();
print $settlement, $/;
}
close F;
}
while this one always generates today +3 business days:
sub test
{
my $today = sprintf "%02d%02d%02d",
localtime->year %100,
localtime->mon + 1,
localtime->mday;
my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$today.txt";
open (F, $inputfile) || die "can't open $inputfile $!";
my @rec = <F>;
close F;
my $date = new Date::Business();
my $hoy=$date->image();
if ($rec[5] ne 'XETR') {$date->addb(3)}
else {$date->addb(2)};
my $settlement=$date->image();
}
Do you see anything wrong?
THanks!
FishMonger
07-15-2005, 05:50 PM
If you did not receiving an error from declaring my $date twice, then you don't have warnings enabled. If you couldn't get the strftime function to work, then you probably didn't load the POSIX module.
The $rec[5] should hold the 6th column (not the 5th),are you sure it is the 6th row?
Arrays are zero indexed which means $rec[0] is the 1st row and $rec[5] is the 6th row. In your original post you said you wanted to extract the 5th column (which would be index 4 not 5).
$rec[5] is the extract of the 5th column of an text input file
Here's a test script that shows the results of your's and my approach.
#!perl -w
use warnings;
use strict;
use Date::Business;
use POSIX;
use Data::Dumper;
print "FishMonger:\n";
fishmonger();
print "\n\ndav24:\n";
dav24();
sub fishmonger {
my $today = strftime("%y%m%d", localtime);
#my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$today.txt";
my $inputfile = "C:/temp/$today.txt";
open (F, $inputfile) || die "can't open $inputfile $!";
<F>;
while (<F>) {
my @rec = split ',';
print "Row: $.\n";
print Dumper @rec;
print $/;
my $date = new Date::Business();
my $hoy=$date->image();
($rec[5] ne 'XETR') ? $date->addb(3) : $date->addb(2);
my $settlement = $date->image();
print "Settlement: $settlement$/";
}
close F;
}
sub dav24
{
my $today = strftime("%y%m%d", localtime);
# my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$today.txt";
my $inputfile = "C:/temp/$today.txt";
open (F, $inputfile) || die "can't open $inputfile $!";
my @rec = <F>;
close F;
print scalar @rec, " Rows in \@rec\n\n";
print Dumper @rec;
print $/;
my $date = new Date::Business();
my $hoy=$date->image();
if ($rec[5] ne 'XETR') {$date->addb(3)}
else {$date->addb(2)};
my $settlement=$date->image();
print "Settlement: $settlement$/";
}
Here's the output I got.
C:\Temp>test.pl
FishMonger:
Row: 2
$VAR1 = '0';
$VAR2 = '1';
$VAR3 = 'Submit';
$VAR4 = 'gc313407';
$VAR5 = 'RPN0005';
$VAR6 = 'XETR';
$VAR7 = '30/06/2005 06:00:00';
$VAR8 = '01/01/1990 08:11:18';
$VAR9 = '1208410384';
$VAR10 = '10000';
$VAR11 = 'Complete';
$VAR12 = 'SELL';
$VAR13 = 'DTEGn.DE';
$VAR14 = 'EUR';
$VAR15 = '"G3444152"';
$VAR16 = '';
$VAR17 = '15.17';
$VAR18 = 'GSCO
';
Settlement: 20050719
Row: 3
$VAR1 = '1';
$VAR2 = '1';
$VAR3 = 'Submit';
$VAR4 = 'gc313407';
$VAR5 = 'RPN0007';
$VAR6 = 'VRTX';
$VAR7 = '30/06/2005 06:00:00';
$VAR8 = '01/01/1990 08:11:54';
$VAR9 = '1208410401';
$VAR10 = '1874';
$VAR11 = 'Partial';
$VAR12 = 'SELL';
$VAR13 = 'ABBN.VX';
$VAR14 = 'CHF';
$VAR15 = '"G3444152"';
$VAR16 = '';
$VAR17 = '8.14';
$VAR18 = 'GSCO
';
Settlement: 20050720
Row: 4
$VAR1 = '2';
$VAR2 = '1';
$VAR3 = 'Submit';
$VAR4 = 'gc313407';
$VAR5 = 'RPN0007';
$VAR6 = 'VRTX';
$VAR7 = '30/06/2005 06:00:00';
$VAR8 = '01/01/1990 08:11:55';
$VAR9 = '1208410406';
$VAR10 = '48126';
$VAR11 = 'Complete';
$VAR12 = 'SELL';
$VAR13 = 'ABBN.VX';
$VAR14 = 'CHF';
$VAR15 = '"G3444152"';
$VAR16 = '';
$VAR17 = '8.14';
$VAR18 = 'GSCO
';
Settlement: 20050720
Row: 5
$VAR1 = '3';
$VAR2 = '1';
$VAR3 = 'Submit';
$VAR4 = 'gc313407';
$VAR5 = 'RPN0011';
$VAR6 = 'VRTX';
$VAR7 = '30/06/2005 06:00:00';
$VAR8 = '01/01/1990 08:17:46';
$VAR9 = '1208410504';
$VAR10 = '16312';
$VAR11 = 'Partial';
$VAR12 = 'SELL';
$VAR13 = 'ABBN.VX';
$VAR14 = 'CHF';
$VAR15 = '"G3444152"';
$VAR16 = '';
$VAR17 = '8.12';
$VAR18 = 'GSCO
';
Settlement: 20050720
dav24:
5 Rows in @rec
$VAR1 = 'Row,Action,ActionDesc,UserId,BranchSequence,Exchange,Date,Time,RefNum,O
ide,Symbo l,Currency,Account,Memo,ExecPrice,Broker
';
$VAR2 = '0,1,Submit,gc313407,RPN0005,XETR,30/06/2005 06:00:00,01/01/1990 08:11:1
omplete,SELL,DTEGn.DE,EUR,"G3444152",,15.17,GSCO
';
$VAR3 = '1,1,Submit,gc313407,RPN0007,VRTX,30/06/2005 06:00:00,01/01/1990 08:11:5
rtial,SELL,ABBN.VX,CHF,"G3444152",,8.14,GSCO
';
$VAR4 = '2,1,Submit,gc313407,RPN0007,VRTX,30/06/2005 06:00:00,01/01/1990 08:11:5
omplete,SELL,ABBN.VX,CHF,"G3444152",,8.14,GSCO
';
$VAR5 = '3,1,Submit,gc313407,RPN0011,VRTX,30/06/2005 06:00:00,01/01/1990 08:17:4
artial,SELL,ABBN.VX,CHF,"G3444152",,8.12,GSCO
';
Use of uninitialized value in string ne at C:\Temp\test.pl line 59.
Settlement: 20050720
FishMonger
07-15-2005, 05:56 PM
Here's an example of an error that youi'd get by declaring $date twice.
C:\Temp>type test1.pl
#!perl -w
use warnings;
use strict;
my $date = 'date1';
my $date = 'date2';
C:\Temp>test1.pl
"my" variable $date masks earlier declaration in same scope at C:\Temp\test1.pl line 7.
dav24
07-20-2005, 04:49 PM
Hi Fishmonger,
I've done the test and get the same as you.
I can now extract $rec[5] and create this $settlement meanwhile i can get the result in a MS-DOS window while running the script but not in the output file as needed.I put the whole script like that you can have a better vision.The section is called sub fishmonger (and it's called/executed in the next sub section).
So far it's still returning '1' in my output file.
use Getopt::Std;
use Time::localtime;
use User::pwent;
use Time::Format;
use Date::Business;
#use warnings;
#use POSIX;
do 'C:/Program Files/GS/sfadrrc.txt';
$transactionCount = 0; # number of transactions processed.
sub OpenREDIReportFile {
my ($today) = @_;
local *FH;
unless ($today) {
$today = sprintf "%02d%02d%02d",
localtime->year %100,
localtime->mon + 1,
localtime->mday;
}
open(FH, "<C:/Program Files/GS/RediMessageLog/REDI-Execution-$today.txt")
or die "Cannot open REDI Report file for this date $today";
return *FH;
}
# Closes a REDI Report file.
sub CloseREDIReportFile {
my ($fh) = @_;
close($fh)
or die "could not close REDI report file";
}
# Writes an SFA Direct Report Header.
sub WriteSFADRHeader {
my ($fh) = @_;
my $header = sprintf "0TRANSACTION REPORT %04d%02d%02d%06d%03d%-361s\n",
localtime->year + 1900,
localtime->mon +1,
localtime->mday,
$SFACODE,
0,
" ";
print $fh $header;
}
# Writes an SFA Direct Report Trailer.
sub WriteSFADRTrailer {
my ($fh) = @_;
my $trailer = sprintf "9TRANSACTION REPORT %8d%06d%03d%-361s\n",
$transactionCount,
$SFACODE,
0,
" ";
print $fh $trailer;
}
# Creates an SFA Direct Report file, optionally timestamped for a given date.
sub OpenSFADRFile {
my ($date) = @_;
local *FH;
unless ($date) {
$date = sprintf "%04d%02d%02d",
localtime->year +1900,
localtime->mon + 1,
localtime->mday;
}
open(FH, ">C:/Program Files/GS/output/SFADR_$date.bin")
or return undef;
WriteSFADRHeader(*FH);
return *FH;
}
# Closes an SFA Direct Report file.
sub CloseSFADRFile {
my ($fh) = @_;
WriteSFADRTrailer($fh);
close ($fh)
or die "could not close SFA Direct Report file";
}
# Converts a REDI report record, returns true if the conversion was
# sucessful. This routine is COMPLETELY DEPENDENT on proper formatting of
# the REDI report file.
#
# Ideally, we should parse REDI-Execution-YYMMDD.txt to:
#
# 1) find out which field separator is used
# 2) ensure all required fields are exported
# 3) determine their position and formatting
#
#
#
# Also:
#
# 1) there is no provision for reporting anything else than securities
# (no derivatives)
# 2) Instruments are always reported using SEDOLs
# 2) the SEDOLs and the Exchanges are harcoded
# 3) the counterparties are assumed to be identical for all transactions
#
#
# *************
sub fishmonger {
my $today = sprintf "%02d%02d%02d",
localtime->year %100,
localtime->mon + 1,
localtime->mday;
my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$today.txt";
open (F, $inputfile) || die "can't open $inputfile $!";
<F>;
while (<F>) {
my @rec = split ',';
my $date = new Date::Business();
my $hoy=$date->image();
chomp($rec[5]);
($rec[5] ne 'XETR') ? $date->addb(3) : $date->addb(2);
my $settlement = $date->image();
# print "$rec[5]\n";
# print $settlement, $/;
}
close F;
}
#sub test
#{
#my $today = sprintf "%02d%02d%02d",
# localtime->year %100,
# localtime->mon + 1,
# localtime->mday;
#my $inputfile = "C:/Program Files/GS/RediMessageLog/REDI-Execution-$today.txt";
#open (F, $inputfile) || die "can't open $inputfile $!";
#my @rec = <F>;
#close F;
#my $date = new Date::Business();
#my $hoy=$date->image();
#chop($rec[5]);
#if ($rec[5] ne 'XETR') {$date->addb(3)}
#else {$date->addb(2)};
#my $settlement=$date->image();
#print "#$rec[5]#\n";
#}
sub ConvertREDIReportRecord {
my @rec = @_;
if ($rec[0] =~ /Row/) { # this is the report header, ignore
return undef;
}
my $transaction = sprintf "1%07dA %-15s%1s%-11s%-17s%017d%-1s%3s%015.0f%-8s%-2s%-2s%-8s%-8s%-3s%-16s%3s%1s%1s%-11s%-17s%2s%-12s%-60s%-60s%017d%1s%19s%013d%-45s\n",
$OWNCODE,
substr($rec[8], 0, 15),
"S",
"142888",
"GSIINTERNALSUBCOD",
$rec[9] * 100,
substr($rec[11], 0, 1),
$rec[13],
$rec[16] * 1000000.0,
$today,
substr($rec[7], 11, 2), # hours
substr($rec[7], 14, 2), # minutes
fishmonger(),
" ",
" ",
" ",
$market{$rec[5]}[0],
"A",
$ONBEHALFOF[0],
$ONBEHALFOF[1],
$ONBEHALFOF[2],
"SE",
$sedol{$rec[12]}[0],
" ",
" ",
0,
" ",
" ",
1000000,
" ";
return $transaction;
}
# Converts a REDI report file. Defaults to processing today's report,
# unless passed a date argument (format YYYYMMDD).
sub ConvertREDIReportFile {
my ($date) = @_;
my $inp = OpenREDIReportFile($date);
my $out = OpenSFADRFile($date);
my $line;
my @rec;
while (defined ($line = <$inp>)) {
chomp $line;
@rec = split(/,/, $line);
if (defined ($transaction = ConvertREDIReportRecord(@rec))) {
print $out $transaction;
$transactionCount++;
}
}
CloseSFADRFile($out);
CloseREDIReportFile($inp);
}
# Main routine. The program takes an optional command line argument in order
# to convert previous day reports.
getopts("d:");
if ($opt_d) {
if ($opt_d =~ /^(\d{8,8})$/) { # Untaint the argument
$opt_d = $1;
ConvertREDIReportFile($opt_d);
}
else {
die "usage: $0 [-d YYMMDD]";
}
}
else {
do 'C:/Program Files/GS/sfadrrc.txt';
ConvertREDIReportFile;
}
Cheers!
dav24
07-28-2005, 05:22 PM
Hi All,
The above code is now generating a date + 3 (or 2) business days (thanks Fishmonger!).
I've got a quick last issue in my output file: the date is generated at the bottom of the file hence is not incorporated in every result line:
what i have:
0TRANSACTION REPORT 20050728100438000
10195756A 1208410265 S142888 GSIINTERNALSUBCOD00000000000061700SEUR0000000110200002005072808051 AMSAS156407 GLCINTERNALSUBCODSE5927375 00000000000000000 0000001000000
10195756A 1208410273 S142888 GSIINTERNALSUBCOD00000000000438300SEUR0000000110200002005072808051 AMSAS156407 GLCINTERNALSUBCODSE5927375 00000000000000000 0000001000000
10195756A 1208410275 S142888 GSIINTERNALSUBCOD00000000000500000SEUR0000000110200002005072808051 AMSAS156407 GLCINTERNALSUBCODSE5927375 00000000000000000 0000001000000
10195756A 1208410576 S142888 GSIINTERNALSUBCOD00000000000612500SEUR0000000041900002005072808131 MILAS156407 GLCINTERNALSUBCODSE4079631 00000000000000000 0000001000000
10195756A 1208410577 S142888 GSIINTERNALSUBCOD00000000000387500SEUR0000000041900002005072808131 MILAS156407 GLCINTERNALSUBCODSE4079631 00000000000000000 0000001000000
10195756A 1208410612 S142888 GSIINTERNALSUBCOD00000000000105900SEUR0000000041950002005072808141 MILAS156407 GLCINTERNALSUBCODSE4079631 00000000000000000 0000001000000
10195756A 1208410629 S142888 GSIINTERNALSUBCOD00000000000435800SEUR0000000071800002005072808151 MILAS156407 GLCINTERNALSUBCODSE7144569 00000000000000000 0000001000000
10195756A 1208410633 S142888 GSIINTERNALSUBCOD00000000001180100SEUR0000000071800002005072808151
20050802
20050802
20050802
20050802
20050802
20050802
20050802
20050802
and what i would like(date at the good position and in bold):
0TRANSACTION REPORT 20050728100438000
10195756A 1208410265 S142888 GSIINTERNALSUBCOD00000000000061700SEUR000000011020000200507280805120050802 AMSAS156407 GLCINTERNALSUBCODSE5927375 00000000000000000 0000001000000
10195756A 1208410273 S142888 GSIINTERNALSUBCOD00000000000438300SEUR000000011020000200507280805120050802 AMSAS156407 GLCINTERNALSUBCODSE5927375 00000000000000000 0000001000000
10195756A 1208410275 S142888 GSIINTERNALSUBCOD00000000000500000SEUR000000011020000200507280805120050802 AMSAS156407 GLCINTERNALSUBCODSE5927375 00000000000000000 0000001000000
10195756A 1208410576 S142888 GSIINTERNALSUBCOD00000000000612500SEUR000000004190000200507280813120050802 MILAS156407 GLCINTERNALSUBCODSE4079631 00000000000000000 0000001000000
10195756A 1208410577 S142888 GSIINTERNALSUBCOD00000000000387500SEUR000000004190000200507280813120050802 MILAS156407 GLCINTERNALSUBCODSE4079631 00000000000000000 0000001000000
10195756A 1208410612 S142888 GSIINTERNALSUBCOD00000000000105900SEUR000000004195000200507280814120050802 MILAS156407 GLCINTERNALSUBCODSE4079631 00000000000000000 0000001000000
10195756A 1208410629 S142888 GSIINTERNALSUBCOD00000000000435800SEUR000000007180000200507280815120050802 MILAS156407 GLCINTERNALSUBCODSE7144569 00000000000000000 0000001000000
10195756A 1208410633 S142888 GSIINTERNALSUBCOD00000000001180100SEUR000000007180000200507280815120050802 MILAS156407 GLCINTERNALSUBCODSE7144569 00000000000000000
0000001000000
and so on...
I don't think it's a big deal but i don't know how to fix it.
The script is the same as above except the Subsection creating the date (called fishmonger before now called settlementdate):
sub settlementdate {
my $today = sprintf "%02d%02d%02d",
localtime->year %100,
localtime->mon + 1,
localtime->mday;
my $newdate = sprintf "%04d%02d%02d",
localtime->year +1900,
localtime->mon + 1,
localtime->mday;
my $inputfile = "C:/Program Files/GS/REDI-Execution-$today.txt";
my $outputfile = "C:/Program Files/GS/SFADR_$newdate.bin";
open(TEST, ">>$outputfile") || die "can't open $outputfile $!";
open (F, $inputfile) || die "can't open $inputfile $!";
<F>;
while (<F>) {
my @rec = split ',';
my $date = new Date::Business();
my $hoy=$date->image();
chomp($rec[5]);
($rec[5] ne 'XETR') ? $date->addb(3) : $date->addb(2);
my $settlement = $date->image();
# print "$rec[5]\n";
print $settlement, $/;
print TEST $settlement, $/;
}
close F;
close TEST;
thanks to anyone that could help.
FishMonger
07-28-2005, 07:28 PM
Your code is a little obfuscated but I'd say you need to add the date when you're building $transaction in the ConvertREDIReportRecord subroutine but due to the obfuscation, I can't say for sure without samples of your data files to test.
dav24
07-28-2005, 08:01 PM
What would be the best way to provide you sample? copy & paste here?
As you've seen the ConvertREDIReportRecord is the section where the elements are created/extracted to be put in the result/output file.
they are all done in a certain order but for some reason the $settlement is printed at the end of the file.
FishMonger
07-28-2005, 08:48 PM
You can either copy/past the sample data or send me an email and attach the script and data.
Would you like me to look at fixing some of the obfuscation? I'm willing to do so.
FishMonger
08-04-2005, 03:06 AM
Dave,
I've been busy moving into my new place so I haven't done any more troubleshooting since our last email exchange. Are you still getting the same error when running through the debugger?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.