Error - Input past end of file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 10 of 10

Thread: Error - Input past end of file

  1. #1
    jesse Guest

    Error - Input past end of file


    HELP!!! I am trying to process a flat text file, i.e. read and add totals,
    and keep getting the following error:

    Run-time error '62':

    Input past end of file

    I have looked at the file & it is @ the end... Any ideas??

  2. #2
    Roy Guest

    Re: Error - Input past end of file

    You will need to show us your actual code in order to see what's the problem.

    Roy

    "jesse" <vb.@127.0.0.1> wrote in message news:3d6f8ec5$1@10.1.10.29...
    >
    > HELP!!! I am trying to process a flat text file, i.e. read and add totals,
    > and keep getting the following error:
    >
    > Run-time error '62':
    >
    > Input past end of file
    >
    > I have looked at the file & it is @ the end... Any ideas??




  3. #3
    Guest

    Re: Error - Input past end of file


    Here is the code which is huge. It is bombing in the line input:

    Dim TextLine1

    Dim Amount_Of_Transfer_For_Emp_Text

    Dim Amount_Of_Transfer_For_Emp As Variant

    Dim Running_Sum As Double

    Dim SM1 As String

    SM1 = Dir("c:\Payroll.sm1")


    Dim DirPathSm1 As String

    Dim Payroll_Type As String

    DirPathSm1 = "c:\Payroll.sm1"
    Dim Detail_line As String
    Dim Record_Count As Integer
    Dim First_Char As String

    Line Input #1, Detail_line
    Record_Count = 1

    Do While Not EOF(1) And (Mid(Detail_line, 1, 1) <> "8" Or Mid(Detail_line,
    1, 1) <> "1")

    First_Char = Mid(Detail_line, 1, 1)

    If (Mid(Detail_line, 55, 9) <> "Company") Then
    First_Char = Mid(Detail_line, 1, 1)

    If First_Char = "6" Then

    Record_Count = Record_Count + 1
    Length_Of_TextLine = Len(Detail_line)
    Amount_Of_Transfer_For_Emp = Mid(Detail_line, 30, 10)

    Running_Sum = Running_Sum + Amount_Of_Transfer_For_Emp
    End If
    Else

    Hold_SWA_Detail = Mid(Detail_line, 30, 10)
    Line Input #1, Detail_line
    Hold_Batch_Cr = Mid(Detail_line, 21, 12)
    Line Input #1, Detail_line
    Dim Trailer_Cr As Double
    Hold_Trailer_Cr = Mid(Detail_line, 32, 12)
    Trailer_Cr = Hold_Trailer_Cr


    End If
    Line Input #1, Detail_line
    Loop



    "Roy" <iroy55@hotmail.com> wrote:
    >You will need to show us your actual code in order to see what's the problem.
    >
    >Roy
    >
    >"jesse" <vb.@127.0.0.1> wrote in message news:3d6f8ec5$1@10.1.10.29...
    >>
    >> HELP!!! I am trying to process a flat text file, i.e. read and add totals,
    >> and keep getting the following error:
    >>
    >> Run-time error '62':
    >>
    >> Input past end of file
    >>
    >> I have looked at the file & it is @ the end... Any ideas??

    >
    >



  4. #4
    Roy Guest

    Re: Error - Input past end of file

    I can't find Open statement. How do you open your file?
    You should have something like the following:
    Open "TESTFILE" For Input As #1

    Roy

    <vb.@127.0.0.1> wrote in message news:3d6f98af$1@10.1.10.29...
    >
    > Here is the code which is huge. It is bombing in the line input:
    >
    > Dim TextLine1
    >
    > Dim Amount_Of_Transfer_For_Emp_Text
    >
    > Dim Amount_Of_Transfer_For_Emp As Variant
    >
    > Dim Running_Sum As Double
    >
    > Dim SM1 As String
    >
    > SM1 = Dir("c:\Payroll.sm1")
    >
    >
    > Dim DirPathSm1 As String
    >
    > Dim Payroll_Type As String
    >
    > DirPathSm1 = "c:\Payroll.sm1"
    > Dim Detail_line As String
    > Dim Record_Count As Integer
    > Dim First_Char As String
    >
    > Line Input #1, Detail_line
    > Record_Count = 1
    >
    > Do While Not EOF(1) And (Mid(Detail_line, 1, 1) <> "8" Or Mid(Detail_line,
    > 1, 1) <> "1")
    >
    > First_Char = Mid(Detail_line, 1, 1)
    >
    > If (Mid(Detail_line, 55, 9) <> "Company") Then
    > First_Char = Mid(Detail_line, 1, 1)
    >
    > If First_Char = "6" Then
    >
    > Record_Count = Record_Count + 1
    > Length_Of_TextLine = Len(Detail_line)
    > Amount_Of_Transfer_For_Emp = Mid(Detail_line, 30, 10)
    >
    > Running_Sum = Running_Sum + Amount_Of_Transfer_For_Emp
    > End If
    > Else
    >
    > Hold_SWA_Detail = Mid(Detail_line, 30, 10)
    > Line Input #1, Detail_line
    > Hold_Batch_Cr = Mid(Detail_line, 21, 12)
    > Line Input #1, Detail_line
    > Dim Trailer_Cr As Double
    > Hold_Trailer_Cr = Mid(Detail_line, 32, 12)
    > Trailer_Cr = Hold_Trailer_Cr
    >
    >
    > End If
    > Line Input #1, Detail_line
    > Loop
    >
    >
    >
    > "Roy" <iroy55@hotmail.com> wrote:
    > >You will need to show us your actual code in order to see what's the problem.
    > >
    > >Roy
    > >
    > >"jesse" <vb.@127.0.0.1> wrote in message news:3d6f8ec5$1@10.1.10.29...
    > >>
    > >> HELP!!! I am trying to process a flat text file, i.e. read and add totals,
    > >> and keep getting the following error:
    > >>
    > >> Run-time error '62':
    > >>
    > >> Input past end of file
    > >>
    > >> I have looked at the file & it is @ the end... Any ideas??

    > >
    > >

    >




  5. #5
    Guest

    Re: Error - Input past end of file


    Oops, yes you're right. Right b4 this code was this:

    Open DirPathSm1 For Input As #1


    "Roy" <iroy55@hotmail.com> wrote:
    >I can't find Open statement. How do you open your file?
    >You should have something like the following:
    >Open "TESTFILE" For Input As #1
    >
    >Roy
    >
    ><vb.@127.0.0.1> wrote in message news:3d6f98af$1@10.1.10.29...
    >>
    >> Here is the code which is huge. It is bombing in the line input:
    >>
    >> Dim TextLine1
    >>
    >> Dim Amount_Of_Transfer_For_Emp_Text
    >>
    >> Dim Amount_Of_Transfer_For_Emp As Variant
    >>
    >> Dim Running_Sum As Double
    >>
    >> Dim SM1 As String
    >>
    >> SM1 = Dir("c:\Payroll.sm1")
    >>
    >>
    >> Dim DirPathSm1 As String
    >>
    >> Dim Payroll_Type As String
    >>
    >> DirPathSm1 = "c:\Payroll.sm1"
    >> Dim Detail_line As String
    >> Dim Record_Count As Integer
    >> Dim First_Char As String
    >>
    >> Line Input #1, Detail_line
    >> Record_Count = 1
    >>
    >> Do While Not EOF(1) And (Mid(Detail_line, 1, 1) <> "8" Or Mid(Detail_line,
    >> 1, 1) <> "1")
    >>
    >> First_Char = Mid(Detail_line, 1, 1)
    >>
    >> If (Mid(Detail_line, 55, 9) <> "Company") Then
    >> First_Char = Mid(Detail_line, 1, 1)
    >>
    >> If First_Char = "6" Then
    >>
    >> Record_Count = Record_Count + 1
    >> Length_Of_TextLine = Len(Detail_line)
    >> Amount_Of_Transfer_For_Emp = Mid(Detail_line, 30, 10)
    >>
    >> Running_Sum = Running_Sum + Amount_Of_Transfer_For_Emp
    >> End If
    >> Else
    >>
    >> Hold_SWA_Detail = Mid(Detail_line, 30, 10)
    >> Line Input #1, Detail_line
    >> Hold_Batch_Cr = Mid(Detail_line, 21, 12)
    >> Line Input #1, Detail_line
    >> Dim Trailer_Cr As Double
    >> Hold_Trailer_Cr = Mid(Detail_line, 32, 12)
    >> Trailer_Cr = Hold_Trailer_Cr
    >>
    >>
    >> End If
    >> Line Input #1, Detail_line
    >> Loop
    >>
    >>
    >>
    >> "Roy" <iroy55@hotmail.com> wrote:
    >> >You will need to show us your actual code in order to see what's the

    problem.
    >> >
    >> >Roy
    >> >
    >> >"jesse" <vb.@127.0.0.1> wrote in message news:3d6f8ec5$1@10.1.10.29...
    >> >>
    >> >> HELP!!! I am trying to process a flat text file, i.e. read and add

    totals,
    >> >> and keep getting the following error:
    >> >>
    >> >> Run-time error '62':
    >> >>
    >> >> Input past end of file
    >> >>
    >> >> I have looked at the file & it is @ the end... Any ideas??
    >> >
    >> >

    >>

    >
    >



  6. #6
    jesse flores Guest

    Re: Error - Input past end of file


    So if I want to put here (Second Line Input):

    Line Input #1, Detail_line

    What is syntax?

    Line Input Until EOF #1, Detail_line??

    Inside the loop?

    >>>>>>>>>>

    Appreciate you help.....

    "Grinder" <grinder@no.spam.maam.com> wrote:
    >You could get an input past end here...
    >
    >> Line Input #1, Detail_line

    >
    >....
    >
    >> Do While Not EOF(1) And (Mid(Detail_line, 1, 1) <> "8" Or

    >Mid(Detail_line,
    >> 1, 1) <> "1")
    >>
    >> First_Char = Mid(Detail_line, 1, 1)
    >>
    >> If (Mid(Detail_line, 55, 9) <> "Company") Then
    >> First_Char = Mid(Detail_line, 1, 1)
    >>
    >> If First_Char = "6" Then
    >>
    >> Record_Count = Record_Count + 1
    >> Length_Of_TextLine = Len(Detail_line)
    >> Amount_Of_Transfer_For_Emp = Mid(Detail_line, 30,

    >10)
    >>
    >> Running_Sum = Running_Sum +

    >Amount_Of_Transfer_For_Emp
    >> End If
    >> Else
    >>
    >> Hold_SWA_Detail = Mid(Detail_line, 30, 10)
    >> Line Input #1, Detail_line
    >> Hold_Batch_Cr = Mid(Detail_line, 21, 12)

    >
    >.... or, here...
    >
    >> Line Input #1, Detail_line
    >> Dim Trailer_Cr As Double
    >> Hold_Trailer_Cr = Mid(Detail_line, 32, 12)
    >> Trailer_Cr = Hold_Trailer_Cr
    >>
    >>
    >> End If

    >
    >.... or possibly here...
    >
    >> Line Input #1, Detail_line
    >> Loop

    >
    >.... as you're attempting a read without checking for EOF.
    >
    >
    >



  7. #7
    Grinder Guest

    Re: Error - Input past end of file

    You could get an input past end here...

    > Line Input #1, Detail_line


    ....

    > Do While Not EOF(1) And (Mid(Detail_line, 1, 1) <> "8" Or

    Mid(Detail_line,
    > 1, 1) <> "1")
    >
    > First_Char = Mid(Detail_line, 1, 1)
    >
    > If (Mid(Detail_line, 55, 9) <> "Company") Then
    > First_Char = Mid(Detail_line, 1, 1)
    >
    > If First_Char = "6" Then
    >
    > Record_Count = Record_Count + 1
    > Length_Of_TextLine = Len(Detail_line)
    > Amount_Of_Transfer_For_Emp = Mid(Detail_line, 30,

    10)
    >
    > Running_Sum = Running_Sum +

    Amount_Of_Transfer_For_Emp
    > End If
    > Else
    >
    > Hold_SWA_Detail = Mid(Detail_line, 30, 10)
    > Line Input #1, Detail_line
    > Hold_Batch_Cr = Mid(Detail_line, 21, 12)


    .... or, here...

    > Line Input #1, Detail_line
    > Dim Trailer_Cr As Double
    > Hold_Trailer_Cr = Mid(Detail_line, 32, 12)
    > Trailer_Cr = Hold_Trailer_Cr
    >
    >
    > End If


    .... or possibly here...

    > Line Input #1, Detail_line
    > Loop


    .... as you're attempting a read without checking for EOF.




  8. #8
    jesse flores Guest

    Re: Error - Input past end of file


    So easy, huh?? WOW!!!

    Thanks guys......jf


    "Grinder" <grinder@no.spam.maam.com> wrote:
    >
    >"jesse flores" <jflores@wnco.com> wrote in message
    >news:3d6fbdb5$1@10.1.10.29...
    >>
    >> So if I want to put here (Second Line Input):
    >>
    >> Line Input #1, Detail_line
    >>
    >> What is syntax?
    >>
    >> Line Input Until EOF #1, Detail_line??
    >>
    >> Inside the loop?

    >
    >Your logic seems a bit tangled to me, so there's likely a
    >better way to structure it. But, to you can always check for
    >EOF:
    >
    >If Not Eof(1) Then
    > Line Input #1, Detail_line
    >End If
    >
    >
    >



  9. #9
    Grinder Guest

    Re: Error - Input past end of file


    "jesse flores" <jflores@wnco.com> wrote in message
    news:3d6fbdb5$1@10.1.10.29...
    >
    > So if I want to put here (Second Line Input):
    >
    > Line Input #1, Detail_line
    >
    > What is syntax?
    >
    > Line Input Until EOF #1, Detail_line??
    >
    > Inside the loop?


    Your logic seems a bit tangled to me, so there's likely a
    better way to structure it. But, to you can always check for
    EOF:

    If Not Eof(1) Then
    Line Input #1, Detail_line
    End If




  10. #10
    Sue Harsevoort Guest

    Re: Error - Input past end of file

    This is not related to you Input past end of file problem but when I was
    looking at you code I noticed what looked like a problem with the code
    below. the statement (Mid(Detail_line, 1,1) <>"8" or Mid(Detail_line, 1,1)
    <> "1") will always be true because if the first character is 1 you will
    have true or false which is true. If the first character is 8 you will have
    false or true which is true and for all other values you will have true and
    true which is true. If you really need to stop the loop if the first
    character is 8 or 1 you need and between the mid statements not or.

    Sue

    <vb.@127.0.0.1> wrote in message news:3d6f98af$1@10.1.10.29...
    >
    > Do While Not EOF(1) And (Mid(Detail_line, 1, 1) <> "8" Or Mid(Detail_line,
    > 1, 1) <> "1")





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center