PRODUCT:  R:BASE                   VERSION :  3.1 or Higher
     CATALOG:  Database Design,         AREA    :  Memory Management         
               Structure & Integrity
     Each day computers grow more powerful and more complex. It is not 
     unusual for machines to have modems, fax boards, extra large monitors, 
     disk compression utilities, scanners, CD ROM drives, virus detection 
     software etc. Each of these adds complexity to the computer system and 
     requires a driver and/or additional software to operate. In addition, 
     many machines use Windows or other multi-tasking programs. 
     As systems become more complex, products share the same resources 
     (memory and CPU ) and must be able to interact together. As more 
     products are run concurrently, however, chances of conflict or incom-
     patibility increase dramatically. For example, loading QEMM386, 
     Windows and then R:BASE 4.0 loads 3 levels of memory managers that 
     must work together. 
     A memory error message may come from one product, but actually be 
     caused by other software or hardware. The error message itself does 
     not always indicate where the problem lies. The approach to solving 
     memory related errors is the same: regardless of the error, follow a 
     step-by-step process of reduction and elimination. As you reduce the 
     levels of complexity and interaction and remove elements from your 
     system (temporarily) one-by-one, you're likely to pinpoint the command 
     or program causing the error.
     R:BASE Memory Errors
     There are a number of errors R:BASE returns that indicate a problem 
     with memory, either not enough memory or a conflict in addressing an 
     area in memory. The following error messages are the most common:
     "Insufficient memory to load protected mode R:BASE" (386/486 
        version only)
      "Cannot find protected mode R:BASE files in current directory or 
       path." (386/486 version only)
      "Fatal error: evm0009: EMM error: error = 81, function = 4732" 
       (286 version only)
      "Out of dynamic memory"
      "Out of dynamic space"
      "Insufficient memory to continue this function"
      "Insufficient buffer space to process expressions"
      "Insufficient space to process "
     Use the following step-by-step process to resolve the error.
     Steps to Resolving Memory Errors
     1. Verify that you are using the most current version of the software. 
        A new version may even be sitting on the shelf uninstalled. Old 
        software is not always compatible with a new computer and vice 
        versa, new software is not always compatible with an old computer. 
        Many companies do in-line releases. Call the vendor to verify that 
        you have the most current release or to find out how to get it. 
     2. Check the documentation. In particular, look through the README 
        files for all software you are loading and any hardware that has 
        been added to the machine. The README files often have reference to 
        known software or hardware incompatibilities, or identify settings 
        or drivers that need to be loaded for particular environments.
     3. Make sure there is enough available memory. R:BASE 4.0 (386/486 
        version) requires a minimum of 2.5 Mb (2,560,000 bytes) of available 
        extended or expanded memory. To check available memory use the DOS 
        MEM command. Execute MEM immediately after booting your machine. 
        Following is output from a MEM command on a machine with 6Mb total 
        RAM, HIMEM.SYS, 512Kb SMARTDRV cache and DOS 5.0 loaded high.
        655360 bytes total conventional memory
        655360 bytes available to MS-DOS
        565744 largest executable program size
               (available conventional memory)
        5505024 bytes total contiguous extended memory
                (total extended memory)
              0 bytes available contiguous extended memory
        4721664 bytes available XMS memory       
                (available extended memory)
              MS-DOS resident in High Memory Area
        HIMEM.SYS is an extended memory manager and no memory is being used 
        as expanded. If an expanded memory manager is used instead, the 
        output from MEM may look like this:
        655360 bytes total conventional memory
        655360 bytes available to MS-DOS
        565744 largest executable program size      
               (available conventional memory)
        5505024 bytes total EMS memory
        4721664 bytes free EMS memory     
                (available expanded memory)
        5505024 bytes total contiguous extended memory   
                (total extended memory)
          0 bytes available contiguous extended memory
        4721664 bytes available XMS memory       
              MS-DOS resident in High Memory Area                              
        Notice that available extended memory (XMS) and available expanded 
        memory (EMS) are the same amount. This is because all the memory is 
        being used as one pool, either extended or expanded, depending on the 
        software requesting memory. Third party memory managers provide the 
        ability to divide memory into two separate pools, one extended and 
        one expanded. When your memory is split into two pools, the MEM 
        command will show different numbers for available extended memory 
        (XMS) and available expanded memory (EMS). If your memory is split 
        into both extended and expanded, try allocating it as extended only.
        By default, R:BASE 4.0 attempts to use all available extended memory 
        as it executes. Try the DOS16M parameters as specified in the 
        MEMORY.TXT file to restrict the amount of extended memory that 
        R:BASE 4.0 will use. This option is available to machines with at 
        least 6Mb total memory.
        CodeLock and Gateway (Import/export) require 465 Kb of available 
        conventional memory.
        R:BASE 4.0 (286 version) requires 465 Kb (476,160 bytes) of available 
        conventional memory. The MEM command shows available conventional 
        memory, or you can use the DOS CHKDSK command.
        The CHKDSK command shows available conventional memory only. It does 
        not give information about extended or expanded memory. In addition, 
        it gives information about available disk space. The very last line 
        of the CHKDSK output shows the amount of available conventional 
        memory. Below is the CHKDSK output using DOS 5.0.
         86827008 bytes total disk space
            12288 bytes in 6 hidden files
           262144 bytes in 118 directories
         81917952 bytes in 2162 user files
          4546560 bytes available on disk
             2048 bytes in each allocation unit
            42396 total allocation units on disk
             2220 available allocation units on disk
           655360 total bytes memory
           565744 bytes free                   
                  (available conventional memory)
        In the 286 version, extended or expanded memory is used for code 
        swapping only, not for execution. It executes in conventional memory 
        only, but there can still be memory conflicts. If you get EVM error 
        messages when starting the 286 version, turn off use of extended 
        and/or expanded memory by R:BASE. There are two DOS SET parameters 
        that control this (other programs are not affected by these 
        settings). The SET command is entered at the DOS prompt. Be sure 
        there are no spaces around the equal sign (=). Try turning off one 
        section of memory at a time. 
        SET RTVMEXP=0%  --  turns off use of expanded memory by R:BASE
        SET RTVMEXT=0%  --  turns off use of extended memory by R:BASE
        Memory conflicts with the 286 version are most often caused by a 
        conflict with another software program. Also try Step 5 below. 
     4. Start R:BASE from the operating system prompt, not from within a 
        menuing system or multi-tasking program such as Windows or DESQview. 
        Start R:BASE from the R:BASE program files directory (usually 
        RBFILES). This eliminates any conflict with other programs or 
        versions of R:BASE on the path. R:BASE always looks first for files 
        in the current directory.
        Additional information on running the 286 version of R:BASE under 
        Windows is in the Installation Guide. The PIF file settings which 
        may require changes are Memory requirements, EMS memory and XMS 
        memory. Below are two different configurations that work under 
        Windows with the 286 version and HIMEM.SYS. If using an expanded 
        memory manager you need to specify EMS memory rather than XMS 
        memory. Some situations require both. Configuring non-Windows 
        applications for Windows is a process of trial and error.
           Memory requirements          Memory requirements                    
           -------------------          -------------------
           KB required -1               KB required 420
           KB desired -1                KB desired 640
           EMS memory                   EMS memory
           KB required 0                KB required 0
           KB desired 0                 KB desired 0
           XMS memory                   XMS memory
           KB required 1024             KB required 0
           KB desired 2048              KB desired 1024
        With the 386/486 version of R:BASE the situation becomes more 
        complex. You now have a 32-bit protected mode program (R:BASE) 
        running under a 16-bit protected mode program (Windows). Both have 
        their own memory manager and a third memory manager is often speci-
        fied in the CONFIG.SYS file. It's easy to see how with 3 levels of 
        memory management trying to coexist there may be some conflicts. 
        Information and tips on running the 386/486 version of R:BASE under 
        Windows is included in the README.TXT file. As with the 286 version, 
        it is often a long process of trial and error.
        There are some machine configurations that do not seem able to 
        run the 386/486 version under Windows. The best solution in this 
        instance is to run the 286 version under Windows. You have the same 
        features and functionality as the 386/486 version but different 
        memory management and performance.
        For information on running with other multi-tasking software, 
        contact the vendor of your multi-tasking software.
     5. Remove any possible interference or interaction with other 
        software by going to a "clean" configuration. This means starting 
        your computer with CONFIG.SYS and AUTOEXEC.BAT files containing 
        only elements that are absolutely required to start your computer. 
        For example, a hard disk driver is required, a network driver or 
        disk cache is not. Most people can go to a configuration such as:
        CONFIG.SYS file:
        AUTOEXEC.BAT file:
                PROMPT $P$G
        Note that no device drivers or other software programs are loaded. 
        The 386/486 version of R:BASE 4.0 does not require a memory manager. 
        The 286 version does not require a memory manager either, but 
        operates much faster with one present.
        Make copies of your original CONFIG.SYS and AUTOEXEC.BAT files 
        before making any changes. 
        Retry the operation that failed. If it still fails, then the 
        hardware may be faulty or the problem may lie in the database or 
        with the R:BASE program itself. If the problem does not occur, 
        then there must be something in the CONFIG.SYS or AUTOEXEC.BAT that 
        is creating a conflict. 
     6. Add elements back to your CONFIG.SYS and AUTOEXEC.BAT files 
        one-by-one, restarting your computer and retrying the operation 
        after each addition. At some point the operation will fail. Having 
        added elements back one-by-one, you now know exactly which driver 
        or program is causing a memory conflict with R:BASE. 
        An easy way to modify the CONFIG.SYS and AUTOEXEC.BAT files is by 
        putting the word "REM" followed by a space at the beginning of each 
        line you don't want to execute. This way, elements are "added" and 
        "deleted" from the files by adding or removing the "REM" at the 
        beginning of the line. The original lines aren't changed and don't 
        need to be reentered. 
        Following are some possible options once the conflicting element has 
        been identified: 
         - Remove the item permanently
         - Check the documentation for the particular utility or driver, 
         - including README files
         - Try loading drivers in a different order
         - Contact the developer of the utility or driver
         - Modify the program's parameters
     7. Remove hardware devices. If hardware, such as a modem, network card 
        or scanner card, has recently been added to the machine, remove the 
        hardware (and drivers) and retry the operation. Replace the hardware 
        one item at a time, retrying the operation after each addition. 
     8. Determine if the problem is related to a specific database. Try the 
        operation on a different database. Use the sample database, CONCOMP, 
        for example. If the same operation fails on the sample database, 
        then the problem may lie within the R:BASE program. Contact Microrim 
        Technical Support, 206-649-9551. We may be familiar with the problem 
        and have a workaround. If the problem seems to be related to a 
        particular database check the following:
        - Compare the database settings to the default values or to the 
          settings in a working database. Some settings are stored in the 
          database, others are set from the RBASE.CFG file. The settings that 
          commonly cause problems are BLANK, DELIMIT and NULL which are 
          stored in the database. The SET entry in the Command Dictionary 
          section of the Reference Manual has a complete list of settings 
          stored with the database versus the other settings. 
        - Use RBCHECK or RSCOPE to check the database for structure and 
          pointer errors. RBCHECK is a database checking utility that comes 
          with your R:BASE 3.x or 4.0 product. RSCOPE is a database check and 
          correction utility that can be purchased from our Sales Department. 
          To run RBCHECK, from the DOS prompt enter,
                RBCHECK dbname * dbname.chk
          Results of the check are written to the file dbname.chk.
        - There are settings specific to the 286 version that affect memory 
          usage. You can set a DOS environment variable to increase the size 
          of the data area used for processing. Try increasing this area if 
          you get "Out of dynamic space" messages. At the DOS prompt enter,
                SET RTVMCONV=640,200
          The second number is the size, in Kb, of the data area. You cannot 
          increase this above the limits of available conventional memory. 
          In addition, there is the -H startup option which allows 
          specification of the number of memory handles to use (default is 
        - Settings specific to the 386/486 version that affect memory usage 
          are the -Z and -K startup options and SET SORT. By default, the 
          386/486 does not use conventional memory for processing data, it is 
          all reserved for other programs accessed through the ZIP command. 
          The -Z startup switch is used to reserve a specified amount of 
          conventional memory for other programs, allowing R:BASE to use the 
          rest. The -K option specifies the size of memory blocks R:BASE will 
          allocate. SET SORT allows specification of the amount of memory to 
          use for sorting.
        - Use PACK (Pack in place) or RELOAD (Pack to) to rebuild the data 
          pointers and all indexes in the database.
        - Use the BACKUP and RESTORE procedure to rebuild the database 
          structure and load the data. This is different from PACK and 
          RELOAD, it completely recreates the database from scratch.
        - Check for invalid data in tables, particularly in the SYSINFO 
          table. The SYSINFO table contains long table and column names, 
          descriptions and autonumber information. BROWSE * FROM SYSINFO 
          and look for data that does not belong. Here's what some of the 
          data from the SYSINFO table in CONCOMP looks like:
     first eight       column or table    numeric precision   full column
     characters        description        and scale           and table names
     of table name         |                    |                     |
     |         first eight |      autonumber    |       autonumber    |
               characters  |      increment     |       next value    | 
     |         of column name        |          |           |         |
     syssname  syscname  sysdescr   sysinc    sysfmt    sysnext   syslong    
     --------  --------  --------   --------  --------  --------  --------
     employee  emplname  Employee     -0-       -0-       -0-       -0-
                         last name                               
     employee   empaddre Employee     -0-       -0-       -0-     empaddress  
                         home address
     employee  entrydat  Date infor-  -0-       -0-       -0-     entrydate
                         mation entered 
     transdet            Transaction  -0-       -0-       -0-     transdetail
     transdet  transid   Transaction  -0-       -0-       -0-       -0-
                         id number 
     transdet  detailnu  Detail line  -0-       -0-       -0-     detailnum 
     customer  custid    Customer   1.          -0-     111         -0-
                         id number
        - Try the operation with MULTI OFF if the database is on a network 
           file server.
        - Try the operation on a different computer.
     9. Reinstall the R:BASE program. If all else fails, try reinstalling 
        the program.
     Additional reading about memory
     The Waite Group's Tricks of the MS-DOS Masters
     The Waite Group
     100 Shoreline Highway, Suite A-285
     Mill VAlley, CA 94941
     Quarterdeck Manifest
     Quarterdeck Office Systems
     150 Pico Blvd.
     Santa Monica, CA 90405
     R:BASE Exchange articles:
     "Fine Tuning R:BASE", January/February 1993 (#680)
     "Problem Solving with R:BASE", September/October 1992 (#663)
     "An Introduction to R:BASE 4.0 and Memory Management", July/August 
      1992 (#647, #648)
     "Finding Your Optimum RTVMCONV - an Empirical Approach", January/
      February 1992 (#373)
     "How R:BASE Organizes & Manages Memory - Part I", July/August 1991 
     "Run Microrim's R:BASE Under Microsoft Windows", March/April 1991 
     All of the Exchange articles are available from our automated FAX 
     server, 206-649-2789. The document number is shown in parentheses.
     Windows is a registered trademark of Microsoft, Inc. QEMM386, 
     DESQview, and Quarterdeck Manifest are trademarks of Quarterdeck 
     Office Systems.