bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

internal error


From: DON PETERSEN
Subject: internal error
Date: Fri, 9 Dec 2005 18:46:39 -0800 (PST)

  Hi,
  When I ran my gawk program after a few mods, I started getting an internal 
error. I've narrowed it to a switch statement that matches on a case that is a 
regular expression. I've tried different data and whenever a regexp is the 
matching case, GAWK reports an internal error.
    FixMASImportProg.awk:120: (FILENAME=BOM1.csv FNR=21) fatel error: internal 
error
  Abnormal program termination
   
  I attached the program and a data file. Note that the program is going to try 
to write to a couple of files on paths that don't exist on your system.
   
  Regards,
  Don
   


Attachment: BOM1.csv
Description: 3134674044-BOM1.csv

BEGIN {
  FS = "|"              # Set Field Separator to '|'
  BOMNumber = 1
  BOMRev = 2
  BOMAgileCurRev = 5
  BOMAgileDesc = 15
  BOMOptInteract = 13
  BOMAgileQpB = 14
  PartNumber = 20
  BOMAgileItem = 7
  MASOutStepNumber = 24
  MASOutRoutingNumber = 10
  BOMAgileType = 4
  BOMAgileACDflag = 16
  Index = 36
  }

substr($BOMNumber, 1, 3) == "###" { # Comment
  print $0 > "c:/Don P/AgileBOM.txt"
  next  
  }
# $BOMOptInteract == "\"N\"" {  # There are some goofy records in the MAS BOM 
export file. Skip them
#   next
#   }
#$Index != "" {         # BOM export from MAS - build an array of Routing and 
Step numbers
#  Rev = index($BOMRev, " ") ? substr($BOMRev, 2, index($BOMRev, " ") - 2) : 
substr($BOMRev, 2, 3)  # if there are spaces, get rid of them
#  Rev = Rev + 1 - 1            # get rid of the leading zeroes, if any
#  BOMIndex = substr($BOMNumber, 2, index($BOMNumber, " ") - 2) Rev
#  BOMPartIndex = BOMIndex substr($PartNumber, 2, index($PartNumber, " ") - 2) 
#  print BOMIndex "  " BOMPartIndex
#  RSa[BOMIndex] = $MASOutRoutingNumber
#  RSa[BOMPartIndex] = $MASOutStepNumber
#  print "index"
#  next
#  }

