• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Compiling without output

Example of input:
01|1101111110111111011111101111110|1999|0605|0605|0700|0700|KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
01|1111111111111111111111111111111|1999|1240|1240|1345|1345|EIDW|KIR |F50 |00022|     |0065|   |                           | | |EI|516360|02250}|511860|03426}|DUB||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
01|1111111111111111111111111111111|1999|1410|1410|1505|1505|KIR |EIDW|F50 |00023|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
05|1000000100000010000000000000000|1999|1730|1630|1905|1805|EGBB|EICK|BA46|00767|  288|  95|   |AER LINGUS                 | |A|EI|512820|00630}|510600|03054}|BHX||4930|4410|BIRMINGHAM: ENGLAND (UK)   |CORK: REPUBLIC OF IRELAND  | 75|146|J|UNITED KINGDOM             |REPUBLIC OF IRELAND        |EIN
05|0000000000000000000001000000100|1999|1730|1630|1845|1745|EGBB|EICK|BA46|00767|  288|  75|   |AER LINGUS                 | |A|EI|512820|00630}|510600|03054}|BHX||4930|4410|BIRMINGHAM: ENGLAND (UK)   |CORK: REPUBLIC OF IRELAND  | 75|146|J|UNITED KINGDOM             |REPUBLIC OF IRELAND        |EIN
05|0100000010000001000000000000000|1999|1845|1745|2010|1910|EICK|EGBB|F50 |00768|  288|  85|   |AER LINGUS                 | |C|EI|510600|03054}|512820|00630}|ORK||4410|4930|CORK: REPUBLIC OF IRELAND  |BIRMINGHAM: ENGLAND (UK)   | 50|F50|T|REPUBLIC OF IRELAND        |UNITED KINGDOM             |EIN

Code

#usr/local/bin/perl -w

open INPUT,"</home/tmclaugh/oag/bin/ein99_prep" or die "can't open ein99_prep $!";
open OUTPUT,">/home/tmclaugh/oag/bin/flight.dbload" or die "can't open flight.dbload $!";

