Results 1 to 1 of 1

Thread: Count lines?

  1. #1
    Join Date
    Feb 2004
    Location
    Australia
    Posts
    183

    Question Unanswered: Count lines?

    Hi guys,
    this is the code I am using to create a txt file that gets imported into a certain external database.

    nOut = FreeFile
    Open "C:\temp\" & szName For Output As #nOut

    '* Print the header.
    Print #nOut, "ISA*" & szDate & "*" & szTime
    Print #nOut, "GS*CN"
    Print #nOut, "ST*"

    '* Print the body.
    lCount = 3
    Do While rsPrint.EOF = False
    Print #nOut, "CN*" & szDate & "*" & szTime & "*" & _
    "O*" & rsPrint("JobNo") & "*" & rsPrint("FirstName") & " " & rsPrint("LastName") & "*" & _
    rsPrint("Address1") & "*" & rsPrint("Address2") & "*" & rsPrint("Address3") & "*" & rsPrint("Address4") & "*" & _
    rsPrint("City") & "*" & _
    rsPrint("State") & "*" & rsPrint("PostCode") & "**" & rsPrint("phone") & "***" & _
    rsPrint("JobNo") & "********"
    Print #nOut, "CL*" & rsPrint("refNo") & "*" & rsPrint("MOdel") & "*" & "1*" & rsPrint("ItmWeight") & "***"
    Print #nOut, "SE**2"
    lCount = lCount + 3
    rsPrint.MoveNext
    Loop

    '*Print the footer
    HERE I NEED TO HAVE something that will count the number of ST lines(that is part of the header) only and gives the result under this GE line below,not sure how to do this count
    Print #nOut, "GE*"
    Print #nOut, "IEA*" & CStr(lCount + 1)
    Print #nOut, Chr$(12)
    Close #nOut

    As you can see I have one lCount that loops through the file and gives the number of lines in the file.

    I was hoping somebody could help me with that


    ST is officially called "Transaction set start marker" or ST lines mark the beginning of a record and then

    GE is "Function Group End Marker" or counts the number of ST lines and therefore the number of records...

    Could you help me now
    Last edited by zobernjik; 06-07-04 at 02:45.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •