OXIESEC PANEL
- Current Dir:
/
/
home
/
cubot
/
bin
/
etl_odbc
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📄
-d
10 bytes
02/03/2023 07:34:13 AM
rw-r--r--
📁
..
-
02/03/2023 08:06:37 AM
rwxr-xr-x
📄
config.pl
7.61 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
cross2normal.pl
3.71 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
dataextract.sh
2.51 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
etl.pl
5.42 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
etlproc
9.99 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
func.pl
4.01 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
globvar.sh
127 bytes
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
initetl.pl
1.88 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
libawk.awk
3.07 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
makeXtab2NormalExcel.pl
5.73 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
process.pl
6.91 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
process_changed.pl
5.69 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
readwrite.pl
4.16 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxcsv.pl
7.94 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxdb.pl
11.06 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxfile.pl
4.68 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxsalesforce.pl
3.5 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxxml.pl
13.83 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxxml2.pl
4.18 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
sendmail.pl
1.06 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
sourcequery.pl
4.18 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
sql.pl
23.98 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
store.pl
7.97 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
tags
13.14 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
task.pl
33.48 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📁
test
-
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
userfunc.pl
5.05 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
valid.pl
3.64 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
workflow.pl
3.94 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
xform.pl
2.62 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
Editing: rxfile.pl
Close
#!/usr/bin/perl #testfun(); sub testfun{ my $fh; #openfile('abcd.out', 'r', \$fh); $fh = openfile('/tmp/and.txt', 'r'); @width=(2,4,6); doselectline($fh, 'D', 'AND', \@width); closefile(\$fh); } sub openfile{ my $FILEH; my ($filename, $openmode) = @_; if($openmode eq 'w'){ $filename = ">".$filename; } elsif($openmode eq 'a'){ $filename = ">>".$filename; } #open($$FILEH, "$filename") or return 'ERR'; open($FILEH, "$filename") or $G_Err = $! && return 'ERR'; printlog($MAX, "Open File $filename"); return $FILEH; } sub closefile{ my ($fh) = @_; close($$fh); } my $G_lineread_errtime = 0; sub doselectline{ my ($fhandle, $ftype, $fdelim, $fwidth, $txtqf, $storetype, $dateformat, $tablemapping) = @_; my @data= (); my ($xfdisable, $validdisable ) = (@$tablemapping[6], @$tablemapping[7]); my $qfopen = 0; my $colstr = ""; my @arr =(); $G_inputDataLine = <$fhandle> or return 'ERR'; chomp($G_inputDataLine); # if($ftype eq 'D'){ if($storetype eq 'F'){ # if(($txtqf ne '0') &&($txtqf ne '')){ # $fdelim = '\\'.$txtqf.$fdelim.$txtqf; # } # else{ # $fdelim = '\\'.$fdelim; # } $fdelim = '\\'.$fdelim; @data = split(/$fdelim/, $G_inputDataLine); if(($G_numcols>0)&&($G_datecol eq 'Y')){ #if($G_inputDataLine){ $G_correctline=$G_correctline.$G_inputDataLine; #} # chomp($G_correctline); $G_correctline=~s/\\/\\\\/g; @data = split(/$fdelim/, $G_correctline); $length=scalar @data; printlog($MAX, "Lengt:$length and G_numcols:$G_numcols"); if($length >= $G_numcols){ $G_correctline=""; } else{ return "blanklines"; } } foreach my $datecolrow (@data){ # issue 1101 if($datecolrow =~ /^$txtqf/ && $datecolrow =~ /$txtqf$/){ push(@arr, $datecolrow); } else{ if($datecolrow =~ /^$txtqf/){ $colstr=$datecolrow; $qfopen=$qfopen+1; } else{ if($qfopen=~ /^0$/){ push(@arr, $datecolrow); } } if($qfopen>1){ $colstr=$colstr.$fdelim.$datecolrow; } if($datecolrow =~ /$txtqf$/){ $colstr=$colstr.$fdelim.$datecolrow; push(@arr, $colstr); $qfopen=0; } } } @data = @arr; } else{ $fdelim = '\\'.$fdelim; @data = split(/$fdelim/, $G_inputDataLine); } # } # elsif($ftype eq 'F'){ # @data = getstr_fwidth($G_inputDataLine, $fwidth); # } if(($xfdisable eq "1") && ($validdisable eq "1")){ foreach my $datecolrow (@$dateformat){ @array=split(/:/, $datecolrow); my $ord= @array[1]; my $str = @array[0]; @data[$ord]=makedate(@data[$ord], $str); } } if($#data < 0){ if($G_lineread_errtime eq 1){ $G_lineread_errtime = 0; return 'ERR'; } printlog($ERROR, "$#data No Data"); push(@data, ''); $G_lineread_errtime = 1; } return @data; } sub doselectline_1{ my ($fhandle, $ftype, $fdelim, $fwidth) = @_; my @data= (); #G_inputDataArray $G_inputDataLine = <$fhandle> or return 'ERR'; #printlog($MAX, "$ftype, [$fdelim], @$fwidth Read : $G_inputDataLine"); chomp($G_inputDataLine); if($ftype eq 'D'){ $fdelim = '\\'.$fdelim; @data = split(/$fdelim/, $G_inputDataLine); } elsif($ftype eq 'F'){ @data = getstr_fwidth($G_inputDataLine, $fwidth); } #printlog($MAX, "$#data:\t<<@data>>"); if(($#data < 0) and ($G_lineread_errtime eq 1)){ return 'ERR'; } if($#data < 0){ printlog($ERROR, "$#data No Data"); push(@data, ''); $G_lineread_errtime = 1; #return 'ERR'; } #printlog($MAX, "DATA : @data"); return @data; } sub getstr_fwidth{ my ($str, $widtharr) = @_; my $fmt; for(my $i=0; $i<@$widtharr; $i++){ $fmt = $fmt."a@{@$widtharr[$i]}"; } my @arr = unpack($fmt, $str); @arr; } sub putstr_fwidth{ my ($inarr, $widtharr) = @_; my $fmt; for(my $i=0; $i<@$widtharr; $i++){ $fmt = $fmt."A@$widtharr[$i]"; } my @arr = pack($fmt, @$inarr); @arr; } sub writefile{ my ($FH, $destid, $file, $indata, $hfinfo, $hwidth, $hdesterrlog) = @_; my @data; printlog($MAX, "Sending to File >> @$indata << $destid, $file, $indata, @{$$hfinfo{$destid, $file}}[4], $hwidth"); if(@{$$hfinfo{$destid, $file}}[4] eq 'D'){ @data = join(@{$$hfinfo{$destid, $file}}[5], @$indata); } else{ @data = putstr_fwidth($indata, $$hwidth{$destid, $file}); } printlog($MAX, "Finally Writing to File >> @data <<"); printlog($MAX, "$FH _ $destid _ $file _ ** @{$$hfinfo{$destid, $file}} _ @data . NUM REC DISC: $G_NumRecDisc++"); my $er = $!; print $FH @data, "\n" or &logaserr($destid, $deststoretype, $er, \@data, $hdesterrlog); # print $FH @data, "\n" or $er=$! && $G_NumRecDisc++; } sub getdelim{ my $dl = shift; if(substr($dl, 0, 3) ne 'chr'){ return $dl; } else{ my $delim = ''; my @dlarr = split('\)', $dl); for(my $i=0; $i<=$#dlarr; $i++){ $dlarr[$i]=$dlarr[$i].")"; $delim.=eval($dlarr[$i]); } return $delim; } } 1;