$UID='000000';
while($line=<INPUT> ){
            
                @field=(split(/\|/,$line));
                $month=$field[0];
                $days=$field[1];
                $year=$field[2];
                $departure_local_time=$field[3];
                $departure_gmt_time=$field[4];
                $arrival_local_time=$field[5];
                    $departure_gmt_time=$field[6];
                    $arrival_airport_id=$field[7];
                    $aircraft_type=$field[8];
                    $flight_number=$field[9];
                    $distance=$field[10];
                    $elapsed_time=$field[11];
                    $ata_carrier_id=$field[12];
                    $air_carrier_full_name=$field[13];
                    $operator_type=$field[14];
                    $carrier_type=$field[15];
                    $carrier_code=$field[16];
                    $departure_latitude=$field[17];
                    $departure_longitude=$field[18];
                    $arrival_latitude=$field[19];
                    $arrival_longitude=$field[20];
                    $ata_departure_airport_id=$field[21];
                    $ata_arrival_airport_id=$field[22];
                    $departure_country_code=$field[23];
                    $arrival_country_code=$field[24];
                    $departure_city=$field[25];
                    $arrival_city=$field[26];
                    $seats=$field[27];
                    $ata_aircraft_type=$field[28];
                    $equipment_type=$field[29];
                $departure_country=$field[30];
                    $arrival_country=$field[31];
                    $air_carrier_id=$field[32];
                    if ($departure_longitude=~ /[0-9]{5}[KROM\{]/) {
                            $departure_longitude = "+" . substr($departure_longitude,0,5);
                    }
                    elsif ($departure_longitude =~ /[0-9]{5}[ABCDEFGHIJLNPQ\}]/) {
                            $departure_longitude = "-" . substr($departure_longitude,0,5);
                    }
                    else {
                    }
                    if ($arrival_longitude =~ /[0-9]{5}[KROM\{]/) {
                            $arrival_longitude = "+" . substr($arrival_longitude,0,5);
                    }
                    elsif ($arrival_longitude=~ /[0-9]{5}[ABCDEFGHIJLNPQ\}]/) {
                            $arrival_longitude = "-" . substr($arrival_longitude,0,5);
                    }
                    else {

                    }

                  @day=(0,split//,$days);
                  for(grep $day[$_],1..31){
                  $days=substr"0$_",-2;
                  ++$UID;
                                        print OUT "$month$UID|$month$day$year_$departure_local_time|$month$day$year_$departure_gmt_time|$month$day$year_$arrival_local_time|$month$day$year_$arrival_gmt_time|$departure_airport_id|$arrival_airport_id|$aircraft_type|$flight_number|$distance|$elapsed_time|$ata_carrier_id|$air_carrier_full_name|$operator_type|$carrier_type|$carrier_code|$departure_latitude|$departure_longitude|$arrival_latitude|$arrival_longitude|$ata_departure_airport_id|$ata_arrival_airport_id|$departure_country_code|$arrival_country_code|$departure_city|$arrival_city|$seats|$ata_aircraft_type|$equipment_type|$departure_country|$arrival_country|$air_carrier_id"

      }
}


I am not getting any output to
the OUT file.


Any suggestions appreciated
0
tomatocans
Asked:
tomatocans
  • 5
1 Solution
 
tomatocansAuthor Commented:
There is a ; after the print OUT statement
0
 
shlomoyCommented:
#usr/local/bin/perl -w
should be
#!/usr/local/bin/perl -w

 print OUT
should be
print OUTPUT
0
 
tomatocansAuthor Commented:
I apologize for the bonehead error. Yes I am now getting output but the loop for day is not working nor is adjustment for departure and arrival longitudes.

This is a dire emergency if u could please apply your expertise I would be eternally greatful.

Tom
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
tomatocansAuthor Commented:
Example of input:
01|1101111110111111011111101111110|1999|0605|0605|0700|0700|KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
01|1111111111111111111111111111111|1999|1240|1240|1345|1345|EIDW|KIR |F50 |00022|     |0065|   |                           | | |EI|516360|02250}|511860|03426}|DUB||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
01|1111111111111111111111111111111|1999|1410|1410|1505|1505|KIR |EIDW|F50 |00023|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
05|1000000100000010000000000000000|1999|1730|1630|1905|1805|EGBB|EICK|BA46|00767|  288|  95|   |AER LINGUS                 | |A|EI|512820|00630}|510600|03054}|BHX||4930|4410|BIRMINGHAM: ENGLAND (UK)   |CORK: REPUBLIC OF IRELAND  | 75|146|J|UNITED KINGDOM             |REPUBLIC OF IRELAND        |EIN
05|0000000000000000000001000000100|1999|1730|1630|1845|1745|EGBB|EICK|BA46|00767|  288|  75|   |AER LINGUS                 | |A|EI|512820|00630}|510600|03054}|BHX||4930|4410|BIRMINGHAM: ENGLAND (UK)   |CORK: REPUBLIC OF IRELAND  | 75|146|J|UNITED KINGDOM             |REPUBLIC OF IRELAND        |EIN
05|0100000010000001000000000000000|1999|1845|1745|2010|1910|EICK|EGBB|F50 |00768|  288|  85|   |AER LINGUS                 | |C|EI|510600|03054}|512820|00630}|ORK||4410|4930|CORK: REPUBLIC OF IRELAND  |BIRMINGHAM: ENGLAND (UK)   | 50|F50|T|REPUBLIC OF IRELAND        |UNITED KINGDOM             |EIN

Code

#usr/local/bin/perl -w

open INPUT,"</home/tmclaugh/oag/bin/ein99_prep" or die "can't open ein99_prep $!";
open OUTPUT,">/home/tmclaugh/oag/bin/flight.dbload" or die "can't open flight.dbload $!";

