Distribute a file on UniVerse
(thanks to Lauren Shah for her help on this document. KLP)
MEMO file used in this example. Be sure to read the notes at the end carefully. They can save you hours.

  1. Calculate the size of the partfiles.
  2. Run ANALYZE.FILE MEMO from TCL

    If the file is going to be separated into 5 parts, do the following:

    Number of databytes divided by the number of parts divided by the separation times 512 (2048 for separation of 4) times 1.2

    Example: 829211120 / 5 / 2048 * 1.2 = 97173

    If you are creating a new file and wish each partfile to be 5000MB (number of bytes = 5000 * 1024 * 1024), just divide that number by 2048 and multiply by 1.2 (assuming you need to add 20% for growth.

    Example: 5242880000 / 2048 * 1.2 = 3072000

  3. Calculate the prime number.
  4. > PRIME 97173 (or 3072000)
    Next lower prime number: 97171. (or 307189)
    Next higher prime number: 97177. (or 307201)

    The one you select will be the modulo of each partfile

  5. Create the partfiles:
  6. > CREATE.FILE MEMO1 1,1,5 97177,4,18
    > CREATE.FILE MEMO2 1,1,5 97177,4,18
    > CREATE.FILE MEMO3 1,1,5 97177,4,18
    > CREATE.FILE MEMO4 1,1,5 97177,4,18
    > CREATE.FILE MEMO5 1,1,5 97177,4,18
    > CREATE.FILE MEMO6 1,1,5 7,4,18 <=- CATCH-ALL part, which should remain empty but seldom does. Data in this file can usually be deleted.

  7. Rename the old file:
  8. > CNAME MEMO,MEMO-OLD

  9. Create algorithm:
  10. > ED MD FIVE.ALG

    0001: I
    0002: IF @ID[1]='0' OR @ID[1]='1' THEN 1 ELSE IF @ID[1]='2' OR @ID[1]='3' THEN 2 ELSE IF @ID[1]='4' OR @ID[1]='5' THEN 3 ELSE IF @ID[1]='6' OR @ID[1]='7' THEN 4 ELSE IF @ID[1]='8' OR @ID[1]='9' THEN 5 ELSE 6

  11. Define the distributed file with DEFINE.DF
  12. > DEFINE.DF MEMO ADDING MEMO1 1 MEMO2 2 MEMO3 3 MEMO4 4 MEMO5 5 MEMO6 6 INTERNAL FIVE.ALG

  13. Copy DICT and DATA from the renamed file to the new distributed file

    > COPY DICT MEMO-OLD *
    TO:(DICT MEMO
    > COPY MEMO-OLD * (I
    TO:(MEMO

  14. Delete MEMO-OLD after verifying that the data is all in the new MEMO file
  15. > DELETE.FILE MEMO-OLD

    Instructional differences for 10 PARTFILES

    Change the number of files created to 11, with the commands also reflecting 11 files, then use the following algorithm:

    > ED MD TEN.ALG

    0001: I
    0002: IF @ID[1]='1' THEN 1 ELSE IF @ID[1]='2' THEN 2 ELSE IF @ID[1]='3' THEN 3 ELSE IF @ID[1]='4' THEN 4 ELSE IF @ID[1]='5' THEN 5 ELSE IF @ID[1]='6' THEN 6 ELSE IF @ID[1]='7' THEN 7 ELSE IF @ID[1]='8' THEN 8 ELSE IF @ID[1]='9' THEN 9 ELSE IF @ID[1]='0' THEN 10 ELSE 11

    To Define a distributed file with ten parts, use the following command:

    > DEFINE.DF MEMO ADDING MEMO1 1 MEMO2 2 MEMO3 3 MEMO4 4 MEMO5 5 MEMO6 6 MEMO7 7 MEMO8 8 MEMO9 9 MEMO10 10 MEMO11 11 INTERNAL TEN.ALG



-- N O T E S --

  • The numbers being added don't have to match, I.E.: MEMO1 could be assigned as part 6.
    The benefit will be seen when distributed files are created that use non-numeric keys and access is needed to a specific partfile first. Partfiles are accessed with LIST, SORT, SELECT and other commands in the order in which they are assigned at the DEFINE.DF command starting with part 1 regardless of which filename is part 1.

  • Partfiles can be types 2 - 18 (static hashed) and 30 (dynamic hashed).

  • Using uniVerse indexes also works on distributed files.

  • It is wise to put dictionary items in a DICT of one of the partfiles as well as the main file's DICT. When performing DEFINE.DF MEMO REMOVING MEMO1 MEMO2 ... and all files are removed, the DICT and DATA portions of the main file are deleted. If DICT items are, therefore, stored in a DICT of one of the partfiles, they won't be lost and a file restore won't be necessary to recover them.

  • Here's an algorithm for 5 partfiles using CONVERT (I don't know how to write this for 10 partfiles):

    0001: I
    0002: CONVERT('0123456789','1122334455',@ID[LEN(@ID),1]);IF NUM(@1) THEN @1 ELSE 1