Solved

Position in String

Posted on 2000-05-11
10
213 Views
Last Modified: 2010-03-05
Follwing is an example of one line of input:

"MED_LARGE_TRANSPORT","MONITOR,DIRECT_INVOLVEMENT,REPORTER; FLYING,DIRECT_INVOLVEMENT; CTLR,DIRECT_INVOLVEMENT; FLYING","COMMERCIAL_GA; AIR_CARRIER","SAN; ZID","UNAUTH_AIRPSC_ENTRY; AIRSPC_OCCUPIED","S1; S1","TCA.B,ATA.D; PCA.A","","","1500; 35000","1500; 31000","NON ADHERENCE LEGAL RQMT/FAR; ERRONEOUS PENETRATION OR EXIT AIRSPACE; NO SPECIFIC ANOMALY OCCURRED","","FLC/ATC REVIEW; NONE","2","FRI","ATC/CTLR; ATC/CTLR; ATC/EQUIPMENT","TURBOJET; TURBOJET","","","","","","NF; NF","OPERATOR_DEV","SAN; SAN; MYF; ZID","POSITIVE_CTL,ACFT_IN_COM; POSITIVE_CTL,ACFT_IN_COM; POSITIVE_CTL,ACFT_IN_COM; POSITIVE_CTL,DEVIATION,ACFT_IN_COM","F1; F2; F3; F1","CA; CA; CA; IN","TRACON; TOWER; TOWER; ARTCC","VMC","CLIMB,DESCENT,MAINTAINING; CRUISE","IFR; IFR","DEPARTURE,DIRECT_ROUTING; DIRECT_ROUTING","FLIGHT_CREW; FLIGHT_CREW; ARTCC_CTLR; FLIGHT_CREW","PILOT_IN_COMMAND,CAPTAIN; SINGLE_PILOT,FIRST_OFFICER; RADAR_CTLR; PILOT_IN_COMMAND,CAPTAIN","NOT_ADVANCED","79866","NIGHT","RETRACTABLE; RETRACTABLE","SAN; CVG","CA; OH","","PASSENGER","","","","MUL","WE WERE IN OUR CLB FROM CMH TO DFW, WITH A CLRNC TO FL310. PASSING FL280, IND CENTER ASKED FOR A WIND RPT, WHICH WE GAVE. IND CENTER THEN ISSUED CLB CLRNC TO FL350. PASSING FL320, IND CENTER ASKED OUR ALT, THEN GAVE THE CLRNC, 'DES TO FL310.' WE ACKNOWLEDGED AND I ASKED IF THERE WAS A TFC PROB. THE REPLY WAS, 'NOT YET, BUT I NEED YOU LEVEL IN 1 MIN.' TFC PASSED ABOUT 1 MIN LATER OPP DIR AT FL330. IND CENTER THEN ASKED WHAT ALT WE HAD BEEN CLRD TO, TO WHICH WE RESPONDED FL350. I HAD READ BACK THE CLRNC AND THE F/O SET THE ALT ALERT. WE ARE SURE THE CLRNC WAS GIVEN IN ERROR TO FL350. ALSO, THE OTHER ACFT WAS COMING FROM ANOTHER CTLRS AIRSPACE. NO TFC CONFLICT OCCURRED.","A1; A2","2","AIR_CARRIER","","P1; P2; P3; P4","ATP; ATP; RADAR_CTLR; INSTRUMENT_RATING,COMMERCIAL","1801-2400_LOCAL","","4; 35","60","OCC","ACFT DEPARTED PENETRATED AIRSPACE; NOT RESOLVED/ANOMALY ACCEPTED; CTLR INTERVENED; CTLR ISSUED NEW CLNC; ACFT EXITED ADVERSE ENVIRONMENT","FLIGHT_CREW; FLIGHT_CREW","","","","LAND_PLANE; LAND_PLANE","ENTERED THE TCA WITHOUT CLRNC. OPERATION BANNER TOWING.; AFTER LEAVING FL320 MLG INSTRUCTED TO DES TO FL310 AFTER BEING INITIALLY CLEARED TO FL350. PIC CAPT OBSERVED OPPOSITE DIRECTION TRAFFIC PASS 1 MINUTE LATER AT FL330.","160; 400; 1500","200; 150; 180","500; 6000; 10000","","","ACFT_TYPE=MED_LARGE_TRANSPORT WINGS=LOW_WING LNDG_GEAR=RETRACTABLE SURFACE=LAND_PLANE ENGINE_TYPE=TURBOJET NUM_ENGINES=2 CREW_SIZE=2 OPERATOR=AIR_CARRIER MISSION=PASSENGER GLASS_CKPT=NOT_ADVANCED FLT_PHASE=CLIMB FLT_PHASE=DESCENT FLT_PHASE=MAINTAINING FLT_PLAN=IFR FLT_ROUTE=DEPARTURE FLT_ROUTE=DIRECT_ROUTING NUMBER=A1; WINGS=LOW_WING LNDG_GEAR=RETRACTABLE SURFACE=LAND_PLANE ENGINE_TYPE=TURBOJET FLT_PHASE=CRUISE FLT_PLAN=IFR FLT_ROUTE=DIRECT_ROUTING NUMBER=A2","AIRSPC_INV=UNAUTH_AIRPSC_ENTRY AIRSPC_TYPE=TCA.B AIRSPC_TYPE=ATA.D AIRSPC_ID=SAN AIRSPC_NUM=S1 AIRSPC_INV=AIRSPC_OCCUPIED AIRSPC_TYPE=PCA.A AIRSPC_ID=ZID AIRSPC_NUM=S1","FAC_INVOLVE=POSITIVE_CTL FAC_INVOLVE=ACFT_IN_COM FAC_TYPE=TRACON FAC_STATE=CA FAC_ID=SAN FAC_NUMBER=F1 FAC_INVOLVE=POSITIVE_CTL FAC_INVOLVE=DEVIATION FAC_INVOLVE=ACFT_IN_COM FAC_TYPE=ARTCC FAC_STATE=IN FAC_ID=ZID FAC_NUMBER=F1; FAC_INVOLVE=POSITIVE_CTL FAC_INVOLVE=ACFT_IN_COM FAC_TYPE=TOWER FAC_STATE=CA FAC_ID=SAN FAC_NUMBER=F2; FAC_INVOLVE=POSITIVE_CTL FAC_INVOLVE=ACFT_IN_COM FAC_TYPE=TOWER FAC_STATE=CA FAC_ID=MYF FAC_NUMBER=F3","ROLE=FLIGHT_CREW AFFILIATION=COMMERCIAL_GA TOTAL_TIME=00500 TIME_LST_90=00200 TIME_IN_TYP=00160 ACTIVITY=MONITOR ACTIVITY=DIRECT_INVOLVEMENT ACTIVITY=REPORTER QUALIFICNTN=ATP FUNC_BROAD=FLIGHT_CREW FUNC_NARROW=PILOT_IN_COMMAND FUNC_NARROW=CAPTAIN PER_NUMBER=P1 ROLE=FLIGHT_CREW AFFILIATION=AIR_CARRIER TOTAL_TIME=06000 TIME_LST_90=00150 TIME_IN_TYP=00400; ACTIVITY=FLYING ACTIVITY=DIRECT_INVOLVEMENT QUALIFICNTN=ATP FUNC_BROAD=FLIGHT_CREW FUNC_NARROW=SINGLE_PILOT FUNC_NARROW=FIRST_OFFICER PER_NUMBER=P2 TOTAL_TIME=10000 TIME_LST_90=00180 TIME_IN_TYP=01500; ACTIVITY=CTLR ACTIVITY=DI

