Announcement

Collapse
No announcement yet.

VIRTUAL ARRAY STRING SORT

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

  • VIRTUAL ARRAY STRING SORT

    This may be posted in the wrong area but:

    Some time ago (Feb 1999) Michael Mattias (member) posted about a
    freeware for sorting VIRTUAL arrays in pb dos.

    This utility code was not posted due to a restriction by PB.

    Michael - if you see this please contact me at [email protected]
    Better yet email your freeware sort code to me for inclusion in a
    new project of mine.

    My search of PB turned up a quick sort for non-string array data
    but yours looks like it fits the bill.

    Thanks in advance

    Jim Gillem 1-800-900-5909 USA




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

  • #2
    Can you post a reference to this please? Thanks!

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

    Comment


    • #3
      Hi Lance
      The following was found in the Msg1999 posted Feb 3, 1999 by
      Bobby Gage and the post by MCM is the 7th post down just under
      one of yours.
      ----------------------------------------------------------------
      ""If you want to sort UDT's by numeric members, efer to my article,
      "Multi-Key Sorting revisited" in the May, 1997 "Basically Speaking."

      In that article I published a bit-packing scheme (String Signed Binary, or SSB) which can be used for that purpose.

      As far as sorting HUGE or VIRTUAL arrays, I have freeware code
      that does that, too; but I cannot post it here.
      You'll have to ask PowerBASIC why not.

      MCM""
      ----------------------------------------------------------------
      This seems to suggest that sorting EMS arrays is actually do-able

      Jim

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

      Comment


      • #4
        without getting into discussion on why mr mattias would not post code at one time, mr mattias did subsequently post his "ssb" multi-key sorting code on the bbs.

        in essence, his ssb code provides a way of sorting based on numeric values stored in a udt. the only real relevance to your question here is that his ssb code performs a sort.

        however, there are plenty of "quicksort" algorithms and code for a quicksort on the bbs that will fit with your requirements - ie, check out:
        http://www.powerbasic.com/support/pb...read.php?t=393

        optimizations are possible with pointers if the virtual array can fit completely into one ems page (<=16kb)... but if it is larger than this, you'll have to use the more "conventional" approach such as used in that topic i mentioned.

        i hope this helps!


        ------------------
        lance
        powerbasic support
        mailto:[email protected][email protected]</a>
        Lance
        mailto:[email protected]

        Comment


        • #5
          The SSB code (posted) is not the same code used to sort HUGE arrays. SSB is simply a bit-packing scheme.

          However, I took one look at your post and off the top of my head noticed two problems...

          1. My HUGE array sorter was never designed for dynamic strings, and works only with fixed-element size arrays
          2. I can't believe I wrote "virtual" in that post, because the sort was never designed for that, and I know without testing it will not work on virtual arrays..(uses lots of pointer access, bypassing the PB array engine, which is needed to locate elements).

          That said, I will send you the HUGE array sort code (includes documentation).

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

          Comment


          • #6
            Thanks Michael and Lance

            I still want to continue my search for code to sort (and maintain)
            a virtual string array.(I realize it may be a little slower than a
            pb array sort)

            My need is to move an array (now used in lower memory) out to
            make room for additional code AND to allow almost unlimited
            space for the string data in the array via EMS.

            The array is made up of a single string (fixed) that is generated
            using existing random files relating to my existing
            ERP and CRM system files in use around the country.

            The array items act as pointers
            (each contains the PHYSICAL RECORD NUMBER of the main data for
            inventory items)

            This array is the foundation to lookup and sales invoices line
            items. (order entry)

            The system is, and has been in place since the late 70's in one
            form or another USING the same data structure.

            My next question on the table:

            What about the code posted for SORT.BAS that has a comment that
            "data types could be easily be changed from nurmeric to
            'other types'"

            I found the source using a search of PB , all open

            Has anyone converted this code to use strings ?

            Thanks in advance for any more help.

            Jim Gillem




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

            Comment


            • #7
              I still want to continue my search for code to sort (and maintain)
              a virtual string array.
              According to the PB/DOS help file, neither flex strings or "regular" dynamic strings are supported for VIRTUAL arrays.

              Plan B? With that much data, I'd index it on disk. I think Powertree is only $99.00 now (or maybe that was a promo thing), and there are couple versions of the freeware BT index manager floating around which support a long-integer range number of keys. If you want to manage that much data under MS-DOS, that would be my recommendation.

              However, if you are indexing, the key is a fixed length anyway (i.e., strings padded to a fixed length with spaces), which brings back into play a VIRTUAL array of <U>fixed-length</U> strings.

              I was doing some more thinking about my erroneous 1999 post. I realized I wrote that sort code before PB introduced VIRTUAL arrays, which is probably why I never considered supporting them.

              MCM




              [This message has been edited by Michael Mattias (edited February 17, 2002).]
              Michael Mattias
              Tal Systems Inc. (retired)
              Racine WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Hello Micheal (again)

                Sorry I unearthed the VIRTUAL word in your 1999 post for everyone
                to see. But as you said above - "it was before pb coined (sic) it"

                I could have used a btree indexing utility several years ago but
                chose to write my own ISAM utility that utilized a commercial
                sort with my striping / hashing code that is actually a tree.
                It has served me well. The newer order entry package needs to use
                existing files and I decided to do the beta using a fixed length
                flat array ( I guess it's called a flat array - it's how we did
                it on our 1108 drum light years past.)

                Anyway the beta order entry system w/o btree using array sort for
                some 2-3k cells gives me a sorted REAL TIME multi user look at a
                shared list of parts by part desc or part number and instant
                lookup by typing a ctr and the beta pops down to that record.

                Ths idea for the beta was to use the power of Powerbasic to do
                the whole job.. it does just that within the limits of the lower
                memory. By the way the alpha user is junking MAS90 for this new
                utility within my standard system ERP designed for MANUFACTURERS.

                For now the best way seems to be to use the lower memory with a
                virtual disk array on the local drive that points at the server.

                Thanks again to all - Any other VIRTUAL STRING SORT IDEAS will be
                appreaciated.

                Jim Gillem

                THIS IS NOT A PITCH FOR ANY PRODUCT.





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

                Comment


                • #9
                  Anyway the beta order entry system w/o btree using array sort for
                  some 2-3k cells gives me a sorted REAL TIME multi user look at a
                  shared list of parts by part desc or part number and instant
                  lookup by typing a ctr and the beta pops down to that record.
                  I put some code into the public domain a few years ago - both a DOS and a Windows version - which handled "real time list simulateously sorted by multiple keys" using a linked list.

                  Given your data volume, working in MS-DOS with this would be a dream; but if you are looking at Windows it might be a good option.

                  MCM




                  ------------------
                  Michael Mattias
                  Racine WI USA
                  [email protected]
                  Michael Mattias
                  Tal Systems Inc. (retired)
                  Racine WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment

                  Working...
                  X