Results 1 to 4 of 4

Thread: sorting and merging of 2 sequnetial files

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    56

    sorting and merging of 2 sequnetial files

    Hello

    Pl Help me with this simple solution
    I want to merge two files How can i do it ?

    VB Code:
    1. OPEN "ADD.DAT" FOR INPUT AS#1
    2. DO UNTIL EOF(1)
    3. i% =i% + 1
    4. if i% > ubound(Names$) then redim preserve Names$(1 to i%)
    5. if i% > ubound(goals$) then redim preserve add$(1 to i%)
    6.  
    7. INPUT #1, Name$(i%), add$(i%)
    8. LOOP
    9. CLOSE #1

    Which displays
    "Ronaldo","Brazil"
    "David","UK"
    "Pele","Brazil"
    "Mardona","Argentina"
    "Doanald","SA"
    "Schnider","Germany"



    VB Code:
    1. OPEN "Goals.Dat" FOR INPUT AS#1
    2. DO UNTIL EOF(1)
    3. s$=s%+1
    4. if s% > ubound(Names$) then redim preserve Names$(1 to s%)
    5. if s% > ubound(goals$) then redim preserve goals$(1 to s%)
    6. INPUT #1, Names$(i%), goals$(i%)
    7. LOOP
    8. CLOSE #1

    Which displays
    "Ronaldo","10"
    "David","4"
    "Doanald","3"
    "Schnider","2"

    I want to merge above two files and get the result as
    "David","UK","4"
    "Doanald","SA","3"
    "Mardona","Argentina",""
    "Pele","Brazil",""
    "Ronaldo","Brazil","10"
    "Schnider","Germany","2"

    Pl Help

    Regards

    Samyo
    Last edited by si_the_geek; Jun 17th, 2006 at 08:04 AM. Reason: added vbcode tags for readability

Posting Permissions

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



Click Here to Expand Forum to Full Width