gsub( /\"/ , "in" )     # workaround for BOM import bug
gsub( /'/ , "ft" )      # workaround for BOM import bug

$BOMAgileType == "" && substr($BOMNumber, 1, 3) != "###" && length($0) > 0 {    
# last line that needs a comment indicator
  print "###" $0 > "c:/Don P/AgileBOM.txt"
#  print "here"
  next
  }
$BOMAgileType != "" {                   # BOM record
  if (CurrBOMNumber != $BOMNumber) {    # BOM number has changed
    CurrBOMNumber = $BOMNumber
    # Print the last line from the previous BOM
    if (LastLine[1] != "") {
      print ((substr(LastLine[1], 1, 3) == "###") ? "" : "-") LastLine[1] > 
"c:/Don P/AgileBOM.txt"
      }
## Look at pulling the actual base line out of the exported BOM file so that 
all of the fields have the original correct values.
    BaseRev = ($BOMRev >= "A") ? "A" : "1"
#    BckBOMRev = (RSa[$BOMNumber $BOMRev-1]) ? $BOMRev-1 : $BOMRev-2
# Determine Base Routing and Step -- What about Product Line 100 and 150?
#  print $BOMAgileItem "  " substr($BOMAgileItem, 1, 4)
  Step9700 = 195
  RouteAndStep(substr($BOMAgileItem, 1, 4))
# Determine New Routing and Step
    NewBOMLine = $BOMNumber "|" $BOMRev "| | | |\"" $BOMAgileDesc "\"| |" 
$BOMAgileType "| |" Routing "|N|" $BOMAgileCurRev "|N|N|N| ||100.0|.0|" 
$BOMAgileItem "|1|*| |" Step "| |" $BOMAgileQpB "|.0| | | | | | | |.0|"
    BaseBOMLine = $BOMNumber "|" BaseRev "| | | |\"" $BOMAgileDesc "\"| |" 
$BOMAgileType "| |" Routing "|N|" $BOMAgileCurRev "|N|N|N| ||100.0|.0|" 
$BOMAgileItem "|1|*| |" Step "| |" $BOMAgileQpB "|.0| | | | | | | |.0|"
    # Nearly duplicate the first line. Use the base rev of this BOM to set the 
Current Rev of the BOM
    print "### Set CurrentRev in rev 1 or A of this BOM" > "c:/Don 
P/AgileBOM.txt"
    print BaseBOMLine > "c:/Don P/AgileBOM.txt"
#    print BaseBOMLine > "c:/Don P/AgileBOM.txt"
    print "### The header info for the BOM" > "c:/Don P/AgileBOM.txt"
    print NewBOMLine > "c:/Don P/AgileBOM.txt"
    print "### Component lines in the BOM" > "c:/Don P/AgileBOM.txt"
#    print NewBOMLine > "c:/Don P/AgileBOM.txt"
    # duplicate the first line as a component, add Step Number
    LastLine[1] = (($BOMAgileACDflag == "D" ) ? "###" : "") NewBOMLine  # Store 
this line to see if it is "before" line from Agile; add a comment if it's a 'D' 
from Agile
#    print "there1  " $BOMAgileItem
    next
  }
}
$BOMAgileType != "" {                   # BOM record
  if (CurrBOMNumber == $BOMNumber) {    # BOM number has not changed - 
component of BOM, add Step Number
#    BckBOMRev = (RSa[$BOMNumber $BOMRev-1]) ? $BOMRev-1 : $BOMRev-2
    split(LastLine[1], LastLineArray, "|")
    split($0, CurLineArray, "|")
    if (LastLineArray[PartNumber] != CurLineArray[BOMAgileItem]) { # If the 
part #'s are the same, then this is a "before/after" pair
      print ((substr(LastLine[1], 1, 3) == "###") ? "" : "-") LastLine[1] > 
"c:/Don P/AgileBOM.txt"
    }
#    print $BOMNumber "  " $BOMRev-1
    RouteAndStep(substr($BOMAgileItem, 1, 4))
    print Step
#    if ((Step > 199 && Step < 300) && (LastLineArray[PartNumber] != 
CurLineArray[BOMAgileItem]) && ($BOMAgileACDflag != "D" )) {
      # In the '200' step range, not a before/after pair, and not a deleted 
record
#      Step = Step + 5
#    }
    NewBOMLine = $BOMNumber "|" $BOMRev "| | | |\"" $BOMAgileDesc "\"| |" 
$BOMAgileType "| |" Routing "|N|" $BOMAgileCurRev "|N| |N| ||100.0|.0|" 
$BOMAgileItem "|1|*| |" Step "| |" $BOMAgileQpB "|.0| | | | | | | |.0|"
    LastLine[1] = (($BOMAgileACDflag == "D" ) ? "###" : "") NewBOMLine  # Store 
this line to see if it is "before" line from Agile; add a comment if it's a 'D' 
from Agile
#    LastLine[1] = NewBOMLine  # Store this line to see if it is "before" line 
from Agile
#    print "there2  " $BOMAgileItem
    next
  }
}
{print $0 > "c:/Don P/AgileBOM.txt"}
#{print "everywhere"}
END {
   print ((substr(LastLine[1], 1, 3) == "###") ? "" : "-") LastLine[1] > 
"c:/Don P/AgileBOM.txt"
#  print "-" LastLine[1] > "c:/Don P/AgileBOM.txt"
}

function RouteAndStep(Part)
{
print "Funky here  " Part
  switch (Part) {
    case "9700":
      Step9700 += 5
      Step = Step9700
      Routing = "SUB-ASSY"
      RouteDesc = "Generic Sub-assembly"
      break
    case /4[[:digit:]]+/:
      Step = 100
      Routing = ""
      RouteDesc = ""
      break
    case /33[[:digit:]]+/:
      Step = 3300
      Routing = ""
      RouteDesc = ""
      break
    case /32[[:digit:]]+/:
      Step = 3200
      Routing = ""
      RouteDesc = ""
      break
    case /34[[:digit:]]+/:
      Step = 3400
      Routing = ""
      RouteDesc = ""
      break
    case /7400/:
      Step = 120
      Routing = ""
      RouteDesc = ""
      break
    case /7200/:
    case /7202/:
    case /7204/:
      Step = 110
      Routing = ""
      RouteDesc = ""
      break
    default:
      Routing = ""
      RouteDesc = ""
      Step = "001"
  }
  print Part "  " Step
return 1
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]