home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / rbnotes2.zip / EDTORIAL.13 < prev    next >
Text File  |  1986-05-01  |  67KB  |  1,960 lines

  1.  
  2.      
  3.      
  4.      
  5.      
  6.      MICRORIM TECHNICAL NOTE
  7.      __________________________________________________________________________
  8.      
  9.      DEBUGGING
  10.      
  11.      DATE      :  04/86                   NUMBER       :  EX-4-1
  12.      PRODUCT   :  R5K                     VERSIONS     :  1.01
  13.      CATEGORY  :  PROGRAMMING             SUBCATEGORY  :  DEBUG
  14.      
  15.      __________________________________________________________________________
  16.      
  17.      DESCRIPTION:   My program will not work!  What do I do now?
  18.      
  19.      
  20.      
  21.      
  22.      EXPLANATION:   After writing an R:BASE 5000 or XRW program, the next step
  23.      is to get your program to work by going through a process programmers call
  24.      debugging.
  25.      
  26.      Getting your program to work is like solving a mystery with the debugging
  27.      process providing the clues.  Several books have been written on debugging.
  28.      You might want to do some further research in your library.  However, to
  29.      get started, this article presents several basic tips you can apply to
  30.      debug your R:BASE and XRW programs.
  31.      
  32.      GATHERING INFO
  33.      
  34.      You can learn a great deal about what is currently happening in your
  35.      program by creatively using the following R:BASE commands:
  36.      
  37.      SET MESSAGES ON
  38.      SET ERROR MESSAGES ON
  39.      SHOW VAR; PAUSE
  40.      SET ECHO ON
  41.      WRITE "message"
  42.      
  43.      MESSAGES ON
  44.      
  45.      Setting messages and error messages on are the most basic debugging
  46.      commands.  Without these two commands, you are searching in the dark for
  47.      clues.
  48.      
  49.      SHOWING VARIABLES
  50.      
  51.      SHOW VAR;PAUSE should be put at several points in your code.  This will
  52.      display the current values and data types of your global variables and then
  53.      pause, giving you a chance to read them.  After you read the variable list,
  54.      you can press any key to continue processing your program.
  55.      
  56.      
  57.      
  58.      
  59.      
  60.      
  61.      
  62.      
  63.      
  64.      
  65.      
  66.      
  67.      SHOW VAR;PAUSE allows you to see if variables are being properly updated.
  68.      Also, if you want to see if a certain section of your code is executing,
  69.      put SET VAR TESTSEC TO 0 right above the section and then put SET VAR
  70.      TESTSEC TO .TESTSEC + 1 inside the section.  If your SHOW VAR command shows
  71.      TESTSEC has a value of 1, you know that section of your code has executed
  72.      once.  If it is 2, it has executed twice, and so on.
  73.      
  74.      TRACING EXECUTION
  75.      
  76.      SET ECHO ON allows you to trace the execution of your program.  It works
  77.      only on the ASCII version of your R:BASE 5000 program, not the compiled
  78.      version.  So it is best to debug before compiling and before adding your
  79.      macro to your EXPRESS application.
  80.      
  81.      SET ECHO ON is one of the most useful debugging tools because it will cause
  82.      each command, in your ASCII command file or macro, to display on the screen
  83.      before executing.  You will then be able to determine exactly which command
  84.      lines are causing which messages and error messages.
  85.      
  86.      If everything is scrolling by too fast for you to read, you can interrupt
  87.      program operation by holding down the [CTRL] key and pressing [S].  When
  88.      you are ready to resume program operation, press [CTRL] [Q] or [ENTER] to
  89.      toggle execution back on.  If you prefer, you can send the tracing to the
  90.      printer or a file with the OUTPUT command or you can put more PAUSE
  91.      commands in your code.
  92.      
  93.      Tracing an EXPRESS generated application is a complex process.  SET ECHO ON
  94.      will not work on compiled files and EXPRESS uses a lot of compiled files.
  95.      A future technical note will explain how to trace execution in an EXPRESS
  96.      generated application.
  97.      
  98.      WRITING MESSAGES
  99.      
  100.      If it is not convenient to SET ECHO ON because it makes a mess of your
  101.      variable form or for whatever reason, put WRITE commands in your code to
  102.      trace the execution of certain modules.  Liberal use of the WRITE and SHOW
  103.      VAR;PAUSE commands will give you a lot of information.
  104.      
  105.      DISABLING SECTIONS OF CODE
  106.      
  107.      You can disable sections of your code that you think may be causing the
  108.      problem and then check to make sure everything else works.  This is easily
  109.      accomplished by commenting out lines of code with *(...) in R:BASE 5000 and
  110.      with {....} in XRW.
  111.      
  112.      MULTIPLE BACKUPS
  113.      
  114.      Always back everything up before beginning a debugging session.  This way
  115.      you can always get back to the way it was.  You might even want to have
  116.      several backups of different versions until your program is working.
  117.      
  118.      PATIENCE AND FRESHNESS
  119.      
  120.      Be patient with yourself, take frequent breaks, and have someone else take
  121.      a look at your code and debugging tracings.  A fresh look may bring
  122.      
  123.      
  124.      
  125.      
  126.      
  127.      
  128.      
  129.      
  130.      
  131.      
  132.      
  133.      valuable new information.
  134.      
  135.      Instead of output going only to the screen, you can send output to a
  136.      printer or to a file to peruse at a later, more refreshed time by using
  137.      commands such as:
  138.      
  139.      *(Send output to the printer)
  140.      OUTPUT PRINTER WITH SCREEN
  141.      RUN TESTPROG
  142.      
  143.      or:
  144.      
  145.      *(Send output to a file)
  146.      OUTPUT TESTPROG.TST WITH SCREEN
  147.      RUN TESTPROG
  148.      
  149.      GOOD PROGRAMMING STANDARDS
  150.      
  151.      If possible, when writing the original code, use programming standards that
  152.      facilitate debugging during the programming process itself.  Opinions vary
  153.      on this, but you can choose from and add to the following list:
  154.      
  155.        o  Program in modules (also known as blocks or subroutines).  It is
  156.        easier to debug each module separately.
  157.        o  Use structured programming techniques.  Many books and articles have
  158.        been written on structured programming techniques.  Find one that suits
  159.        you and learn from it.
  160.        o  Write the program so that it is clear and easy to understand.
  161.        o  Use comments liberally throughout your code.  You can make an execute
  162.        only version later, without the comments, to operate at optimum speed.
  163.        o  If speed is an issue for your application, read the Technical Note
  164.        Speeding Up Execution Microrim Technical Note number EX-4-2 (catagory:
  165.        SPEED and subcategory: PROGRAMMING.)   Try to incorporate the programming
  166.        techniques mentioned as you write your program.  For example, you will
  167.        want to avoid setting up loops using the GOTO command.  Use the WHILE
  168.        command instead.
  169.        o  You have eight characters for variable names, column names, filenames,
  170.        table names, report names, and form names.  Try to avoid meaningless
  171.        names like V1 or COL3 or TBL4.  Discipline yourself to set up and follow
  172.        a naming convention.  For example: Always use a V as the first character
  173.        in a variable name.  Make column names different from table names.
  174.        Always begin a table, variable, column, report, or form name with a
  175.        letter.  Do not make variable names and column names the same.
  176.        o  Initialize all variables to a particular value or data type.
  177.        o  Clear variables by name rather than by using the CLEAR ALL VARIABLE
  178.        command.
  179.        o  Make sure the printout of your code is the most current.  It is a good
  180.        idea to print a new one often and include the date and time on each one.
  181.        o  Keep notes on each module of your program, what it does, what it uses
  182.        (forms, reports, files, other modules, etc.), and how it fits into the
  183.        big picture.
  184.      
  185.      PROBLEM SOLVING
  186.      
  187.      Follow standard problem solving procedure.  Answer the following questions
  188.      
  189.      
  190.      
  191.      
  192.      
  193.      
  194.      
  195.      
  196.      
  197.      
  198.      
  199.      and try to find someone who will listen to your answers.  The person you
  200.      talk to does not need to know R:BASE.  Sometimes just hearing yourself
  201.      answer the questions will jog you into realizing the solution or at least a
  202.      possible solution.
  203.      
  204.        o  What is it that you want to happen?
  205.        o  What is actually happening?
  206.        o  When you applied the tips in this article to get a more detailed
  207.        picture of what is happening in your program, what did you find out?
  208.        o  What is another way to get what you want?  Try this alternative.
  209.        o  Make a guess; what might fix the problem?  Try it.  No matter how
  210.        outrageous you think your guess is, you may be right.  Try it.
  211.      
  212.      The debugging process is always one of trial and error.  As long as you
  213.      keep adequate backups, you have nothing to fear from trying.  Use your
  214.      imagination and let yourself try anything that comes to mind.  This is the
  215.      way problems get solved.  In the process you will learn more about how
  216.      R:BASE 5000 and/or XRW work.
  217.      
  218.      SYNTAX, SPELLING, & DOTS
  219.      
  220.      The most common errors are the result of incorrect syntax, misspellings,
  221.      spacing errors, or the old question of "to dot or not to dot" your
  222.      variables.
  223.      
  224.      Using your Command Summary card as a guide, look for syntax errors.  Check
  225.      for transposed letters and often confused characters (upper case letter O
  226.      vs. the number 0 and lower case letter L vs. the number 1) in your
  227.      commands.  Even if the error message does not mention syntax, syntax is
  228.      often the problem.
  229.      
  230.      Whenever a variable name is in a position of the command line normally held
  231.      by a value, make sure the variable has a dot in front of it.  If the
  232.      variable name is in a spot that normally contains a variable name and NOT a
  233.      value, then the variable must NOT be dotted.
  234.      
  235.      Check for other common mistakes like missing spaces or spaces where there
  236.      should not be any.  Spacing is particularly important in XRW.
  237.      
  238.      Check for comments without a closing parenthesis, misspellings, and missing
  239.      or mismatched ENDIF, ENDWHILE, or END commands.  Also, check for a missing
  240.      closing quotation mark or quotation marks in your data, forms, or reports
  241.      that may be causing problems.
  242.      
  243.      Make sure that you are following all the structural rules of the language.
  244.      For example, in XRW all "AT START OF attname" blocks must immediately
  245.      follow the FOR EACH ROW... line.  In R:BASE 5000, you must not GOTO a LABEL
  246.      inside a WHILE or IF block if the GOTO is outside the block.
  247.      
  248.      SUMMARY
  249.      
  250.      Remember that debugging is an art just as programming is.  Try new things,
  251.      be creative, and when you begin to feel frustrated, take a break.
  252.      
  253.      
  254.      
  255.      
  256.      
  257.      
  258.      
  259.      
  260.      
  261.      
  262.      
  263.      
  264.      
  265.      
  266.      
  267.      
  268.      
  269.      MICRORIM TECHNICAL NOTE
  270.      __________________________________________________________________________
  271.      
  272.      SPEEDING UP EXECUTION
  273.      
  274.      DATE      :  04/86                   NUMBER       :  EX-4-2
  275.      PRODUCT   :  R5K                     VERSIONS     :  1.01
  276.      CATEGORY  :  SPEED                   SUBCATEGORY  :  PROGRAMMING
  277.      
  278.      __________________________________________________________________________
  279.      
  280.      DESCRIPTION:   Now that I have my program running, how can I make it run
  281.      faster?  What rules should I follow when programming in R:BASE 5000 to
  282.      ensure that my code will be efficient?
  283.      
  284.      
  285.      
  286.      
  287.      EXPLANATION:   To help you to make your applications as efficient as
  288.      possible, we are providing you with the following four checklists:
  289.      
  290.        o  Programming
  291.        o  Post Programming
  292.        o  Operations & Design
  293.        o  Memory & Hardware
  294.      
  295.      You will find these checklists listed in the SOLUTION section of this
  296.      technical note.  Using these checklists as a guide, apply as many of the
  297.      items as possible.  These checklists are general.  If you would like us to
  298.      expand on any items in particular and explain them in more detail, please
  299.      drop a note to the Technical Notes Editor.
  300.      
  301.      Few of you will be able to take advantage of all the items in the list and
  302.      no one item is likely to give you any great speed increase.  However, if
  303.      you are able to implement several of these suggestions, you may well see a
  304.      verifiable increase in the speed of your application.
  305.      
  306.      TIMINGS
  307.      
  308.      If you are interested in making actual timings on your application, you do
  309.      not have to sit at the computer with a stopwatch.  You can use the internal
  310.      clock by making use of the #TIME system variable.  For example, put:
  311.      
  312.      SET VAR TIMING INTEGER
  313.      SET VAR START TO .#TIME
  314.      
  315.      at the start of the section of code you are timing and put the following
  316.      code at the bottom of the section:
  317.      
  318.      SET VAR STOP TO .#TIME
  319.      SET VAR TIMING TO .STOP - .START
  320.      
  321.      
  322.      
  323.      
  324.      
  325.      
  326.      
  327.      
  328.      
  329.      
  330.      
  331.      OUTPUT PRINTER
  332.      WRITE "FOR TEST DONE ON: "
  333.      SHOW VAR #DATE
  334.      SHOW VAR #TIME
  335.      WRITE "SECONDS FOR THIS RUN: "
  336.      SHOW VAR TIMING
  337.      OUTPUT SCREEN
  338.      
  339.      
  340.      
  341.      
  342.      
  343.      
  344.      
  345.      
  346.      
  347.      
  348.      
  349.      
  350.      
  351.      
  352.      
  353.      
  354.      
  355.      
  356.      
  357.      
  358.      
  359.      
  360.      
  361.      
  362.      
  363.      
  364.      
  365.      
  366.      
  367.      
  368.      
  369.      
  370.      
  371.      
  372.      
  373.      
  374.      
  375.      
  376.      
  377.      
  378.      
  379.      
  380.      
  381.      
  382.      
  383.      
  384.      
  385.      
  386.      
  387.      
  388.      
  389.      
  390.      
  391.      
  392.      
  393.      
  394.      
  395.      
  396.      
  397.      PARSING DEFINED
  398.      
  399.      Throughout the checklists you will find us referring to parsing.  By
  400.      parsing we mean the way R:BASE takes your code, pulls it apart, and
  401.      analyzes it to execute your instructions.  Just as you decide how to write
  402.      your code by choosing from a number of valid alternatives, we have made
  403.      choices about how to parse R:BASE code.  Knowing how R:BASE parses your
  404.      code will help you to write code that executes faster.
  405.      
  406.      
  407.      
  408.      
  409.      SOLUTION:
  410.      
  411.      PROGRAMMING CHECKLIST
  412.      
  413.      []  Group repeating commands
  414.      
  415.      Group repeating commands together.  Grouping all the CHANGE commands,
  416.      ASSIGN commands, SET VARIABLE commands, etc., together will reduce disk I/O
  417.      which is a major time eater.  Whenever the command changes, R:BASE may have
  418.      to go look for the new command processor in the RBASE.OVL file.
  419.      
  420.      []  Use WHILE loops
  421.      
  422.      Eliminate duplication of code by putting repeating blocks of code into a
  423.      WHILE loop.
  424.      
  425.      Use WHILE loops to process your loops instead of IF and GOTO blocks.  The
  426.      entire WHILE...ENDWHILE block of code is parsed before execution and will
  427.      run faster than other looping methods.  The block of code that you are
  428.      going to with your GOTO, by comparison, will be parsed one line at a time,
  429.      and it will be parsed every time the loop is processed.  Parsing takes
  430.      time.
  431.      
  432.      []  Use forward GOTOs
  433.      
  434.      When using a GOTO make sure that the LABEL you are going to is between the
  435.      GOTO and the end of the command file.  If the LABEL is located between the
  436.      top of the command file and its GOTO, R:BASE will search all the way to the
  437.      end of your program and then start over at the beginning to locate the
  438.      LABEL.
  439.      
  440.      []  Put most used block first
  441.      
  442.      If you have a series of IF...ENDIF blocks all stacked in a row, put the
  443.      most used IF block at the top of the stack with a GOTO around the rest of
  444.      the IF blocks.  For example, if the variable CHOICE is usually equal to 300
  445.      but occassionally will equal 400 or 500, then set up the IF blocks with the
  446.      300 choice at the top.
  447.      
  448.      IF CHOICE = 300 THEN
  449.      o
  450.      o
  451.      o
  452.      
  453.      
  454.      
  455.      
  456.      
  457.      
  458.      
  459.      
  460.      
  461.      
  462.      
  463.      GOTO THEEND
  464.      ENDIF
  465.      IF CHOICE = 400 THEN
  466.      o
  467.      o
  468.      o
  469.      GOTO THEEND
  470.      ENDIF
  471.      IF CHOICE = 500 THEN
  472.      o
  473.      o
  474.      o
  475.      ENDIF
  476.      LABEL THEEND
  477.      
  478.      If you are going to a LABEL with the GOTO command, put the most used LABEL
  479.      as close to its GOTO as possible and make sure it is between its GOTO and
  480.      the end of the file.
  481.      
  482.      []  Replace IFs with LABELs
  483.      
  484.      The speed of menu processing can be enhanced by creative use of a GOTO and
  485.      LABEL...GOTO BOTTOM blocks rather than stacked IF blocks.  Simply make the
  486.      label name the same as the menu pick.  For example, if your menu picks are
  487.      A, B, or C:
  488.      
  489.      FILLIN CHOICE USING +
  490.      "Enter Your Choice: "
  491.      GOTO .CHOICE
  492.      LABEL A
  493.      *( "A" block code goes here )
  494.      GOTO BOTTOM
  495.      LABEL B
  496.      *( "B" block code goes here )
  497.      GOTO BOTTOM
  498.      LABEL C
  499.      *( "C" block code goes here )
  500.      GOTO BOTTOM
  501.      LABEL .CHOICE
  502.      WRITE "Not a valid choice"
  503.      QUIT
  504.      LABEL BOTTOM
  505.      
  506.      
  507.      The LABEL .CHOICE command line is necessary as a safety precaution.  If an
  508.      operator presses a key that is not a valid option, you don't want R:BASE
  509.      looking forever for a label that does not exist.
  510.      
  511.      Put the most popular pick at the top.  In this example LABEL A would be the
  512.      most popular pick.
  513.      
  514.      []  Fast posting
  515.      
  516.      There are many different ways to post new information to existing rows in
  517.      existing tables.  The fastest we have tested involves using the report
  518.      
  519.      
  520.      
  521.      
  522.      
  523.      
  524.      
  525.      
  526.      
  527.      
  528.      
  529.      writer to create a file of data that is subsequently loaded to the table.
  530.      
  531.      Assuming that you are posting a transaction table to a master table, you
  532.      would need only three steps.  This method assumes that the master table has
  533.      only one summary row per customer whereas the transaction table may or may
  534.      not have many rows per customer.
  535.      
  536.      First, print a report, into a file, that uses the transaction table as the
  537.      base table and does lookups on the master table.  Have the report create an
  538.      ASCII file that recreates the posted rows in the master table, including
  539.      the unique identifying column (such as IDNO or CUSTNUM) as well as the
  540.      current date in a POSTDATE date column.  The POSTDATE column in the master
  541.      table will identify the most current information.  This way you can use the
  542.      power of the report writer to compute any totals or other calculations that
  543.      need to be completed prior to posting.  Using the report writer makes it
  544.      easy to break on CUSTNUM, for example, and end up printing only one summary
  545.      row for each customer into the file.
  546.      
  547.      Second, load the file created by the report to the master table with the
  548.      command:
  549.      .
  550.      LOAD tbl FROM filename
  551.      
  552.      At this point you each posted master record will have two records when all
  553.      you really want to have is the most current record.  Therefore, as a final
  554.      step, purge the outdated master records by printing another report into
  555.      another file that prints only the most current rows.  Load this final file
  556.      into a new current master table.  Keep the original master table as an
  557.      archive.
  558.      
  559.      The report, for this final step, is done by breaking on CUSTNUM, locating
  560.      all the columns in the table on a line, and then marking the line as a
  561.      break footer.  Print the report with a SORTED BY clause, similar to the
  562.      following, to make sure that the last row in each break is the most current
  563.      row:
  564.      
  565.      PRINT repname SORTED BY CUSTNUM POSTDATE
  566.      
  567.      Because you marked the line as a break footer, only the most current row
  568.      for each customer is printed into the file.
  569.      
  570.      This is an advanced programming concept.  If it seems confusing to you,
  571.      skip it for now.  A future Microrim Technical Note will delve more deeply
  572.      into the whole subject of posting and provide a much more detailed
  573.      explanation.
  574.      
  575.      []  Use table forms
  576.      
  577.      Using table forms is much faster than using variable forms.  See Technical
  578.      Note number EX-3-7 Fast Multi-Screen Forms (category: FORMS and
  579.      subcategory: MULTI-SCREEN) for a way to do multi-screen data entry using
  580.      table forms.
  581.      
  582.      []  Use FILLIN, SHOW VAR, and WRITE instead of variable forms
  583.      
  584.      
  585.      
  586.      
  587.      
  588.      
  589.      
  590.      
  591.      
  592.      
  593.      
  594.      
  595.      You can create forms similar to variable forms with a series of FILLIN
  596.      commands and it may be faster than variable forms.  WRITE and SHOW VAR
  597.      commands can be used to display informational items on the screen.
  598.      
  599.      []  SET CLEAR OFF
  600.      
  601.      Reduce disk I/O by using the SET CLEAR OFF command before using CHANGE,
  602.      ASSIGN, or LOAD commands.  Your application will run faster, but will not
  603.      be as safe, because your changes will be written to the memory buffer and
  604.      not immediately to disk.
  605.      
  606.      The R:BASE 5000 memory buffer will hold up to 1536 characters.  If you have
  607.      a power failure, you could lose quite a bit of data depending on how full
  608.      the buffer is at the time.
  609.      
  610.      []  Use REMOVE to delete all rows
  611.      
  612.      Before doing any deleting or removing make sure you have a current backup.
  613.      If you are deleting all the rows in a large table the following code (that
  614.      removes the table and then recreates it) is faster than using the DELETE
  615.      ROWS command:
  616.      
  617.      OUTPUT TEMP
  618.      UNLOAD SCHEMA FOR tblname
  619.      OUTPUT SCREEN
  620.      REMOVE tblname
  621.      SET ERROR MESSAGE OFF
  622.      INPUT TEMP
  623.      SET ERROR MESSAGE ON
  624.      
  625.      []  CHANGE vs. LOAD
  626.      
  627.      Some people have found that if you are doing multiple changes on a row and
  628.      you have all the column values currently stored in global variables, it may
  629.      be faster to use the following LOAD command method, rather than using
  630.      multiple CHANGE commands:
  631.      
  632.      DEL ROW FROM tblename WHERE...
  633.      SET NULL -0-
  634.      LOAD tbl
  635.      .var1 .var2 .var3 ...etc.
  636.      END
  637.      
  638.      Other people have found the LOAD command method to be slower.  It all
  639.      depends on whether you have SET CLEAR OFF before doing the multiple CHANGE
  640.      commands and then SET CLEAR ON after the CHANGE commands.  With SET CLEAR
  641.      OFF, the mulitple CHANGE commands will probably be faster.
  642.      
  643.      
  644.      
  645.      
  646.      
  647.      
  648.      
  649.      
  650.      
  651.      
  652.      
  653.      
  654.      
  655.      
  656.      
  657.      
  658.      
  659.      
  660.      
  661.      The LOAD process can be significantly speeded up by loading several rows at
  662.      once.  For example, the following code loads three rows at one time
  663.      
  664.      SET NULL -0-
  665.      LOAD tblname
  666.      .var1 .var2 .var3
  667.      .var4 .var5 .var6
  668.      .var7 .var8 .var9
  669.      END
  670.      
  671.      This would be much faster than three separate LOAD blocks.  See the article
  672.      Loading Many Rows From One Form in the March 1986 R:BASE EXCHANGE for a
  673.      detailed example.
  674.      
  675.      []  Keep duplicates out
  676.      
  677.      Use RULES to make sure that duplicates do not get into your table in the
  678.      first place.  DELETE DUPLICATES has to do so much work that it takes a long
  679.      time.  It should never be used on a regular basis.  If you must DELETE
  680.      DUPLICATES, be sure at least one column in the table is keyed and that all
  681.      columns that are keyed contain values (i.e., are not NULL).  Remember that
  682.      DELETE DUPLICATES will only delete duplicates that are an exact match in
  683.      every column this includes case on TEXT columns.  For example, to the
  684.      DELETE DUPLICATES command:
  685.      
  686.      This is a COMMENT
  687.      
  688.      is NOT a match with:
  689.      
  690.      This is a comment
  691.      
  692.      because the case is different on the word comment.
  693.      
  694.      []  Use keys
  695.      
  696.      Using keyed columns can speed up execution enormously.  However, keys can
  697.      slow things down if used to excess and in situations where keys will not
  698.      help.  For example, keys do not speed up sorting but keys do speed up WHERE
  699.      clause searches under certain conditions.
  700.      
  701.      To speed up WHERE clause searches, the keyed column must be the last one
  702.      mentioned in your WHERE clause, must be associated with an EQ (or =)
  703.      operator, and must be preceded by an AND (if there is more than one
  704.      condition in the WHERE clause).
  705.      
  706.      Keys are also used by the relational commands: INTERSECT, UNION, JOIN, or
  707.      SUBTRACT.  When using relational commands, make sure that the common
  708.      columns in the WITH or FROM table are keyed.
  709.      
  710.      The DELETE DUPLICATES command also will use keys.  Make sure one of the
  711.      columns in the table is keyed.
  712.      
  713.      Keys take time to build and maintain and use up a considerable amount of
  714.      disk space.  Therefore, if you will not be using them in one of the above
  715.      situations, do not build them in the first place.  Keys will slow down data
  716.      
  717.      
  718.      
  719.      
  720.      
  721.      
  722.      
  723.      
  724.      
  725.      
  726.      
  727.      entry operations such as LOAD, ENTER, and APPEND because it takes time to
  728.      build them.  Unused keys will slow down the DELETE command because it takes
  729.      time to delete the key.  Keys will also slow down the PACK and RELOAD
  730.      processes.
  731.      
  732.      []  Reduce the number of files
  733.      
  734.      Reduce disk I/O by making small command files into a large one or compile
  735.      them as blocks in an R:BASE binary procedure file by using RCOMPILE.
  736.      
  737.      []  Set buffers higher
  738.      
  739.      If you have enough spare memory, you can increase the size of your
  740.      computer's memory buffer and perhaps improve the speed.  Each buffer uses
  741.      528 bytes of memory.  You need to add the following command line to your
  742.      CONFIG.SYS file on your DOS booter disk or on the root directory of your
  743.      hard disk:
  744.      
  745.      SET BUFFERS=16
  746.      
  747.      Without the SET BUFFERS command, your computer will use the default of two
  748.      buffers.
  749.      
  750.      This does not increase the size of the R:BASE memory buffer used by the SET
  751.      CLEAR command, but it will allow larger portions of the overlay file
  752.      RBASE.OVL to be read into memory.  Hopefully this will reduce the number of
  753.      times R:BASE will have to go to the disk to read the overlay file.
  754.      
  755.      []  Use RUN instead of GOTO
  756.      
  757.      If you have several subroutines that make up your program, using the RUN
  758.      command to run the various subroutines will probably be faster than going
  759.      to a LABEL with a GOTO command.  The GOTO will have to look through your
  760.      entire program for its LABEL whereas the RUN will be able to quickly find
  761.      the appropriate $COMMAND block or file on your disk.
  762.      
  763.      []  Use SET POINTER wisely
  764.      
  765.      When used correctly, the SET POINTER command can increase the speed of your
  766.      application.  Use SET POINTER when you are going to be doing multiple
  767.      commands on a multiple rows in a table and you are not using keyed access.
  768.      
  769.      For example, if you have 30 columns in the table and you want to load each
  770.      column into a variable, you will need to process 30 SET VARIABLE commands
  771.      for each row of data in your table.  Therefore, it is wise to first set up
  772.      a pointer to that row and then use the NEXT command in a WHILE loop to step
  773.      through your table.
  774.      
  775.      If, however, you are using keyed access, using the SET POINTER command will
  776.      not increase your speed.  In a test we did where 45 variables were set to
  777.      45 columns in a table, we found the SET POINTER command was no faster then
  778.      using keyed access.  To enable keyed access you simply put a keyed column
  779.      into a WHERE clause and use the EQ operator.  For example, the following
  780.      code uses keyed access to find the desired row.
  781.      
  782.      
  783.      
  784.      
  785.      
  786.      
  787.      
  788.      
  789.      
  790.      
  791.      
  792.      
  793.      SET VAR VCOL1 TO COL1 IN tblname WHERE keycolname EQ value
  794.      SET VAR VCOL2 TO COL2 IN tblname WHERE keycolname EQ value
  795.      SET VAR VCOL3 TO COL3 IN tblname WHERE keycolname EQ value
  796.      SET VAR VCOL4 TO COL4 IN tblname WHERE keycolname EQ value
  797.      o
  798.      o
  799.      o
  800.      
  801.      Determine if you can accomplish what you want without having to go row by
  802.      row through the data.  The ASSIGN command and the relational commands work
  803.      on the entire database all at once.  They are much faster than going row by
  804.      row through the table with the SET POINTER command.  The ASSIGN command is
  805.      often as much as 20 times faster than doing the same thing by going row by
  806.      row through the table.  If you are, for example, adding two columns
  807.      together to store in a third column, use the ASSIGN command, not the SET
  808.      POINTER command.
  809.      The INTERSECT command is also quite fast when the common columns (in the
  810.      WITH table) are keyed.   Some people find the JOIN...WHERE EQ command to be
  811.      faster than the INTERSECT command because of the way these commands are
  812.      parsed.
  813.      
  814.      Use the SET VAR command instead of the SET POINTER command to check for the
  815.      existence of a value and remember to build a key on the column you are
  816.      checking in the WHERE clause.  For example:
  817.      
  818.      SET VAR ISTHERE TO colname IN tblname WHERE colname = .varname
  819.      IF ISTHERE FAILS THEN
  820.         *( the value you are checking does not exist)
  821.      ENDIF
  822.      
  823.      
  824.      []  Implicitly type variables
  825.      
  826.      By using implicit data typing, you may be able to reduce the number of
  827.      lines of code.  By implicit we mean setting the variable to a value and
  828.      letting R:BASE assign the datatype, as opposed to explicit data typing
  829.      where you issue a command such as:
  830.      
  831.      SET VARIABLE NUM INTEGER
  832.      SET VARIABLE LETTER TEXT
  833.      
  834.      Implicit data typing can be done with commands such as the following:
  835.      
  836.      SET VARIABLE NUM TO 12
  837.      SET VARIABLE LETTER TO A
  838.      
  839.      In some cases it is necessary to explicitly type variables, especially when
  840.      both number and letter values are valid entries for a variable.
  841.      
  842.      []  SET RULES OFF when not needed
  843.      
  844.      Setting rule checking off can provide significant speed improvement if you
  845.      have a large number of rules in your database.  When using the LOAD,
  846.      CHANGE, EDIT, ENTER or ASSIGN commands, and you are certain that rules will
  847.      not be violated, SET RULES OFF so that R:BASE will not do automatic rule
  848.      
  849.      
  850.      
  851.      
  852.      
  853.      
  854.      
  855.      
  856.      
  857.      
  858.      
  859.      checking.  This applies even if you are working with a table that has no
  860.      associated rules.  We suggest that you SET RULES OFF at the top of every
  861.      command file and then set them back on only when you need them.  With rules
  862.      set off, R:BASE does not have to constantly be checking the RULES table.
  863.      
  864.      []  Use relational commands wisely
  865.      
  866.      Use relational commands carefully.  If you are doing a UNION on two tables
  867.      that have a many-to-many relationship and several common columns, you will
  868.      wait a long time.  You have given the computer a very big job to do.
  869.      Multiply the number of rows in the first table by the number of rows in the
  870.      second and you can see that R:BASE has to make a lot of comparisons.  You
  871.      might want to consider redesigning so that you can use the JOIN...WHERE EQ,
  872.      INTERSECT, or SUBTRACT commands instead of the UNION command.
  873.      
  874.      The fastest relational operation is the JOIN...WHERE EQ.  This command does
  875.      exactly the same thing as the INTERSECT command, but it does it faster.
  876.      Make sure the common column (that the WITH table is using) is keyed.  When
  877.      you use the JOIN...WHERE EQ command, your common column must not have the
  878.      same name, so if your common column is spelled the same in both tables, its
  879.      best to use the INTERSECT command or rename the common column in one of the
  880.      tables with the RENAME command.  Note also that the JOIN command uses only
  881.      one common column whereas the INTERSECT command can have many common
  882.      columns.
  883.      
  884.      
  885.      POST PROGRAMMING CHECKLIST
  886.      
  887.      []  Abbreviate commands
  888.      
  889.      Wherever possible, abbreviate commands and command words to their shortest
  890.      unique representation.  This will speed execution because R:BASE must parse
  891.      each character in your commands.  The fewer the number of characters, the
  892.      less work R:BASE has to do.
  893.      
  894.      In most cases commands can be abbreviated to three letters.  There are six
  895.      exceptions: PROMPT, PROJECT, ENDIF, and ENDWHILE all require a minimum of
  896.      four letters; LABEL must be completely spelled out with all five letters;
  897.      and VARIABLE may be shortened to the single letter V.  Examples:
  898.      
  899.      SET VARIABLE becomes SET V
  900.      WHILE...THEN becomes WHI...THE
  901.      REMOVE becomes REM
  902.      SORTED BY becomes SOR BY
  903.      WHERE becomes WHE
  904.      PROJECT becomes PROJ
  905.      CLEAR becomes CLE
  906.      CHANGE COLUMN becomes CHA COL
  907.      EDIT USING becomes EDI USI
  908.      OUTPUT PRINTER becomes OUT PRI
  909.      
  910.      We do not abbreviate in Microrim Technical Notes for the sake of clarity.
  911.      You will want to have a version of your program without abbreviations and
  912.      complete with multiple comments to ease any modifications necessary at a
  913.      later date.
  914.      
  915.      
  916.      
  917.      
  918.      
  919.      
  920.      
  921.      
  922.      
  923.      
  924.      
  925.      
  926.      []  Reduce number of lines
  927.      
  928.      R:BASE parses one physical line of code at a time so in addition to
  929.      grouping like commands, put as many as possible on one physical line using
  930.      semicolons to separate them.
  931.      
  932.      The only exceptions are WHILE loops (including all the commands between the
  933.      WHILE...THEN line and the ENDWHILE line), the RUN and INPUT commands, and
  934.      IF blocks (including all the commands between the IF...THEN line and the
  935.      ENDIF line).  All the command lines in these exceptions need to be on their
  936.      own physical line.
  937.      
  938.      In all other cases, put as many commands on one physical line as possible.
  939.      For example, if you are initializing a series of 26 variables to the letter
  940.      A using the SET VARIABLE command, try to put as many on one 80-column line
  941.      as possible.  If all 28 variable names were seven characters long, you
  942.      could fit four SET V varname TO A commands on one physical line by
  943.      separating them with the semicolon (;).  You do not need to put a space on
  944.      either side of the semicolon.  Your seven physical lines containing four
  945.      commands each will execute faster than 28 physical lines of code.
  946.      
  947.      You can also reduce the number of lines by removing all the comments in
  948.      your programs.  Be careful, however, that you keep the original version
  949.      with all the comments, no abbreviations, and only one command per line for
  950.      documentation and to make revision easier.
  951.      
  952.      
  953.      OPERATIONS CHECKLIST
  954.      
  955.      []  Set up good operations
  956.      
  957.      Set up your operational system so that long processes can be done
  958.      unattended over night.  Examples of long processes include: printing a long
  959.      report, building keys on large tables, reloading, packing, relational
  960.      commands, etc.
  961.      
  962.      []  Use work table
  963.      
  964.      You can speed up data entry by entering the day's work into a separate work
  965.      table that has no keyed columns.  Then, at the end of the day, have a
  966.      command file go through the input table to do any further error checking.
  967.      Finally, APPEND the input table to the master table.  Because the master
  968.      table does have the appropriate columns keyed, the APPEND command will
  969.      automatically build the necessary keys.  This will prevent your data entry
  970.      operator from having to wait for the keys to be built between rows entered.
  971.      
  972.      Overall, you will not save time because the APPEND with keys will use any
  973.      time saved.  However, it will seem to the operator that the application is
  974.      running much faster.  This method works especially well when entering short
  975.      rows into a large table.  If you have long rows, it is not so critical.
  976.      
  977.      
  978.      MEMORY & HARDWARE CHECKLIST
  979.      
  980.      
  981.      
  982.      
  983.      
  984.      
  985.      
  986.      
  987.      
  988.      
  989.      
  990.      
  991.      []  Use a RAM disk
  992.      
  993.      If you have enough memory, install a RAM disk and copy the RBASE.OVL file
  994.      to the RAM disk each time you turn on your computer.  Include the drive
  995.      designator for the RAM disk as the first item in the DOS search path with
  996.      the DOS PATH command.  Also, it is a good idea to rename your original file
  997.      to RBASE.OLD and then copy it to the RAM disk as RBASE.OVL.  This way you
  998.      will never have to worry about which one is being executed.
  999.      
  1000.      Do not use a RAM disk if you have only 640K bytes of memory and you are
  1001.      sorting in your application.  Using a RAM disk in this case will actually
  1002.      slow down your appliction because the sorts will not be able to use the
  1003.      extra 64K normally available.
  1004.      
  1005.      []  Upgrade your hardware
  1006.      
  1007.      If you can upgrade your hardware, you may see a dramatic increase in speed.
  1008.      The IBM PC-AT, the COMPAQ 286, and other PC-AT compatible computers are
  1009.      considered to be among the fastest.  Some people have realized as much as a
  1010.      500 percent increase in speed from their old systems.
  1011.      
  1012.      Turbo cards can help improve speed.  Make sure you test it with R:BASE
  1013.      before buying it.
  1014.      
  1015.      However, be careful not to just get a 286 board for your PC.  All this will
  1016.      do is make your memory look like an AT.  This may not increase your speed.
  1017.      The actual PC-AT is faster because of the improved disk I/O and faster
  1018.      clock speed.  It can pass twice as much information to and from the disk
  1019.      drives in the same amount of time because it has a 16 bit bus whereas your
  1020.      PC has only an eight bit bus and because the drives on the PC-AT are
  1021.      faster.
  1022.      
  1023.      Other hardware improvements are the new one, two, and three-megabyte memory
  1024.      boards.  With these you can set up a huge RAM disk and put your RBASE.OVL
  1025.      file in it as well as your application programs and your database.  With
  1026.      disk access eliminated, you may see a dramatic increase in speed.
  1027.      
  1028.      
  1029.      
  1030.      
  1031.      
  1032.      
  1033.      
  1034.      
  1035.      
  1036.      
  1037.      
  1038.      
  1039.      
  1040.      
  1041.      
  1042.      
  1043.      
  1044.      
  1045.      
  1046.      
  1047.      
  1048.      
  1049.      
  1050.      
  1051.      
  1052.      
  1053.      
  1054.      
  1055.      
  1056.      
  1057.      
  1058.      
  1059.      
  1060.      
  1061.      MICRORIM TECHNICAL NOTE
  1062.      __________________________________________________________________________
  1063.      
  1064.      PRINTING REPORTS WITH MONTHLY SUBTOTALS BASED ON DATE COLUMN
  1065.      
  1066.      DATE      :  04/86                   NUMBER       :  EX-4-3
  1067.      PRODUCT   :  R5K                     VERSIONS     :  1.01
  1068.      CATEGORY  :  REPORTS                 SUBCATEGORY  :  MONTHLY TOTALS
  1069.      
  1070.      __________________________________________________________________________
  1071.      
  1072.      DESCRIPTION:   I want a report that gives me subtotals by month, but I do
  1073.      not have a text column MONTH in my database.  Instead, I have a date column
  1074.      TRANDATE with the actual transaction date in it.  How can I get the report
  1075.      I need?
  1076.      
  1077.      
  1078.      
  1079.      
  1080.      EXPLANATION:   The R:BASE report writer will break on an entire column.
  1081.      Getting subtotals by day on your date column would be easy.  If you had a
  1082.      text type MONTH column which contained the name or the number of the month,
  1083.      it would be easy to break on MONTH to get the monthly subtotals you need.
  1084.      However, to do monthly subtotals based on a date column requires some
  1085.      further manipulation.
  1086.      
  1087.      
  1088.      
  1089.      
  1090.      SOLUTION:   Follow these steps to modify your report so that it will
  1091.      subtotal by month based on a date column:
  1092.      
  1093.      STEP ONE
  1094.      
  1095.      Using the DEFINE command, set up a special lookup table MNAMES with the two
  1096.      columns FIRSTDAY and MONTH by using the following series of commands:
  1097.      
  1098.      DEFINE dbname
  1099.      COLUMNS
  1100.      FIRSTDAY  DATE
  1101.      MONTH  TEXT  9
  1102.      TABLES
  1103.      MNNAMES WITH FIRSTDAY MONTH
  1104.      END
  1105.      
  1106.      STEP TWO
  1107.      
  1108.      You will need a row for every month that is (or will be) in your data.
  1109.      Therefore, the first step is to determine all the months that will ever be
  1110.      in your data.
  1111.      
  1112.      
  1113.      
  1114.      
  1115.      
  1116.      
  1117.      
  1118.      
  1119.      
  1120.      
  1121.      
  1122.      
  1123.      The example presented here assumes a range of dates from November 1985
  1124.      through December 1986.  The next step is to enter the rows one month at a
  1125.      time starting with the highest (that is the latest) date.  For this
  1126.      example, the latest date is December 1986.  You need to enter the first day
  1127.      of the month into the FIRSTDAY column and the name of the month into the
  1128.      MONTH column.  Be sure to always enter 01 for the day portion of the
  1129.      FIRSTDAY date column, 12/01/86, 11/01/86, etc.
  1130.      
  1131.      Using the LOAD WITH PROMPTS command, enter data into the MNAMES lookup
  1132.      table starting with the latest month and working back to the earliest month
  1133.      in your range.  The order of data entry is very important.
  1134.      
  1135.      When you get finished, your MNAMES table should look like the listing on
  1136.      page two.
  1137.      
  1138.      
  1139.      
  1140.      
  1141.      
  1142.      
  1143.      
  1144.      
  1145.      
  1146.      
  1147.      
  1148.      
  1149.      
  1150.      
  1151.      
  1152.      
  1153.      
  1154.      
  1155.      
  1156.      
  1157.      
  1158.      
  1159.      
  1160.      
  1161.      
  1162.      
  1163.      
  1164.      
  1165.      
  1166.      
  1167.      
  1168.      
  1169.      
  1170.      
  1171.      
  1172.      
  1173.      
  1174.      
  1175.      
  1176.      
  1177.      
  1178.      
  1179.      
  1180.      
  1181.      
  1182.      
  1183.      
  1184.      
  1185.      
  1186.      
  1187.      
  1188.      
  1189.      
  1190.      FIRSTDAY  MONTH
  1191.      --------  ---------
  1192.      12/01/86  DECEMBER
  1193.      11/01/86  NOVEMBER
  1194.      10/01/86  OCTOBER
  1195.      09/01/86  SEPTEMBER
  1196.      08/01/86  AUGUST
  1197.      07/01/86  JULY
  1198.      06/01/86  JUNE
  1199.      05/01/86  MAY
  1200.      04/01/86  APRIL
  1201.      03/01/86  MARCH
  1202.      02/01/86  FEBRUARY
  1203.      01/01/86  JANUARY
  1204.      12/01/85  DECEMBER
  1205.      11/01/85  NOVEMBER
  1206.      
  1207.      Notice the order the rows are in.  The highest date 12/01/86 was entered
  1208.      first followed by the next highest 11/01/86 and so on down the list of
  1209.      possibilities.  The rows in the MNAMES table must always be in this
  1210.      physical sequence and there must be a row for every possible month.
  1211.      
  1212.      STEP THREE
  1213.      
  1214.      Using the REPORTS command, go into the define mode and define a lookup
  1215.      variable VMONTH.  Assuming TRANDATE is the name of the date column in your
  1216.      original table, your variable definition will look like this:
  1217.      
  1218.      VMONTH = MONTH IN MNAMES WHERE FIRSTDAY LE TRANDATE
  1219.      
  1220.      Pay special attention to the WHERE clause; it is the key to why this method
  1221.      works.  VMONTH will only change when the month changes because the lookup
  1222.      feature in the report writer finds the first row, and only the first row,
  1223.      that satisfies the WHERE clause.
  1224.      
  1225.      For example, when the month changes from January to February, the report
  1226.      writer will find only the first occurrence of a FIRSTDAY date that is less
  1227.      than or equal to the February TRANDATE.  That first occurrence is 02/01/86.
  1228.      Even though the rows following 02/01/86 have FIRSTDAY values of 01/01/86,
  1229.      12/01/85, and 11/01/85 (which are also less than a February date) they are
  1230.      not found because the report writer will only find the first occurrence.
  1231.      This is why the order of the rows in the special lookup table is so
  1232.      important.
  1233.      
  1234.      STEP FOUR
  1235.      
  1236.      While still in define mode, define the subtotal variable VTOTAMT to be the
  1237.      accumulator for the column you want to total for each month.  If, for
  1238.      example, the column you want to total is AMOUNT, your subtotal variable
  1239.      would be defined as follows:
  1240.      
  1241.      VTOTAMT = VTOTAMT + AMOUNT
  1242.      
  1243.      STEP FIVE
  1244.      
  1245.      
  1246.      
  1247.      
  1248.      
  1249.      
  1250.      
  1251.      
  1252.      
  1253.      
  1254.      
  1255.      
  1256.      Go into locate mode of REPORTS and locate VMONTH and VTOTAMT on the line
  1257.      where you want your subtotals to print.  Next, go into mark mode and set up
  1258.      a break on the lookup variable VMONTH.  When prompted to add to the reset
  1259.      list, add the VTOTAMT variable.  Finally, mark the line where VMONTH and
  1260.      VTOTAMT are located as a break footer.
  1261.      
  1262.      STEP SIX
  1263.      
  1264.      As the final step, remember to include a SORTED BY clause on the PRINT
  1265.      command to sort by the TRANDATE column.  When breaking on a variable the
  1266.      table is not automatically sorted as it is when breaking on a column.
  1267.      Therefore, use the following command to print the report:
  1268.      
  1269.      PRINT repname SORTED BY TRANDATE
  1270.      
  1271.      
  1272.      
  1273.      
  1274.      
  1275.      
  1276.      
  1277.      
  1278.      
  1279.      
  1280.      
  1281.      
  1282.      
  1283.      
  1284.      
  1285.      
  1286.      
  1287.      
  1288.      
  1289.      
  1290.      
  1291.      
  1292.      
  1293.      
  1294.      
  1295.      
  1296.      
  1297.      
  1298.      
  1299.      
  1300.      
  1301.      
  1302.      
  1303.      
  1304.      
  1305.      
  1306.      
  1307.      
  1308.      
  1309.      
  1310.      
  1311.      
  1312.      
  1313.      
  1314.      
  1315.      
  1316.      
  1317.      
  1318.      
  1319.      
  1320.      
  1321.      
  1322.      
  1323.      
  1324.      
  1325.      MICRORIM TECHNICAL NOTE
  1326.      __________________________________________________________________________
  1327.      
  1328.      EXPRESS AND MACROS
  1329.      
  1330.      DATE      :  04/86                   NUMBER       :  EX-4-5
  1331.      PRODUCT   :  R5K                     VERSIONS     :  1.01
  1332.      CATEGORY  :  EXPRESS                 SUBCATEGORY  :  ADDING A MACRO
  1333.      
  1334.      __________________________________________________________________________
  1335.      
  1336.      DESCRIPTION:   My EXPRESS application has been working fine, but now I want
  1337.      to make a change to it using option 4 in EXPRESS.  When I do this I get the
  1338.      following error message when EXPRESS tries to read it in:
  1339.      
  1340.      "I/O error - check for full disk"
  1341.      
  1342.      
  1343.      
  1344.      
  1345.      
  1346.      EXPLANATION:   You previously added a macro to your application that had a
  1347.      $COMMAND (all capital letters) line in it.  Macros added to EXPRESS
  1348.      applications must NOT have $COMMAND already in them because EXPRESS adds
  1349.      the $COMMAND line itself.  When there are two $COMMAND lines in a row and
  1350.      EXPRESS tries to read the application back in for further changes, the .API
  1351.      file is damaged beyond repair.  You cannot use EXPRESS to edit the
  1352.      application again.
  1353.      
  1354.      
  1355.      
  1356.      
  1357.      SOLUTION:   You still have the .APP file, so your application is not lost.
  1358.      To make further changes to it, however, you will need to edit the .APP file
  1359.      with RBEDIT or another editor and then recompile it using RCOMPILE to make
  1360.      the new .APX file.
  1361.      
  1362.      In the future, make sure that any macro you pull into EXPRESS does not
  1363.      contain the $COMMAND line.
  1364.      
  1365.      
  1366.      
  1367.      
  1368.      
  1369.      
  1370.      
  1371.      
  1372.      
  1373.      
  1374.      
  1375.      
  1376.      
  1377.      
  1378.      
  1379.      
  1380.      
  1381.      
  1382.      
  1383.      
  1384.      
  1385.      
  1386.      
  1387.      
  1388.      
  1389.      
  1390.      
  1391.      MICRORIM TECHNICAL NOTE
  1392.      __________________________________________________________________________
  1393.      
  1394.      WHAT INFO TO COLLECT WHEN TROUBLESHOOTING R5K MULTI-USER
  1395.      
  1396.      DATE      :  04/86                   NUMBER       :  EX-4-6
  1397.      PRODUCT   :  R5K                     VERSIONS     :  1.01
  1398.      CATEGORY  :  MULTI-USER              SUBCATEGORY  :  TROUBLE SHOOTING
  1399.      
  1400.      __________________________________________________________________________
  1401.      
  1402.      DESCRIPTION:   I support R:BASE 5000 Multi-user sites.  When one of my
  1403.      users has a problem, what kinds of information should I collect to help me
  1404.      troubleshoot the problem?
  1405.      
  1406.      
  1407.      
  1408.      
  1409.      EXPLANATION:   Local area networks (LANs) are much more complex for users
  1410.      to install, maintain, and operate than a single-user microcomputer.  Often
  1411.      the problems being experienced can be traced to the complexity of the
  1412.      network.  All networks need to have a person assigned as the System
  1413.      Administrator who knows:
  1414.      
  1415.        o  The exact names and version numbers of all network software.
  1416.        o  How to set up the network hardware and the network software.
  1417.        o  How to maintain the network hardware/software.
  1418.        o  Who your network hardware and software manfacturers' contacts and
  1419.        technical support personnel are.
  1420.        o  How the network works and what all the pieces do.
  1421.      
  1422.      If you do not have someone like this you may need to get some training from
  1423.      the network hardware and network software manufacturers or dealers before
  1424.      attempting to implement R:BASE 5000 Multi-user.
  1425.      
  1426.      
  1427.      
  1428.      
  1429.      SOLUTION:   Use the following questionnaire to help you gather the
  1430.      information you will need to effectively trouble shoot multi-user problems.
  1431.      :
  1432.      
  1433.      Q.    What version of R:BASE 5000 Multi-user are you using?
  1434.      
  1435.            Make sure that it is the correct version for the network hardware and
  1436.            software that they are using.
  1437.      
  1438.      Q.    What verison of DOS are you using?
  1439.      
  1440.            It must be version 3.1
  1441.      
  1442.      
  1443.      
  1444.      
  1445.      
  1446.      
  1447.      
  1448.      
  1449.      
  1450.      
  1451.      
  1452.      
  1453.      Q.    What network hardware are you using?  What network software are you
  1454.          using?  Are they officially supported by Microrim?  If the network
  1455.          software is supported, is the version of the network software
  1456.          supported?  If your network software/hardware is not officially
  1457.          supported by Microrim, does it support PC DOS 3.1 and the IBM NETBIOS?
  1458.          Are all stations using the same version of the network software?
  1459.      
  1460.      
  1461.            If your hardware/software combination is not officially supported,
  1462.            R:BASE 5000 Multi-user may still work if your network system supports
  1463.            PC DOS 3.1 and IBM NETBIOS.
  1464.      
  1465.            Carefully check to make sure that all stations in the network are
  1466.            using the same versions of the network software and the same versions
  1467.            of R:BASE 5000.
  1468.      
  1469.      Q.    How many stations are there on the network?  What is the
  1470.          configuration (memory, autoexec.bat file, type of computer, type of
  1471.          hard disk, etc.) of each station?  How is the path for each station
  1472.          set?  Do any of the machines have a high speed crystal?  Are you using
  1473.          a math coprocessor chip or any other special hardware, boards, etc.?
  1474.      
  1475.            This is basic background information.  Any one of these elements may
  1476.            be causing the problem; you can experiment and perhaps determine the
  1477.            culprit station, component, or software product.
  1478.      
  1479.      Q.    Is the file server an IBM PC-AT or 100% compatible?  If a compatible,
  1480.          what machine is it?  Does it have a minimum of 640K?  What are the file
  1481.          handles equal to on the server?  Are any special (other than default)
  1482.          parameters issued when the network is started?
  1483.      
  1484.            Unless you are using the IBM PC Network, the file server must be
  1485.            dedicated to being only a file server; there is not enough memory to
  1486.            do anything else.  The server must be an IBM PC-AT or 100% compatible
  1487.            and it must have a minimum of 640K with file handles set between 60
  1488.            and 100.   Check to make sure that the users know how to set up the
  1489.            file handles by putting FILES=100 (or whatever number) in the
  1490.            CONFIG.SYS file and rebooting.
  1491.      
  1492.      Q.    What was each station on the network doing at the time of the
  1493.          failure?  Are any DOS, network, or R:BASE error messages displayed?
  1494.          What is the exact wording of all the error messages you are getting?
  1495.      
  1496.      Q.    Are any locks being manually set in R:BASE 5000?
  1497.      
  1498.            If the user is setting up locks, they may not understand that default
  1499.            locking in R:BASE 5000 usually makes this unnecessary.
  1500.      
  1501.      Q.    Is the R:BASE program, command file, or macro (that is being run)
  1502.          shared or is it being used locally?.  Is it being run from the file
  1503.          server or from a workstation?
  1504.      
  1505.            This may tell you whether it is a problem related to the entire
  1506.            network or exclusive to only one machine.
  1507.      
  1508.      
  1509.      
  1510.      
  1511.      
  1512.      
  1513.      
  1514.      
  1515.      
  1516.      
  1517.      
  1518.      
  1519.      Q.    If the failure occurs during execution of an R:BASE 5000 application,
  1520.          what command is being executed at the time of the failure?  Does the
  1521.          failure occur consistently in the same place?  What error messages are
  1522.          displayed?
  1523.      
  1524.      Q.    How many people typically are on the network?  How many people
  1525.          typically are in the database?  Is it normal for more than one person
  1526.          to be working in the same database and in the same table at the same
  1527.          time, or is this an unusual occurance?
  1528.      
  1529.            This basic information about your environment will help you to
  1530.            recreate a problem by recreating the environment in which the problem
  1531.            occurred.
  1532.      
  1533.      Collecting all this information will give you a more complete picture of
  1534.      the problem and whether you have a debugging or a network fixing job to do.
  1535.      
  1536.      
  1537.      
  1538.      
  1539.      
  1540.      
  1541.      
  1542.      
  1543.      
  1544.      
  1545.      
  1546.      
  1547.      
  1548.      
  1549.      
  1550.      
  1551.      
  1552.      
  1553.      
  1554.      
  1555.      
  1556.      
  1557.      
  1558.      
  1559.      
  1560.      
  1561.      
  1562.      
  1563.      
  1564.      
  1565.      
  1566.      
  1567.      
  1568.      
  1569.      
  1570.      
  1571.      
  1572.      
  1573.      
  1574.      
  1575.      
  1576.      
  1577.      
  1578.      
  1579.      
  1580.      
  1581.      
  1582.      
  1583.      
  1584.      
  1585.      
  1586.      
  1587.      
  1588.      
  1589.      MICRORIM TECHNICAL NOTE
  1590.      __________________________________________________________________________
  1591.      
  1592.      MARKING YOUR REPORT TO GET IT TO PRINT THE WAY YOU WANT IT
  1593.      
  1594.      DATE      :  04/86                   NUMBER       :  EX-4-7
  1595.      PRODUCT   :  R5K                     VERSIONS     :  1.01
  1596.      CATEGORY  :  REPORTS                 SUBCATEGORY  :  MARKING AND PRINTING
  1597.      
  1598.      __________________________________________________________________________
  1599.      
  1600.      DESCRIPTION:   My report will not print out the way I told it to print out.
  1601.      I located all the columns and variables that I want to print using the [S]
  1602.      and [E] keys, but it will not print.  What is wrong?
  1603.      
  1604.      
  1605.      
  1606.      
  1607.      EXPLANATION:   A mandatory step in creating a report is to mark the report.
  1608.      Either you skipped this step or you need to change the way you did it.
  1609.      
  1610.      MARK MODE FUNCTIONS
  1611.      
  1612.      You enter mark mode in the report writer by pressing [M] from the main
  1613.      menu.  In mark mode you can do all of the following:
  1614.      
  1615.        o  Set up breaks to print subtotals and/or organize your data into groups
  1616.        and subgroups.
  1617.        o  Designate which variables are to be reset to zero at break time.
  1618.        o  Mark each line in your report that either contains an S...E location,
  1619.        is to be printed as a blank line, or is text information (such as the
  1620.        name of the report and other descriptive informtion).  In other words,
  1621.        mark all the lines that you want to print on your report.
  1622.      
  1623.      MARKING RULES
  1624.      
  1625.      There are several rules relating to report markings that you will want to
  1626.      keep in mind:
  1627.      
  1628.        o  Lines that are not marked will not be printed.
  1629.        o  Note that it is NOT necessary to mark all 66 lines.  You need only
  1630.        mark those lines that are to be printed.  If, for example, you have only
  1631.        used 10 lines of the possible 66 lines for your report, you will only
  1632.        need to mark 10 lines.  The only time you would mark a blank line, is
  1633.        when you want to print a blank line or you want the detail in your report
  1634.        to be double or triple spaced.    A line marked with a D will print as
  1635.        many rows of data as will fit into the pagesize you have selected with
  1636.        the (S)et option on the main menu.
  1637.        o  Reports print marked lines in a certain order only.  Report headings
  1638.        (HR) are always printed first, then the page headings (HP), followed by
  1639.        the break headings (H1, H2, etc.), next come the detail lines (D), then
  1640.      
  1641.      
  1642.      
  1643.      
  1644.      
  1645.      
  1646.      
  1647.      
  1648.      
  1649.      
  1650.      
  1651.        the break footings (F2, F1), then the page footings (FP), and finally the
  1652.        report footings (FR).  If any one of the items is not included, the order
  1653.        of those that remain is still maintained.  Here are samples of acceptable
  1654.        markings:
  1655.      
  1656.        HP      HR      HR      HR      HR      HR
  1657.        D       D       HP      HP      HP      HP
  1658.        FP      FR      D       H1      H1      H1
  1659.                        D       H1      H2      H2
  1660.                        F1      D       D       H3
  1661.                        F1      F1      F2      D
  1662.                        HR      FP      F1      F3
  1663.                                FR      FP      F1
  1664.                                        FR      FP
  1665.                                                FR
  1666.      
  1667.        Here are more perfectly acceptable report markings:
  1668.      
  1669.        D       HR      HR      HR      HR      HR
  1670.        FP      D       HP      HR      HP      HP
  1671.                FP      D       F1      H1      H1
  1672.                FR              F1      F3      H2
  1673.                                        F2      D
  1674.                                        FP
  1675.      
  1676.        o  Unless a report has at least one detail line (D) or break (H1 or F1)
  1677.        marked, the report will not print correctly.  Instead, if you are sending
  1678.        the report to the screen, you will get the message:
  1679.      
  1680.      More output follows - press [ESC] to quit, any key to continue
  1681.      
  1682.        If you are printing the report to the printer, the most likely symptom is
  1683.        to see page after page being ejected.  Working around this is easy.  All
  1684.        you need to do is have at least one break in the report.  You can, for
  1685.        example, break on a constant report variable.  You do not need to print
  1686.        the break variable.
  1687.      
  1688.        o  Reports will not let you skip lines between markings of the same type
  1689.        nor will it allow you to split a group of like markings.
  1690.      
  1691.        For example, the following markings are not allowed:
  1692.      
  1693.        HR      HR      HR
  1694.        HP      HP      HP
  1695.        D       D       H1
  1696.        H1              D
  1697.        F1      D       F1
  1698.        D       FP      FP
  1699.        FP      FR      F1
  1700.        FR              FR
  1701.      
  1702.        o  Summary reports that do not have detail lines (D) or break headers
  1703.        (H1, H2, etc.) but that do have break footers (F1, F2, etc.) will not
  1704.        print the page headers on the first page of the report.
  1705.      
  1706.      
  1707.      
  1708.      
  1709.      
  1710.      
  1711.      
  1712.      
  1713.      
  1714.      
  1715.      
  1716.      
  1717.        The following sample markings will prevent the page header from being
  1718.        printed on the first page:
  1719.      
  1720.        HR      HP      HR      HR      HR
  1721.        HP      F2      HP      HP      HP
  1722.        F1      F1      F2      F3      F2
  1723.        FP      FP      F1      F2      F1
  1724.        FR              FP      F1      FR
  1725.                        FR      FR      FR
  1726.                                FR
  1727.      
  1728.        If you want the page header to print on the first page there are two
  1729.        methods you can use.  You can repeat the page header text in the report
  1730.        header as well as also defining the page header.  In this way, the report
  1731.        header is printed only once on the first page of the report and it will
  1732.        now include the page header.  The alternate solution is to include one
  1733.        blank break header line (H1).  This will allow the page header to print
  1734.        on the first page, and will add only one blank line for each time the
  1735.        break level breaks.
  1736.      
  1737.      
  1738.      
  1739.      
  1740.      
  1741.      SOLUTION:   Mark every line of your report paying close attention to the
  1742.      rules presented above.
  1743.      
  1744.      
  1745.      
  1746.      
  1747.      
  1748.      
  1749.      
  1750.      
  1751.      
  1752.      
  1753.      
  1754.      
  1755.      
  1756.      
  1757.      
  1758.      
  1759.      
  1760.      
  1761.      
  1762.      
  1763.      
  1764.      
  1765.      
  1766.      
  1767.      
  1768.      
  1769.      
  1770.      
  1771.      
  1772.      
  1773.      
  1774.      
  1775.      
  1776.      
  1777.      
  1778.      
  1779.      
  1780.      
  1781.      
  1782.      
  1783.      
  1784.      
  1785.      
  1786.      
  1787.      MICRORIM TECHNICAL NOTE
  1788.      __________________________________________________________________________
  1789.      
  1790.      SEQUENTIALLY NUMBERING WITHIN SUBGROUPS
  1791.      
  1792.      DATE      :  04/86                   NUMBER       :  EX-4-8
  1793.      PRODUCT   :  R5K                     VERSIONS     :  1.01
  1794.      CATEGORY  :  AUTONUM                 SUBCATEGORY  :  NUMBERS IN GROUPS
  1795.      
  1796.      __________________________________________________________________________
  1797.      
  1798.      DESCRIPTION:   I want to sequentially number the rows within each subgroup
  1799.      in my transaction table.  For example, I want to store a number in a SUBNUM
  1800.      column that starts at 1 for each customer.  I want to number each
  1801.      customer's transactions.  I want to then use the SUBNUM column to be able
  1802.      to:
  1803.      
  1804.        o  SELECT the nth row for each subgroup.  For example, if I select all
  1805.        the rows WHERE SUBNUM = 1, I will get a listing of all the unique
  1806.        subgroups
  1807.        o  PROJECT using WHERE SUBNUM = 1 to create a new table that has no
  1808.        duplicate subgroups.
  1809.        o  Do one to many lookups in reports.  I know I will only be able to look
  1810.        up 40 because you can only have 40 variables but without the SUBNUM
  1811.        column, I cannot lookup into a many table at all.
  1812.      
  1813.      
  1814.      
  1815.      
  1816.      SOLUTION:
  1817.      
  1818.      Before building your sequence numbers using SUBNUM.CMD below, use the
  1819.      EXPAND command to add the SUBNUM integer column to your table.
  1820.      
  1821.      SUBNUM.CMD is listed below.  Build your command file using SUBNUM.CMD as a
  1822.      guide.  Change the column names to match your actual column names.
  1823.      
  1824.      This procedure will take at least 1 second for each row in your table
  1825.      (maybe faster on a PC-AT type computer).  That's 3600 rows per hour - plan
  1826.      your time accordingly.
  1827.      
  1828.      *( SUBNUM.CMD - this procedure will sequentially number each
  1829.         customer's rows starting with one.  Customers are identified by a
  1830.         CUSTNUM column and each customer's row numbers are put into an
  1831.         integer column named SUBNUM)
  1832.      
  1833.      SET POINTER #3 e3 FOR TABLENAME SORTED BY CUSTNUM WHERE CUSTNUM EXISTS
  1834.      
  1835.      *(CUSTNUM is the subgroup being numbered.  The sort is required to put
  1836.         each customer group together)
  1837.      
  1838.      
  1839.      
  1840.      
  1841.      
  1842.      
  1843.      
  1844.      
  1845.      
  1846.      
  1847.      
  1848.      
  1849.      WHILE E3 = 0 THEN
  1850.        SET VARIABLE VCUST TO CUSTNUM IN #3
  1851.        *(VCUST is an initial variable)
  1852.        SET VARIABLE VCUSTC TO CUSTNUM IN #3
  1853.        *(VCUSTC will be used to compare the first row of the subgroup to
  1854.          the others)
  1855.        SET VARIABLE VCOUNT TO 0
  1856.        *(VCOUNT is the counter variable which holds the number which goes
  1857.          in the subnum column)
  1858.        WHILE VCUST = .VCUSTC THEN
  1859.        *(Here each new row is compared with the first row within each
  1860.          subgroup)
  1861.          SET VARIABLE VCOUNT TO .VCOUNT + 1
  1862.          *(this increments the row counter within each subgroup)
  1863.          CHANGE SUBNUM TO .VCOUNT IN #3
  1864.          *(This is where the unique subnumber is inserted in the row)
  1865.          NEXT #3 E3 *(THIS COMMAND MOVES THE POINTER THROUGH THE TABLE)
  1866.          SET VARIABLE VCUSTC TO CUSTNUM IN #3
  1867.          *(this sets the comparison variable VCUSTC to the next row)
  1868.          IF E3 NE 0 THEN
  1869.          *(This checks for end of data)
  1870.            BREAK
  1871.            *(If end of data is found we are done)
  1872.          ENDIF
  1873.        ENDWHILE *(while there are rows for this customer: VCUST = .VCUSTC)
  1874.      ENDWHILE *(While there are rows in the table)
  1875.      
  1876.      LOOKING UP IN A MANY TABLE
  1877.      
  1878.      To allow reports to do one to many lookups when your lookup table has a
  1879.      SUBNUM column, define a variable to find each row in the subgroup.
  1880.      
  1881.      There must not be more than 40 rows in each subgroup, or this procedure
  1882.      will not work because you are limited to 40 variable in the R:BASE 5000
  1883.      report writer.
  1884.      
  1885.      For example, define three lookup variables ROW1, ROW2, and ROW3, if you
  1886.      have a maximum of three rows in each customer group.
  1887.      
  1888.      Row1 = colname in tblname where custnum eq custnum and subnum eq 1
  1889.      Row2 = colname in tblname where custnum eq custnum and subnum eq 2
  1890.      Row3 = colname in tblname where custnum eq custnum and subnum eq 3
  1891.      
  1892.      
  1893.      
  1894.      
  1895.      
  1896.      
  1897.      
  1898.      
  1899.      
  1900.      
  1901.      
  1902.      
  1903.      
  1904.      
  1905.      
  1906.      
  1907.      
  1908.      
  1909.      
  1910.      
  1911.      
  1912.      
  1913.      
  1914.      
  1915.      
  1916.      
  1917.      
  1918.      
  1919.      MICRORIM TECHNICAL NOTE
  1920.      __________________________________________________________________________
  1921.      
  1922.      MAXIMUM NUMBER OF LINES IN RBEDIT
  1923.      
  1924.      DATE      :  04/86                   NUMBER       :  EX-4-9
  1925.      PRODUCT   :  R5K                     VERSIONS     :  1.01
  1926.      CATEGORY  :  RBEDIT                  SUBCATEGORY  :  MAX LINES/SIZE
  1927.      
  1928.      __________________________________________________________________________
  1929.      
  1930.      DESCRIPTION:   What is the maximum file size that RBEDIT can handle?
  1931.      
  1932.      
  1933.      
  1934.      
  1935.      EXPLANATION:   RBEDIT is the screen editor that we provide with R:BASE
  1936.      5000.  There are two ways to use RBEDIT, at the R> prompt inside R:BASE,
  1937.      and at the DOS prompt, outside of R:BASE.
  1938.      
  1939.      RBEDIT is designed to be used on small files.  If your file is too large
  1940.      for RBEDIT you will want to use another editor or ASCII word processor to
  1941.      work on your file.
  1942.      
  1943.      
  1944.      
  1945.      
  1946.      SOLUTION:   There is an absolute maximum number of lines, regardless of the
  1947.      number of characters per line, that RBEDIT can handle.
  1948.      
  1949.      805 lines inside R:BASE
  1950.      802 lines outside of R:BASE
  1951.      
  1952.      The size of the file in bytes cannot exceed 64.5K bytes (805 80-character
  1953.      lines.)
  1954.      
  1955.      When inside R:BASE there is 64K bytes of user addressable memory.  If part
  1956.      of this 64K is used to store global variables, or for other purposes, the
  1957.      allowable file size may be smaller.  In this case you may wish to first
  1958.      clear all variables before working on a file that is near the limit.
  1959.      
  1960.