From: "Wayne Mr." Date: 2012-07-22T22:25:12+09:00 Subject: Re: File.open error when variable is used The code is running on: Aix 6100-06 Ruby 1.6.6 (2001-12-26) [powerpc-aix4.3.3.0] This is the parameter line in a ksh script calling the ruby program called execluderow2.rb excluderow2.rb INFILE=invrolla.txt,OUTFILE=invrollb.txt This is the method which is called to parse the input parms. Without the 'Crazy' fig shown below, the program stops. The error only happens when executing from aix cron and therefore the error code (if one is given)cannot be seen. If I add the crazy fig shown below, all the file opens later in the code work with no issue or error. def parseArgs args args = args.split(",") args.each { |arg| puts arg keyword, value = arg.split("=") case keyword when "INFILE" $inFile = value when "OUTFILE" $outFile = value end } # Crazy fix if $inFile == "invrolla.txt" then $inFile = "invrolla.txt" end if $outFile == "invrollb.txt" then $outFile = "invrollb.txt" end end This is one of the file opens later in the code. It won't work without the crazy fix. outputFile = File.new($outFile, "w") -- Posted via http://www.ruby-forum.com/.