$UID='000000';
while($line=<INPUT> ){
            
                @field=(split(/\|/,$line));
                $month=$field[0];
                $days=$field[1];
                $year=$field[2];
                $departure_local_time=$field[3];
                $departure_gmt_time=$field[4];
                $arrival_local_time=$field[5];
                    $departure_gmt_time=$field[6];
                    $arrival_airport_id=$field[7];
                    $aircraft_type=$field[8];
                    $flight_number=$field[9];
                    $distance=$field[10];
                    $elapsed_time=$field[11];
                    $ata_carrier_id=$field[12];
                    $air_carrier_full_name=$field[13];
                    $operator_type=$field[14];
                    $carrier_type=$field[15];
                    $carrier_code=$field[16];
                    $departure_latitude=$field[17];
                    $departure_longitude=$field[18];
                    $arrival_latitude=$field[19];
                    $arrival_longitude=$field[20];
                    $ata_departure_airport_id=$field[21];
                    $ata_arrival_airport_id=$field[22];
                    $departure_country_code=$field[23];
                    $arrival_country_code=$field[24];
                    $departure_city=$field[25];
                    $arrival_city=$field[26];
                    $seats=$field[27];
                    $ata_aircraft_type=$field[28];
                    $equipment_type=$field[29];
                $departure_country=$field[30];
                    $arrival_country=$field[31];
                    $air_carrier_id=$field[32];
                    if ($departure_longitude=~ /[0-9]{5}[KROM\{]/) {
                            $departure_longitude = "+" . substr($departure_longitude,0,5);
                    }
                    elsif ($departure_longitude =~ /[0-9]{5}[ABCDEFGHIJLNPQ\}]/) {
                            $departure_longitude = "-" . substr($departure_longitude,0,5);
                    }
                    else {
                    }
                    if ($arrival_longitude =~ /[0-9]{5}[KROM\{]/) {
                            $arrival_longitude = "+" . substr($arrival_longitude,0,5);
                    }
                    elsif ($arrival_longitude=~ /[0-9]{5}[ABCDEFGHIJLNPQ\}]/) {
                            $arrival_longitude = "-" . substr($arrival_longitude,0,5);
                    }
                    else {

                    }

                  @day=(0,split//,$days);
                  for(grep $day[$_],1..31){
                  $days=substr"0$_",-2;
                  ++$UID;
                                        print OUTPUT "$month$UID|$month$day$year_$departure_local_time|$month$day$year_$departure_gmt_time|$month$day$year_$arrival_local_time|$month$day$year_$arrival_gmt_time|$departure_airport_id|$arrival_airport_id|$aircraft_type|$flight_number|$distance|$elapsed_time|$ata_carrier_id|$air_carrier_full_name|$operator_type|$carrier_type|$carrier_code|$departure_latitude|$departure_longitude|$arrival_latitude|$arrival_longitude|$ata_departure_airport_id|$ata_arrival_airport_id|$departure_country_code|$arrival_country_code|$departure_city|$arrival_city|$seats|$ata_aircraft_type|$equipment_type|$departure_country|$arrival_country|$air_carrier_id"

      }
}


Following is the output I am receiving:

01000001|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000002|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000003|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000004|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000005|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000006|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000007|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000008|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000009|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                          
01000010|010605|010700|010700|01||KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |

The output is not adjusting the departure and arrival longitudes nor
are the day and year printing before th departure arrival times.

PLEASE HELP
Any suggestions appreciated
0
 
ozoCommented:
$year_ is undefined.  You may have meant "${year}_" or "$year\_"

$departure_longitude does not appear to match /[0-9]{5}[KROM\{]/ or /[0-9]{5}[ABCDEFGHIJLNPQ\}]/
0
 
tomatocansAuthor Commented:
Ozo

The last problem is that the binary info for days is not
transferring to the day array and printing out.


Example of input:
01|1101111110111111011111101111110|1999|0605|0605|0700|0700|KIR |EIDW|F50 |00021|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
01|1111111111111111111111111111111|1999|1240|1240|1345|1345|EIDW|KIR |F50 |00022|     |0065|   |                           | | |EI|516360|02250}|511860|03426}|DUB||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
01|1111111111111111111111111111111|1999|1410|1410|1505|1505|KIR |EIDW|F50 |00023|     |0055|   |                           | | |EI|511860|03426}|516360|02250}|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN
05|1000000100000010000000000000000|1999|1730|1630|1905|1805|EGBB|EICK|BA46|00767|  288|  95|   |AER LINGUS                 | |A|EI|512820|00630}|510600|03054}|BHX||4930|4410|BIRMINGHAM: ENGLAND (UK)   |CORK: REPUBLIC OF IRELAND  | 75|146|J|UNITED KINGDOM             |REPUBLIC OF IRELAND        |EIN
05|0000000000000000000001000000100|1999|1730|1630|1845|1745|EGBB|EICK|BA46|00767|  288|  75|   |AER LINGUS                 | |A|EI|512820|00630}|510600|03054}|BHX||4930|4410|BIRMINGHAM: ENGLAND (UK)   |CORK: REPUBLIC OF IRELAND  | 75|146|J|UNITED KINGDOM             |REPUBLIC OF IRELAND        |EIN
05|0100000010000001000000000000000|1999|1845|1745|2010|1910|EICK|EGBB|F50 |00768|  288|  85|   |AER LINGUS                 | |C|EI|510600|03054}|512820|00630}|ORK||4410|4930|CORK: REPUBLIC OF IRELAND  |BIRMINGHAM: ENGLAND (UK)   | 50|F50|T|REPUBLIC OF IRELAND        |UNITED KINGDOM             |EIN

Code


#usr/local/bin/perl -w

open INPUT,"</home/tmclaugh/oag/bin/ein99_prep" or die "can't open ein99_prep $!";
open OUTPUT,">/home/tmclaugh/oag/bin/flight.dbload" or die "can't open flight.dbload $!";

