I was wondering if anyone could look at this and tell me what I am doing wrong. I am trying to parse data from a file and I keep getting a line 18 error - File not found - Code 800A0035. I have verified that the file listed in line 18 - c:\ccar\ccar.txt)is existant and in the CCAR directory.
Thanks!
Dim fileInput, fileObject
Dim ccarInput, ccarOutput
Dim objArgs
Dim readBuffer, column, amount, empnum
Set objArgs = WScript.Arguments
If (objArgs.Count = 0) Then
WScript.Echo "Error: Invalid argument!"
WScript.Echo "Usage: parser <billing date in YYYYMM format>"
Wscript.Quit(1)
End If
billingDate = objArgs(0)
Set fileInput = CreateObject("Scripting.FileSystemObject"
Set fileOutput = CreateObject("Scripting.FileSystemObject"
Set ccarInput = fileInput.OpenTextFile("c:\ccar\ccar.txt", 1)
Set ccarOutput = fileOutput.OpenTextFile("c:\ccar\ccar_all_" + billingDate + ".dat", 2, True)
If ccarInput.AtEndOfStream <> True Then
readBuffer = ccarInput.ReadLine
Else
WScript.Echo "Error: Empty file!"
WScript.Quit(1)
End If
Do While ccarInput.AtEndOfStream <> True
readBuffer = ccarInput.ReadLine
column = Split(readBuffer, ";", -1, 1)
empnum = Mid(column(3),1,10)
if empnum = " " then
empnum = "UNKNOWN"
End If
amount = CStr(CDbl(column(17)))
ccarOutput.WriteLine(billingDate + "|" + _
empnum + "|" + _
"CCAR" + "|" + _
column(0) + "|" + _
"ATT" + "|" + _
"1" + "|" + _
"0" + "|" + _
"NA" + "|" + _
"NA" + "|" + _
"NA" + "|" + _
"NA" + "|" + _
"NA" + "|" + _
amount + "|" + _
"WW"
Loop
ccarInput.Close
ccarOutput.Close
Thanks!
Dim fileInput, fileObject
Dim ccarInput, ccarOutput
Dim objArgs
Dim readBuffer, column, amount, empnum
Set objArgs = WScript.Arguments
If (objArgs.Count = 0) Then
WScript.Echo "Error: Invalid argument!"
WScript.Echo "Usage: parser <billing date in YYYYMM format>"
Wscript.Quit(1)
End If
billingDate = objArgs(0)
Set fileInput = CreateObject("Scripting.FileSystemObject"
Set fileOutput = CreateObject("Scripting.FileSystemObject"
Set ccarInput = fileInput.OpenTextFile("c:\ccar\ccar.txt", 1)
Set ccarOutput = fileOutput.OpenTextFile("c:\ccar\ccar_all_" + billingDate + ".dat", 2, True)
If ccarInput.AtEndOfStream <> True Then
readBuffer = ccarInput.ReadLine
Else
WScript.Echo "Error: Empty file!"
WScript.Quit(1)
End If
Do While ccarInput.AtEndOfStream <> True
readBuffer = ccarInput.ReadLine
column = Split(readBuffer, ";", -1, 1)
empnum = Mid(column(3),1,10)
if empnum = " " then
empnum = "UNKNOWN"
End If
amount = CStr(CDbl(column(17)))
ccarOutput.WriteLine(billingDate + "|" + _
empnum + "|" + _
"CCAR" + "|" + _
column(0) + "|" + _
"ATT" + "|" + _
"1" + "|" + _
"0" + "|" + _
"NA" + "|" + _
"NA" + "|" + _
"NA" + "|" + _
"NA" + "|" + _
"NA" + "|" + _
amount + "|" + _
"WW"
Loop
ccarInput.Close
ccarOutput.Close