Following is the code:

#! /usr/local/bin/perl -w

###prompt for input####
##print "Input path and file name:\n";
##($input=<STDIN>);

###If cannot open provide error output####
open(IN,"</home/tmclaugh/oag/test/asrs.txt") || die "Cannot open file $IN:$!";

##print "Output path and file name:\n";
##($output=<STDIN>);

####open file for output####
open(OUT,">/home/tmclaugh/oag/test/asrs.out") || die "Cannot open file $OUT>:!";

$UID='00000';

while(<IN>){
      ++$UID;
      @fields=split(/","/);
      $accession_number=$fields[37];
      #LIST OF ANOMALIES
      @anomalies=(split/;/,$fields[11]);
      $ONE="NO"; # ACFT EQUIPMENT PROBLEM/CRITICAL
      $TWO="NO"; #ACFT EQUIPMENT PROBLEM/LESS SEVERE
      $THREE="NO"; #ALT DEV/EXCURSION FROM ASSIGNED
      $FOUR="NO"; #ALT DEV/OVERSHOOT ON CLB OR DES
      $FIVE="NO"; #ALT DEV/UNDERSHOOT ON CLB OR DES
      $SIX="NO"; #ALT DEV/XING RESTRICTION NOT MET
      $SEVEN="NO"; #ALT-HDG RULE DEVIATION
      $EIGHT="NO"; #CONFLICT/AIRBOURNE LESS SEVERE
      $NINE="NO";  #CONFLICT/GROUND CRITICAL
      $TEN="NO";  #CONFLICT/GROUND LESS SEVERE
      $ELEVEN="NO"; #CONFLICT/NMAC
      $TWELVE="NO"; #CONTROLLED FLT TOWARD TERRAIN
      $THIRTEEN="NO"; #ERRONEOUS PENETRATION OR EXIT AIRSPACE
      $FOURTEEN="NO"; #IN-FLT ENCOUNTER/OTHER
      $FIFTEEN="NO"; #IN-FLT ENCOUNTER/WX
      $SIXTEEN="NO"; #LESS THAN LEGAL SEPARATION
      $SEVENTEEN="NO"; #LOSS OF ACFT CONTROL
      $EIGHTEEN="NO"; #NO SPECIFIC ANOMALY OCCURRED
      $NINETEEN="NO"; #NON ADHERENCE LEGAL RQMT/CLNC
      $TWENTY="NO";  #NON ADHERENCE LEGAL RQMT/FAR
      $TWENTYONE="NO"; #NON ADHERENCE LEGAL RQMT/OTHER
      $TWENTYTWO="NO"; #NON ADHERENCE LEGAL RQMT/PUBLISHED PROC
      $TWENTYTHREE="NO"; #RWY ORTXYWY EXCURSION
      $TWENTYFOUR="NO";  #RWY TRANSGRESS/OTHER
      $TWENTYFIVE="NO"; #RWY TRANGRESS/UNAUTH LNDG
      $TWENTYSIX="NO"; #SPEED DEVIAYION
      $TWENTYSEVEN="NO"; #TRACK OR HDG DEVIATION
      $TWENTYEIGHT="NO"; #UNCTRLED ARPTTRAFFIC PATTERN DEVIATION
      $TWENTYNINE="NO"; #VFR IN IMC
      $THIRTY="NO"; #OTHER
      $position{'ONE'}=0;
      $postion{'TWO'}=0;
      $postion{'THREE'}=0;
      $position{'FOUR'}=0;
      $position{'FIVE'}=0;
      $position{'SIX'}=0;
      $position{'EIGHT'}=0;
      $postion{'NINE'}=0;
      $position{'TEN'}=0;
      $position{'ELEVEN'}=0;
      $position{'TWELVE'}=0;
      $position{'THIRTEEN'}=0;
      $position{'FOURTEEN'}=0;
      $position{'FIFTEEN'}=0;
      $position{'SIXTEEN'}=0;
      $position{'SEVENTEEN'}=0;
      $position{'EIGHTEEN'}=0;
      $position{'NINETEEN'}=0;
      $position{'TWENTY'}=0;
      $position{'TWENTYONE'}=0;
      $position{'TWENTYTWO'}=0;
      $position{'TWENTYTHREE'}=0;
      $position{'TWENTYFOUR'}=0;
      $position{'TWENTYFIVE'}=0;
      $position{'TWENTYSIX'}=0;
      $position{'TWENTYSEVEN'}=0;
      $position{'TWENTYEIGHT'}=0;
      $position{'TWENTYNINE'}=0;
      $position{'THIRTY'}=0;
      foreach($[..$#anomalies){
            if($anomalies[$_] eq "ACFT EQUIPMENT PROBLEM/CRITICAL"){
                  $ONE="YES";
                  $postion{'ONE'}=($_+1);
            }
            elsif($anomalies[$_] eq "ACFT EQUIPMENT PROBLEM/LESS SEVERE"){
                  $TWO="YES";
                  $position{'TWO'}=($_+1);
            }
            elsif($anomalies[$_] eq "ALT DEV/EXCURSION FROM ASSIGNED"){
                  $THREE="YES";
                  $position{'THREE'}=($_+1);
            }
            elsif($anomalies[$_] eq "ALT DEV/OVERSHOOT ON CLB OR DES"){
                  $FOUR="YES";
                  $position{'FOUR'}=($_+1);
            }
            elsif($anomalies[$_] eq "ALT DEV/UNDERSHOOT ON CLB OR DES"){
                  $FIVE="YES";
                  $position{'FIVE'}=($_+1);
            }
            elsif($anomalies[$_] eq "ALT DEV/XING RESTRICTION NOT MET"){
                  $SIX="YES";
                  $position{'SIX'}=($_+1);
            }
            elsif($anomalies[$_] eq "ALT-HDG RULE DEVIATION"){
                  $SEVEN="YES";
                  $position{'SEVEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "CONFLICT/AIRBORNE LESS SEVERE"){
                  $EIGHT="YES";
                  $position{'EIGHT'}=($_+1);
            }
            elsif($anomalies[$_] eq "CONFLICT/GROUND CRITICAL"){
                  $NINE="YES";
                  $position{'NINE'}=($_+1);
            }
            elsif($anomalies[$_] eq "CONFLICT\/GROUND LESS SEVERE"){
                  $TEN="YES";
                  $position{'TEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "CONFLICT\/NMAC"){
                  $ELEVEN="YES";
                  $position{'ELEVEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "CONTROLLED FLT TOWARD TERRAIN"){
                  $TWELVE="YES";
                  $position{'TWELVE'}=($_+1);
            }
            elsif($anomalies[$_] eq "ERRONEOUS PENETRATION OR EXIT AIRSPACE"){
                  $THIRTEEN="YES";
                  $position{'THIRTEEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "IN-FLT ENCOUNTER/OTHER"){
                    $FOURTEEN="YES";
                  $position{'FOURTEEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "IN-FLT ENCOUNTER/WX"){
                  $FIFTEEN="YES";
                  $position{'FIFTEEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "LESS THAN LEGAL SEPARATION"){
                  $SIXTEEN="YES";
                  $position{'SIXTEEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "LOSS OF ACFT CONTROL"){
                  $SEVENTEEN="YES";
                  $position{'SEVENTEEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "NO SPECIFIC ANOMALY OCCURRED"){
                  $EIGHTEEN="YES";
                  $position{'EIGHTEEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "NON ADHERENCE LEGAL RQMT/CLNC"){
                  $NINETEEN="YES";
                  $position{'NINETEEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "NON ADHERENCE LEGAL RQMT/FAR"){
                  $TWENTY="YES";
                  $position{'TWENTY'}=($_+1);
            }
            elsif($anomalies[$_] eq "NON ADHERENCE LEGAL RQMT/OTHER"){
                  $TWENTYONE="YES";
                  $position{'TWENTYONE'}=($_+1);
            }
            elsif($anomalies[$_] eq "NON ADHERENCE LEGAL RQMT/PUBLISHED PROC"){
                  $TWENTYTWO="YES";
                  $position{'TWENTYTWO'}=($_+1);
            }
            elsif($anomalies[$_] eq "RWY OR TXWY EXCURSION"){
                  $TWENTYTHREE="YES";
                  $position{'TWENTYTHREE'}=($_+1);
            }
            elsif($anomalies[$_] eq "RWY TRANSGRESS/OTHER"){
                  $TWENTYFOUR="YES";
                  $position{'TWENTYFOUR'}=($_+1);
            }      
            elsif($anomalies[$_] eq "RWY TRANGRESS/UNAUTH LNDG"){
                  $TWENTYFIVE="YES";
                  $position{'TWENTYFIVE'}=($_+1);
            }
            elsif($anomalies[$_] eq "SPEED DEVIAYION"){
                  $TWENTYSIX="YES";
                  $position{'TWENTYSIX'}=($_+1);
            }
            elsif($anomalies[$_] eq "TRACK OR HDG DEVIATION"){
                  $TWENTYSEVEN="YES";
                  $position{'TWENTYSEVEN'}=($_+1);
            }
            elsif($anomalies[$_] eq "UNCTRLED ARPTTRAFFIC PATTERN DEVIATION"){
                  $TWENTYEIGHT="YES";
                  $position{'TWENTYEIGHT'}=($_+1);
            }
            elsif($anomalies[$_] eq "VFR IN IMC"){
                  $TWENTYNINE="YES";
                  $position{'TWENTYNINE'}=($_+1);
            }
            elsif($anomalies[$_] eq "OTHER"){
                  $THIRTY="YES";
                  $position{'THIRTY'}=($_+1);
            }
         }
      $year=substr($fields[77],0,2);
      $month=substr($fields[77],2,2);
      $day=$fields[15];
      $flight_phase=$fields[31];
      @flight_phase_first_field=split(/;/,$flight_phase);
      @flight_phase_sub=split(/,/,$flight_phase_first_field[0]);      
      $cockpit=$fields[36];
      if($cockpit=~/EFIS\_OR\_HUD/){

                  $efis="YES";
      }
      else{
                  $efis="NO";
      }
      
      if($cockpit=~/INTEGRATED_NAV/){

                  $integrated="YES";
      }
      else{
                  $integrated="NO";
      }
      if($cockpit=~/NOT_ADVANCED/){

                  $not_advanced="YES";
      }
      else{
                  $not_advanced="NO";
      }
      $mission=$fields[43];
      @mission_first_field=split(/;/,$mission);
      $operator_organizer=$fields[51];
      @operator=split(/;/,$operator_organizer);
      $synopsis=$fields[66];
      $narrative=$fields[48];
            
            
      print OUT       

"$UID|$accession_number|$month|$year|$day|$efis|$integrated|$not_advanced|$position{'ONE'}|$position{'TWO'}|$position{'THREE'}|$position{'FOUR'}|$position{'FIVE'}|$position{'SIX'}|$position{'SEVEN'}|$position{'EIGHT'}|$position{'NINE'}|$position{'TEN'}|$position{'ELEVEN'}|$position{'TWELVE'}|$position{'THIRTEEN'}|$position{'FOURTEEN'}|$position{'FIFTEEN'}|$position{'SIXTEEN'}|$position{'SEVENTEEN'}|$position{'EIGHTEEN'}|$position{'NINETEEN'}|$position{'TWENTY'}|$position{'TWENTYONE'}|$position{'TWENTYTWO'}|$position{'TWENTYTHREE'}|$position{'TWENTYFOUR'}|$position{'TWENTYFIVE'}|$position{'TWENTYSIX'}|$position{'TWENTYSEVEN'}|$position{'TWENTYEIGHT'}|$position{'TWENTYNINE'}|$position{'THIRTY'}|$fields[30]|$flight_phase_sub[0]|$fields[38]|$fields[42]|$mission_first_field[0]|$operator[0]|$synopsis|$narrative\n";
}

close(IN);
close(OUT);

Following is one line of output:

00001|79866|01|88|FRI|NO|NO|YES|0|||0|0|0||0||0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0|0|VMC|CLIMB|NIGHT||PASSENGER|AIR_CARRIER|ENTERED THE TCA WITHOUT CLRNC. OPERATION BANNER TOWING.; AFTER LEAVING FL320 MLG INSTRUCTED TO DES TO FL310 AFTER BEING INITIALLY CLEARED TO FL350. PIC CAPT OBSERVED OPPOSITE DIRECTION TRAFFIC PASS 1 MINUTE LATER AT FL330.|WE WERE IN OUR CLB FROM CMH TO DFW, WITH A CLRNC TO FL310. PASSING FL280, IND CENTER ASKED FOR A WIND RPT, WHICH WE GAVE. IND CENTER THEN ISSUED CLB CLRNC TO FL350. PASSING FL320, IND CENTER ASKED OUR ALT, THEN GAVE THE CLRNC, 'DES TO FL310.' WE ACKNOWLEDGED AND I ASKED IF THERE WAS A TFC PROB. THE REPLY WAS, 'NOT YET, BUT I NEED YOU LEVEL IN 1 MIN.' TFC PASSED ABOUT 1 MIN LATER OPP DIR AT FL330. IND CENTER THEN ASKED WHAT ALT WE HAD BEEN CLRD TO, TO WHICH WE RESPONDED FL350. I HAD READ BACK THE CLRNC AND THE F/O SET THE ALT ALERT. WE ARE SURE THE CLRNC WAS GIVEN IN ERROR TO FL350. ALSO, THE OTHER ACFT WAS COMING FROM ANOTHER CTLRS AIRSPACE. NO TFC CONFLICT OCCURRED.;


The last isssu is getting the $position('####') output
to properly:

assign a position number to an anomaly defined

The proper output for this line should be:

00001|79866|01|88|FRI|NO|NO|YES|0|0|0|0|0|0|0|0|0|0|0|0|2|0|0|0|0|3|0|1|0|0|0|0|0|0|0|0|0|0|VMC|CLIMB|NIGHT||PASSENGER|AIR_CARRIER|ENTERED THE TCA WITHOUT CLRNC. OPERATION BANNER TOWING.; AFTER LEAVING FL320 MLG INSTRUCTED TO DES TO FL310 AFTER BEING INITIALLY CLEARED TO FL350. PIC CAPT OBSERVED OPPOSITE DIRECTION TRAFFIC PASS 1 MINUTE LATER AT FL330.|WE WERE IN OUR CLB FROM CMH TO DFW, WITH A CLRNC TO FL310. PASSING FL280, IND CENTER ASKED FOR A WIND RPT, WHICH WE GAVE. IND CENTER THEN ISSUED CLB CLRNC TO FL350. PASSING FL320, IND CENTER ASKED OUR ALT, THEN GAVE THE CLRNC, 'DES TO FL310.' WE ACKNOWLEDGED AND I ASKED IF THERE WAS A TFC PROB. THE REPLY WAS, 'NOT YET, BUT I NEED YOU LEVEL IN 1 MIN.' TFC PASSED ABOUT 1 MIN LATER OPP DIR AT FL330. IND CENTER THEN ASKED WHAT ALT WE HAD BEEN CLRD TO, TO WHICH WE RESPONDED FL350. I HAD READ BACK THE CLRNC AND THE F/O SET THE ALT ALERT. WE ARE SURE THE CLRNC WAS GIVEN IN ERROR TO FL350. ALSO, THE OTHER ACFT WAS COMING FROM ANOTHER CTLRS AIRSPACE. NO TFC CONFLICT OCCURRED.;


Any help appreciated.



0
Comment
Question by:tomatocans
  • 5
  • 5
10 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 100 total points
ID: 2802015
there is a type...

$postion{'TWO'}=0;

should be

$position{'TWO'}=0;

you are missing the i in position!!
0
 

Author Comment

by:tomatocans
ID: 2802084
But now the output is like so:

00001|79866|01|88|FRI|NO|NO|YES|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0|0|VMC|CLIMB|NIGHT||PASSENGER|AIR_CARRIER|ENTERED THE TCA WITHOUT CLRNC. OPERATION BANNER TOWING.; AFTER LEAVING FL320 MLG INSTRUCTED TO DES TO FL310 AFTER BEING INITIALLY CLEARED TO FL350. PIC CAPT OBSERVED OPPOSITE DIRECTION TRAFFIC PASS 1 MINUTE LATER AT FL330.|WE WERE IN OUR CLB FROM CMH TO DFW, WITH A CLRNC TO FL310. PASSING FL280, IND CENTER ASKED FOR A WIND RPT, WHICH WE GAVE. IND CENTER THEN ISSUED CLB CLRNC TO FL350. PASSING FL320, IND CENTER ASKED OUR ALT, THEN GAVE THE CLRNC, 'DES TO FL310.' WE ACKNOWLEDGED AND I ASKED IF THERE WAS A TFC PROB. THE REPLY WAS, 'NOT YET, BUT I NEED YOU LEVEL IN 1 MIN.' TFC PASSED ABOUT 1 MIN LATER OPP DIR AT FL330. IND CENTER THEN ASKED WHAT ALT WE HAD BEEN CLRD TO, TO WHICH WE RESPONDED FL350. I HAD READ BACK THE CLRNC AND THE F/O SET THE ALT ALERT. WE ARE SURE THE CLRNC WAS GIVEN IN ERROR TO FL350. ALSO, THE OTHER ACFT WAS COMING FROM ANOTHER CTLRS AIRSPACE. NO TFC CONFLICT OCCURRED.;

not providing the number of the anomoly position in string
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2802154
now wait a minute!!!

isnt the output that you now get the SAME as the one you were expecting earlier???

i am not sure what you mean when you say "...not providing the number of the anomoly position in string ......."

pl. explain
0
 

Author Comment

by:tomatocans
ID: 2802208
In the example we have now fields[11] is

NON ADHERENCE LEGAL RQMT/FAR; ERRONEOUS PENETRATION OR EXIT AIRSPACE; NO SPECIFIC ANOMALY OCCURRED

NON ADHERENCE LEGAL RQMT/FAR is in postion 1 after the split on ;

ERRONEOUS PENETRATION OR EXIT AIRSPACE is in postion 2

NO SPECIFIC ANOMALY OCCURRED is in postion 3.



Thus,  the output is

00001|79866|01|88|FRI|NO|NO|YES|0|0|0|0|0|0|0|0|0|0|0|0|2|0|0|0|0|3|0|1|0|0|0|0|0|0|0|0|0|0|VMC|CLIMB|NIGHT||PASSENGER|AIR_CARRIER|ENTERED THE TCA WITHOUT CLRNC. OPERATION BANNER TOWING.; AFTER LEAVING FL320 MLG INSTRUCTED TO DES TO FL310 AFTER BEING INITIALLY CLEARED TO FL350. PIC CAPT OBSERVED OPPOSITE DIRECTION TRAFFIC PASS 1 MINUTE LATER AT FL330.|WE WERE IN OUR CLB FROM CMH TO DFW, WITH A CLRNC TO FL310. PASSING FL280, IND CENTER ASKED FOR A WIND RPT, WHICH WE GAVE. IND CENTER THEN ISSUED CLB CLRNC TO FL350. PASSING FL320, IND CENTER ASKED OUR ALT, THEN GAVE THE CLRNC, 'DES TO FL310.' WE ACKNOWLEDGED AND I ASKED IF THERE WAS A TFC PROB. THE REPLY WAS, 'NOT YET, BUT I NEED YOU LEVEL IN 1 MIN.' TFC PASSED ABOUT 1 MIN LATER OPP DIR AT FL330. IND CENTER THEN
                    ASKED WHAT ALT WE HAD BEEN CLRD TO, TO WHICH WE RESPONDED FL350. I HAD READ BACK THE CLRNC AND THE F/O SET THE ALT ALERT. WE ARE SURE THE CLRNC WAS GIVEN IN ERROR TO FL350. ALSO, THE OTHER ACFT WAS COMING FROM ANOTHER CTLRS AIRSPACE. NO TFC CONFLICT OCCURRED.;


NOT

00001|79866|01|88|FRI|NO|NO|YES|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0|0|VMC|CLIMB|NIGHT||PASSENGER|AIR_CARRIER|ENTERED THE TCA WITHOUT CLRNC. OPERATION BANNER TOWING.; AFTER LEAVING FL320 MLG INSTRUCTED TO DES TO FL310 AFTER BEING INITIALLY CLEARED TO FL350. PIC CAPT OBSERVED OPPOSITE DIRECTION TRAFFIC PASS 1 MINUTE LATER AT FL330.|WE WERE IN OUR CLB FROM CMH TO DFW, WITH A CLRNC TO FL310. PASSING FL280, IND CENTER ASKED FOR A WIND RPT, WHICH WE GAVE. IND CENTER THEN ISSUED CLB CLRNC TO FL350. PASSING FL320, IND CENTER ASKED OUR ALT, THEN GAVE THE CLRNC, 'DES TO FL310.' WE ACKNOWLEDGED AND I ASKED IF THERE WAS A TFC PROB. THE REPLY WAS, 'NOT YET, BUT I NEED YOU LEVEL IN 1 MIN.' TFC PASSED ABOUT 1 MIN LATER OPP DIR AT FL330. IND CENTER THEN
                    ASKED WHAT ALT WE HAD BEEN CLRD TO, TO WHICH WE RESPONDED FL350. I HAD READ BACK THE CLRNC AND THE F/O SET THE ALT ALERT. WE ARE SURE THE CLRNC WAS GIVEN IN ERROR TO FL350. ALSO, THE OTHER ACFT WAS COMING FROM ANOTHER CTLRS AIRSPACE. NO TFC CONFLICT OCCURRED.;

                   

0
 

Author Comment

by:tomatocans
ID: 2802289
Any ideas?
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.

 
LVL 16

Expert Comment

by:maneshr
ID: 2802302
the problem is due to leading/trailing space in the actual data.

so when you split on ;

the value is, for eg.

 ERRONEOUS PENETRATION OR EXIT AIRSPACE

But you are comparing that against..
ERRONEOUS PENETRATION OR EXIT AIRSPACE


NOTE: the first string has a leading space!!

Add the following line of code

$anomalies[$_]=~ s/^\s+//g; ## remove leading ....
$anomalies[$_]=~ s/\s+$//g;  ## ... & trailing spaces!!

AFTER....
foreach($[..$#anomalies){
0
 

Author Comment

by:tomatocans
ID: 2802378
Still will not recognize:

NO SPECIFIC ANOMALY OCCURRED

Position 3


can u see anything else that needs to
be subsituted or changed to
better recoginize individual
anomalies
0
 

Author Comment

by:tomatocans
ID: 2802541
Thanks
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2804427
"...........can u see anything else that needs to
                    be subsituted or changed to
                    better recoginize individual
                    anomalies"

i am looking at it right now. Meanwhile, were the other anomalies ok??

let me know

Rgds
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2804446
ok here is the reason why the string  NO SPECIFIC ANOMALY OCCURRED doesnt find a match.

when you split on ; one of the strings that you get is...

NO SPECIFIC ANOMALY OCCURRED","","FLC/ATC REVIEW

now as you can see, in the script we are trying to do an EXACT match of this string against ...
NO SPECIFIC ANOMALY OCCURRED

(elsif($anomalies[$_] eq "NO SPECIFIC ANOMALY OCCURRED"){)

But this will never happen!! Therefore a match is not found!!

to fix this add the following piece of code

$anomalies[$_]=~ s/".*//g; ## remove anything after "

AFTER  .........

foreach($[..$#anomalies){
  $anomalies[$_]=~ s/^\s+//g; ## remove leading ....
  $anomalies[$_]=~ s/\s+$//g;  ## ... & trailing spaces!!


That will fix the problem!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

10 Experts available now in Live!

Get 1:1 Help Now