$UID='000000';
while($line=<INPUT> ){
            
                @fields=(split(/\|/,$line));
                $month=$fields[0];
                $days=$fields[1];
                $year=$fields[2];
                $departure_local_time=$fields[3];
                $departure_gmt_time=$fields[4];
                $arrival_local_time=$fields[5];
                    $departure_gmt_time=$fields[6];
                    $arrival_airport_id=$fields[7];
                    $departure_airport_id=$fields[8];
                    $aircraft_type=$fields[9];
                    $flight_number=$fields[10];
                    $distance=$fields[11];
                    $elapsed_time=$fields[12];
                    $ata_carrier_id=$fields[13];
                    $air_carrier_full_name=$fields[14];
                    $operator_type=$fields[15];
                    $carrier_type=$fields[16];
                    $carrier_code=$fields[17];
                    $departure_latitude=$fields[18];
                    $departure_longitude=$fields[19];
                    $arrival_latitude=$fields[20];
                    $arrival_longitude=$fields[21];
                    $ata_departure_airport_id=$fields[22];
                    $ata_arrival_airport_id=$fields[23];
                    $departure_country_code=$fields[24];
                    $arrival_country_code=$fields[25];
                    $departure_city=$fields[26];
                    $arrival_city=$fields[27];
                    $seats=$fields[28];
                    $ata_aircraft_type=$fields[29];
                    $equipment_type=$fields[30];
                $departure_country=$fields[31];
                    $arrival_country=$fields[32];
                    $air_carrier_id=$fields[33];
                    if ($departure_longitude=~ /[0-9]{5}[KROM\{]/) {
                            $departure_longitude = "+" . substr($departure_longitude,0,5);
                    }
                    elsif ($departure_longitude =~ /[0-9]{5}[ABCDEFGHIJLNPQ\}]/) {
                            $departure_longitude = "-" . substr($departure_longitude,0,5);
                    }
                    else {
                    }
                    if ($arrival_longitude =~ /[0-9]{5}[KROM\{]/) {
                            $arrival_longitude = "+" . substr($arrival_longitude,0,5);
                    }
                    elsif ($arrival_longitude=~ /[0-9]{5}[ABCDEFGHIJLNPQ\}]/) {
                            $arrival_longitude = "-" . substr($arrival_longitude,0,5);
                    }
                    else {

                    }

                  @day=(0,split//,$days);
                  for(grep $day[$_],1..31){
                  $days=substr"0$_",-2;
                  ++$UID;

                  
                         print OUTPUT "$month$UID|${month}${day}${year}_$departure_local_time|${month}${day}${year}_$departure_gmt_time|${month}${day}${year}_$arrival_local_time|${month}${day}${year}_$arrival_gmt_time|$departure_airport_id|$arrival_airport_id|$aircraft_type|$flight_number|$distance|$elapsed_time|$ata_carrier_id|$air_carrier_full_name|$operator_type|$carrier_type|$carrier_code|$departure_latitude|$departure_longitude|$arrival_latitude|$arrival_longitude|$ata_departure_airport_id|$ata_arrival_airport_id|$departure_country_code|$arrival_country_code|$departure_city|$arrival_city|$seats|$ata_aircraft_type|$equipment_type|$departure_country|$arrival_country|$air_carrier_id\n";

      }
}





Following is the output I am receiving:

01000001|011999_0605|011999_0605|011999_0700|011999_0700|EIDW|KIR |F50 |00021|     |0055|   |                           | | |EI|511860|-03426|516360|-02250|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN

01000002|011999_0605|011999_0605|011999_0700|011999_0700|EIDW|KIR |F50 |00021|     |0055|   |                           | | |EI|511860|-03426|516360|-02250|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN

01000003|011999_0605|011999_0605|011999_0700|011999_0700|EIDW|KIR |F50 |00021|     |0055|   |                           | | |EI|511860|-03426|516360|-02250|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN

01000004|011999_0605|011999_0605|011999_0700|011999_0700|EIDW|KIR |F50 |00021|     |0055|   |                           | | |EI|511860|-03426|516360|-02250|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN

01000005|011999_0605|011999_0605|011999_0700|011999_0700|EIDW|KIR |F50 |00021|     |0055|   |                           | | |EI|511860|-03426|516360|-02250|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN

01000006|011999_0605|011999_0605|011999_0700|011999_0700|EIDW|KIR |F50 |00021|     |0055|   |                           | | |EI|511860|-03426|516360|-02250|KIR||4410|4410|                           |    AER LINGUS             |   |F50|T|                           |                           |EIN


Ozo

The last problem is that the binary info for days is not
transferring to the day array and printing out.

PLEASE HELP
Any suggestions appreciated
0
 
tomatocansAuthor Commented:
Excellent. Ozo could u please please please
answer the question regarding the @day
array.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now