Solved

Compiling without output

Posted on 2000-05-06
7
166 Views
Last Modified: 2010-03-05
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
Comment
Question by:tomatocans
  • 5
7 Comments
 

Author Comment

by:tomatocans
ID: 2784783
There is a ; after the print OUT statement
0
 
LVL 8

Accepted Solution

by:
shlomoy earned 50 total points
ID: 2785151
#usr/local/bin/perl -w
should be
#!/usr/local/bin/perl -w

 print OUT
should be
print OUTPUT
0
 

Author Comment

by:tomatocans
ID: 2785529
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:tomatocans
ID: 2785538
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
 
LVL 84

Expert Comment

by:ozo
ID: 2785556
$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
 

Author Comment

by:tomatocans
ID: 2785608
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
 

Author Comment

by:tomatocans
ID: 2785843
Excellent. Ozo could u please please please
answer the question regarding the @day
array.

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now