Hi All,

When I run my awk script, I get this error.  Could be a newbie mistake, but I can't see it.

gawk: \dev\awk\ing2ms.awk:7: fatal error: internal error

I have tried commenting out parts of it, but I haven't found what's causing the error.  Any thoughts?  Other awk scripts I have written, work OK, but they are even simpler than this one.

FWIW, here's the script.

#
# convert
#

function convert_hex_constant( str )
{
  while ( 0 < match(str, /[xX]'[a-fA-F0-9]*'/) )
  {
    str = substr( str, 1, RSTART-1 ) \
          "0x" \
          substr( str, RSTART+2, RLENGTH-3) \
          substr( str, RSTART + RLENGTH )
  }
  return str
}

function convert_nvarchar_function( str )
{
# change this expression to include newlines and paired apostrophes
  while ( 0 < match(str, /nvarchar\('[^']*'\)/) )
  {
    str = substr( str, 1, RSTART-1 ) \
          substr( str, RSTART+9, RLENGTH-10) \
          substr( str, RSTART + RLENGTH )
  }
  return str
}

#
# BOF
BEGIN {
}

#
# EOF
#
END {
  print ""
  print "go"
}

#
# main line
#
{
  if ( /set autocommit/ )
  {
    next
  }
 
  sub(/\\p\\g/ , "", $0 )
 
#  $0 = convert_hex_constant($0)

  $0 = convert_nvarchar_function($0)

  print $0
}

Thanks very much
Troy Rudolph
Computer Associates
Senior Software Engineer
tel: +1 512 401-2273
fax: +1 512 401-2205
troy.rudolph@ca.com