Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBSript Error

Status
Not open for further replies.

Gopher911

IS-IT--Management
Feb 19, 2003
1
US
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 &quot;Usage: parser <billing date in YYYYMM format>&quot;
Wscript.Quit(1)
End If

billingDate = objArgs(0)

Set fileInput = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set fileOutput = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set ccarInput = fileInput.OpenTextFile(&quot;c:\ccar\ccar.txt&quot;, 1)
Set ccarOutput = fileOutput.OpenTextFile(&quot;c:\ccar\ccar_all_&quot; + billingDate + &quot;.dat&quot;, 2, True)

If ccarInput.AtEndOfStream <> True Then
readBuffer = ccarInput.ReadLine
Else
WScript.Echo &quot;Error: Empty file!&quot;
WScript.Quit(1)
End If

Do While ccarInput.AtEndOfStream <> True
readBuffer = ccarInput.ReadLine
column = Split(readBuffer, &quot;;&quot;, -1, 1)

empnum = Mid(column(3),1,10)

if empnum = &quot; &quot; then
empnum = &quot;UNKNOWN&quot;
End If

amount = CStr(CDbl(column(17)))

ccarOutput.WriteLine(billingDate + &quot;|&quot; + _
empnum + &quot;|&quot; + _
&quot;CCAR&quot; + &quot;|&quot; + _
column(0) + &quot;|&quot; + _
&quot;ATT&quot; + &quot;|&quot; + _
&quot;1&quot; + &quot;|&quot; + _
&quot;0&quot; + &quot;|&quot; + _
&quot;NA&quot; + &quot;|&quot; + _
&quot;NA&quot; + &quot;|&quot; + _
&quot;NA&quot; + &quot;|&quot; + _
&quot;NA&quot; + &quot;|&quot; + _
&quot;NA&quot; + &quot;|&quot; + _
amount + &quot;|&quot; + _
&quot;WW&quot;)
Loop

ccarInput.Close
ccarOutput.Close


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top