Announcement

Collapse
No announcement yet.

Analysing random files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Analysing random files

    Hello

    Logically one should be able to determine a pattern in a random
    access file to grab the data in it. Is there an easy way or has
    someone written an algo for this?

    Problem is a client has an old database stored in a random
    file. It is peculiar and no-one knows the record structure...

    Thanks
    Anton


    ------------------

  • #2
    Um, no, at least I've never heard of an algorithm, especially in a PC environment, where random files are nothing more than a stream of bytes.

    One thing I've done is to write a program to try different values as the record length, then look at the data and see if it makes sense:

    Code:
     FOR RecLen=1 to 100
       OPEN "Mystery" FOR RANDOM AS #1 LEN=RecLen
       FIELD #1, RecLen AS X$
       NumRecs = LOF(1) \ RecLen
       FOR J = 1 TO NumRecs
        GET #1,J, X$
        PRINT X$
        IF J MOD 10 = 0 THEN
         K$ = INPUT$(1)  ' pause the screen each ten records 
        END IF
       NEXT J
       CLOSE #1
     NEXT RecLen
    Hopefully, you'll see a pattern at some value of RecLen.

    Happy hunting.

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Anton,

      We have two programs at work that have this functionality
      built in. One is called WinIdea (made by CaseWare) and the
      other is ACL (Audit Command Language). They both have an
      "analyze" feature that allows you to figure out the record
      structure.



      ------------------
      Paul Squires
      [email protected]
      Paul Squires
      FireFly Visual Designer (for PowerBASIC Windows 10+)
      Version 3 now available.
      http://www.planetsquires.com

      Comment


      • #4
        Paul, that sounds interesting! Do you have a URL or contact detail for those programs?

        Thanks!


        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment

        Working...
        X