home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / sri314_b.zip / PART4 < prev    next >
Text File  |  1990-04-22  |  117KB  |  3,283 lines

  1.      SR-Info/VP-Info Reference Manual           Page 381          SECTION 4
  2.  
  3.  
  4.  
  5.                                       TEXT
  6.  
  7.  
  8.      Send text to screen or printer.
  9.  
  10.      ╔════════════════════════════════════════════════════════════════════╗
  11.      ║ TEXT [<file>/.<volume>]                                            ║
  12.      ╟────────────────────────────────────────────────────────────────────╢
  13.      ║ Options:                                                           ║
  14.      ║                                                                    ║
  15.      ║ <file>    the name of the text file to use                         ║
  16.      ║ <volume>  the number of a volume in the current library; a         ║
  17.      ║             numeric constant                                       ║
  18.      ╚════════════════════════════════════════════════════════════════════╝
  19.  
  20.           The TEXT command has two forms.  The first form is the
  21.      TEXT/ENDTEXT program structure:
  22.  
  23.      TEXT
  24.         <text>
  25.      ENDTEXT
  26.  
  27.           All lines following the TEXT command up to ENDTEXT are displayed
  28.      on the screen or if the command SET PRINT ON was given, then also sent
  29.      to the printer.
  30.  
  31.           The second form is:
  32.  
  33.      TEXT <file>/.<volume>
  34.  
  35.      where the text is taken from the file <file> (default extension TXT)
  36.      or from the numbered volume in the current library (see SET LIBRARY TO
  37.      command).  This is the same as
  38.  
  39.      TEXT
  40.         the text from <file> or .<volume>
  41.      ENDTEXT
  42.  
  43.           The second form is preferable in many circumstances, since it:
  44.  
  45.                1.   Keeps the size of the program module down
  46.  
  47.                2.   Allows manipulation of the text in <file> or in
  48.                     .<volume>
  49.  
  50.                3.   Allows the choice of text to be used, since <file> can
  51.                     be a macro, and <volume> can be a numeric expression
  52.  
  53.           Note that library volumes are addressed by placing a period in
  54.      front of the volume number, which can be either a numeric constant or
  55.  
  56.  
  57.  
  58.  
  59.      TEXT                        SRI  VPI  VPIN                        TEXT
  60.  
  61.      SR-Info/VP-Info Reference Manual           Page 382          SECTION 4
  62.  
  63.  
  64.      a numeric expression.  Do not confuse this usage with a decimal
  65.      designation.
  66.  
  67.           TEXT macros.
  68.  
  69.           Contents of fields and variables can be merged into text blocks
  70.      for data input, reporting, listing and mail-merge applications.
  71.      SR-Info/VP-Info provides four special macro symbols for this purpose
  72.      as follows:
  73.  
  74.                                         Fixed position    Floating position
  75.  
  76.            Input macros (display/edit)         @                   %
  77.           Output macros (display only)         #                   &
  78.  
  79.           When a text macro symbol is encountered, SR-Info/VP-Info does the
  80.      following:
  81.  
  82.                1.   Checks whether the following characters are the name of
  83.                     a field in the selected file.  If it is, the current
  84.                     contents of the field replaces &<var> in the text.
  85.  
  86.                2.   If not a field name, then the characters following the
  87.                     macro symbol are assumed to be a memory variable name.
  88.                     If that name is valid, the contents of the memory
  89.                     variable replaces <var> in the text.
  90.  
  91.                3.   If <var> is neither a field nor a variable, it is
  92.                     assumed not to be a macro, and both the macro symbol
  93.                     and <var> are output as a literal.
  94.  
  95.           When the macro symbol & is used and SET TRIM ON, <var> is trimmed
  96.      before it is merged.  The position of all text to the right of <var>
  97.      in the same line is adjusted so that the number of spaces after <var>
  98.      in the output is the same as in the TEXT, no matter how wide <var> is.
  99.  
  100.                Caution: In a TEXT macro, <variable> must be terminated by
  101.           blank, tab, punctuation mark, or a macro symbol; it cannot be
  102.           terminated by a graphics character (since in many non-English
  103.           character sets these characters are normal or accented
  104.           alphanumeric characters).  It also cannot be terminated by a
  105.           colon or an underscore, since these are valid parts of a field or
  106.           variable name.
  107.  
  108.           Output (list processing).
  109.  
  110.           This command can be used to do list processing.
  111.  
  112.           Any variable (field, memory variable, or system variable) can be
  113.      merged into the document and output by using &<var> or #<var> in the
  114.      text.
  115.  
  116.  
  117.  
  118.  
  119.      TEXT                        SRI  VPI  VPIN                        TEXT
  120.  
  121.      SR-Info/VP-Info Reference Manual           Page 383          SECTION 4
  122.  
  123.  
  124.  
  125.           As described above, the & macro will trim the contents of <var>
  126.      when output when SET TRIM ON, and always adjusts the material to its
  127.      right on the same line depending on the width of the contents of
  128.      <var>.  Sometimes, it is more useful to output at an absolute location
  129.      with a variable (as opposed to merging); to do this use the #<var>
  130.      form.  #<var> does not trim or adjust the position of other items on
  131.      the line, creating the possibility that later items in the line may be
  132.      overwritten.
  133.  
  134.           A paragraph is a portion of the text between two carriage returns
  135.      (obtained by hitting <ENTER>).  A paragraph is formatted by the TEXT
  136.      command using word wrap (if there is not enough room for a word on a
  137.      line, it is displayed/printed at the start of the next line).  The
  138.      page width and the left margin are set by the SET WIDTH and the SET
  139.      MARGIN commands (see SET WIDTH and SET MARGIN).
  140.  
  141.           Control codes can be sent from the text using the symbols ^
  142.      (caret) and \ (backslash).
  143.  
  144.           The caret.  When SR-Info/VP-Info comes across a ^, it checks for
  145.      the next character.  If the next character is also a ^, the two
  146.      characters are sent as a single ^.  If the next character is not a ^,
  147.      it is sent as a control character; for instance, ^C is sent as Ctrl-C.
  148.  
  149.           Examples for ^:
  150.  
  151.      ^^        sent as ^
  152.      ^C        sent as Ctrl-C
  153.      ^^C       sent as ^C
  154.  
  155.           The backslash.  When SR-Info/VP-Info comes across a \, it checks
  156.      for the next character.  If the next character is also a \, the two
  157.      characters are sent as a single \.  If the next character is not a \,
  158.      SR-Info/VP-Info checks for digits; it grabs as many digits as there
  159.      are, up to three.  The digits are converted into a number, and the
  160.      number is sent as a code between 0 and 255.
  161.  
  162.           Examples for \:
  163.  
  164.      \\        sent as \
  165.      \2a       sent as code 2, followed by a
  166.      \0020     sent as code 2, followed by the character 0 (002 is
  167.                  the 2)
  168.      \27x\000  sent as code 27 (escape), x, code 0
  169.  
  170.           Examples:
  171.  
  172.      TEXT
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.      TEXT                        SRI  VPI  VPIN                        TEXT
  180.  
  181.      SR-Info/VP-Info Reference Manual           Page 384          SECTION 4
  182.  
  183.  
  184.      This text will be sent to the screen or the printer.  You can set the;
  185.      left margin and the text width.  The text is automatically word;
  186.      wrapped.
  187.      ENDTEXT
  188.  
  189.           Now the same in letter quality mode on the Epson LQ-1500 printer:
  190.  
  191.      TEXT
  192.      \27x\001This text will be sent to the screen or the printer.  You can;
  193.      set the left margin and the text width.  The text is automatically;
  194.      word wrapped.
  195.      ENDTEXT
  196.  
  197.           Input screen painting.
  198.  
  199.           The TEXT command can be used "to paint" input screens.  @<var> is
  200.      a GET, activated by a READ command.
  201.  
  202.           @<var> also has a floating-position form, %<var>, which adjusts
  203.      the material to its right on the same line depending on the width of
  204.      the contents of <var>.
  205.  
  206.           Neither @<var> nor %<var> trims the present contents of the
  207.      variable.
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.      TEXT                        SRI  VPI  VPIN                        TEXT
  240.  
  241.      SR-Info/VP-Info Reference Manual           Page 385          SECTION 4
  242.  
  243.  
  244.           Examples:
  245.  
  246.      TEXT
  247.           @fname              @name               @dept
  248.      ENDTEXT
  249.  
  250.      TEXT
  251.           %fname  %name  %dept
  252.      ENDTEXT
  253.  
  254.      Both create a one-line input format that can be used with BROWSE OFF
  255.      (or, if the macro line is placed in a text file, with BROWSE TEXT.
  256.      The second form is easier to use, since there is no concern about the
  257.      width of the various fields.  For example, the maximum width available
  258.      for NAME in the first form is 20 characters; if it is 20, it runs into
  259.      DEPT, and if more than 20, it will suppress DEPT input completely.
  260.  
  261.           Formats in TEXT.
  262.  
  263.           TEXT formats let you control the display on fields and variables
  264.      used in TEXT macros.  They are similar to the formats used in the
  265.      PICTURE and USING clauses of the @ command (see @ for format rules and
  266.      examples).
  267.  
  268.           In TEXT blocks and files, formats must appear at the beginning of
  269.      the block, with a separate line for each formatted variable.  Each
  270.      line must begin with two periods and a space, followed by the name of
  271.      the field or variable, a comma, and the format picture.  Examples:
  272.  
  273.      .. cust,!!!!-!-99
  274.      .. today,99/99/99
  275.      .. balance,$$$$$$$$$9,99>
  276.      .. price,$$,$$$.99
  277.      .. codes#3,' xxx xxx xxx '
  278.      .. exception,'First: "xxxxxxxxxx"'
  279.  
  280.           Format lines may not contain comments, and need no quote marks
  281.      unless the format itself includes leading or trailing blanks (not
  282.      recommended) or quote marks of the other type; see last two example
  283.      above.
  284.  
  285.           If a field is not in the selected data file, be sure to use field
  286.      redirection as in CODES#3 above.
  287.  
  288.           Effect of SET TEXT ON/OFF and CLEAR GETS.
  289.  
  290.           A Get Table with room for up to 64 gets is available for full-
  291.      screen editing commands, like READ, EDIT, and BROWSE.  Whenever a GET
  292.      is issued (either by TEXT or @ GET), it is entered into the Get Table
  293.      so that SR-Info/VP-Info can rapidly ascertain its position and format
  294.  
  295.  
  296.  
  297.  
  298.  
  299.      TEXT                        SRI  VPI  VPIN                        TEXT
  300.  
  301.      SR-Info/VP-Info Reference Manual           Page 386          SECTION 4
  302.  
  303.  
  304.      during later processing.
  305.  
  306.           When SET TEXT ON, the TEXT display macros created with & and #
  307.      are put into the Get Table. This setting is usually required for input
  308.      screens created with TEXT.
  309.  
  310.           When SET TEXT OFF, display macros are not put into the Get Table.
  311.      This setting is required when using TEXT for printer output, as in
  312.      mail-merge programs, to avoid trying to create a 65th entry in the Get
  313.      Table.  Over-filling the Get Table is an error that causes termination
  314.      of a program.
  315.  
  316.           It is good practice to place a CLEAR GETS command before the TEXT
  317.      command to ensure that the Get Table is empty before starting to fill
  318.      it again.
  319.  
  320.           Examples:
  321.  
  322.           1.   A text file used in data input with EDIT TEXT (see screen
  323.      output in EDIT command section):
  324.  
  325.      .. zip,!9! 9!9
  326.      .. phone,999-9999 (999)
  327.      .. wphone,999-9999 (999)
  328.      .. training,99/99
  329.  
  330.            NAME...........  %FNAME  %NAME
  331.  
  332.            ADD_1..........  %ADD_1  %AREA
  333.            ZIP............  @ZIP
  334.  
  335.            PHONE..........  @PHONE
  336.            WPHONE.........  @WPHONE
  337.  
  338.            EXPERIENCE.....
  339.                @EXPERIENCE
  340.            COMMENTS
  341.                @COMMENT1
  342.                @COMMENT2
  343.  
  344.           2.   A program that does formatted output from a data file,
  345.      including multi-line output from certain fields:
  346.  
  347.      SET PRINT ON
  348.      SET TEXT OFF
  349.      SET MARGIN TO 0
  350.      SET WIDTH TO 80
  351.      IF row()>1                     ;if current row not at top of form,
  352.         SPOOL junk                   ;  eject into throw-away spool file
  353.         EJECT
  354.         SPOOL
  355.      ENDIF
  356.  
  357.  
  358.  
  359.      TEXT                        SRI  VPI  VPIN                        TEXT
  360.  
  361.      SR-Info/VP-Info Reference Manual           Page 387          SECTION 4
  362.  
  363.  
  364.      USE customer INDEX customer
  365.      page=1
  366.      PERFORM heading
  367.      DO WHILE .not. eof
  368.         IF ROW()>50                  ;start new page if past line 50
  369.            EJECT
  370.            PERFORM heading
  371.         ENDIF
  372.         nameline=TRIM(fname)+' '+TRIM(name)
  373.         address=TRIM(addr:1)+' '+TRIM(addr:2)+' '+TRIM(city)
  374.         remarks=comments
  375.         nameline2=WRAP(nameline,15)  ;WRAP( function trim long strings,
  376.         address2=WRAP(address,17)    ;  leaving remainder for next line
  377.         remarks2=WRAP(remarks,20)
  378.      *  text for main line includes customer number, formatted with picture
  379.         TEXT
  380.      .. cust,xxx-x-xx
  381.      #cust    #nameline2      #address2         #remarks2
  382.         ENDTEXT
  383.      *  test in next line depends on fact that concatenating several fields
  384.      *    of blanks and then trimming the result leaves a single blank
  385.         DO WHILE ' '<>TRIM(nameline+address+remarks)
  386.            IF ROW()>55               ;start new page if past line 55
  387.               EJECT
  388.               PERFORM heading
  389.            ENDIF
  390.            nameline2=WRAP(nameline,15)
  391.            address2=WRAP(address,17)
  392.            remarks2=WRAP(remarks,20)
  393.      *     text same as main text except customer number omitted
  394.            TEXT
  395.               #nameline2      #address2         #remarks2
  396.            ENDTEXT
  397.         ENDDO
  398.         ?                           ;skip line after every customer
  399.         SKIP                        ;get next customer record
  400.      ENDDO
  401.      EJECT
  402.      SET PRINT OFF
  403.      *
  404.      PROCEDURE heading
  405.         ? DATE(full)
  406.         ?? BLANK(52-col()),'Page '+LTRIM(STR(page,5))
  407.         ? CEN(:COMPANY,60)
  408.         ? CEN('Current Customer Listing',60)
  409.         ?
  410.         ? 'Number   Name            Address           Comments'
  411.         ? '======== =============== ================= ===================='
  412.         ?
  413.         page=page+1
  414.      ENDPROCEDURE heading
  415.  
  416.  
  417.  
  418.  
  419.      TEXT                        SRI  VPI  VPIN                        TEXT
  420.  
  421.      SR-Info/VP-Info Reference Manual           Page 388          SECTION 4
  422.  
  423.  
  424.      *
  425.      PROCEDURE heading
  426.         ?
  427.         ?? DATE(full)
  428.         ?? BLANK(52-col()),'Page '+LTRIM(STR(page,5))
  429.         ? CEN(:COMPANY,60)
  430.         ? CEN('Current Customer Listing',60)
  431.         ?
  432.         ? 'Number   Name            Address           Comments'
  433.         ? '======== =============== ================= ===================='
  434.         ?
  435.         page=page+1
  436.      ENDPROCEDURE heading
  437.  
  438.           Sample output:
  439.  
  440.      Saturday, March 31, 1990                             Page 1
  441.                        Computer Resellers Corp.
  442.                        Current Customer Listing
  443.  
  444.      Number   Name            Address           Comments
  445.      ======== =============== ================= ====================
  446.  
  447.      ALB-A-65 Arthur          876 Main Street   Develops LAN-based
  448.               Albredge        Suite 987A San    software
  449.                               Francisco
  450.  
  451.      BRO-W-53 Walter          Freeridge         Hard-disk
  452.               Brownstone      Company 8765      controller and
  453.                               Corvis Drive San  cache expert
  454.                               Jose, CA
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.      TEXT                        SRI  VPI  VPIN                        TEXT
  480.  
  481.      SR-Info/VP-Info Reference Manual           Page 388.1          SECTION 4
  482.  
  483.  
  484.                               Note on TEXT Command
  485.  
  486.           The two primary uses of TEXT are list processing (output) and
  487.      screen design (input).  Since Info cannot "know" which purpose you
  488.      have in mind when your execute the command, you should "tell" Info how
  489.      the TEXT command should be implemented.  Use the SET TEXT OFF command
  490.      for list processing, and SET TEXT ON for screen painting.
  491.  
  492.           SET TEXT controls the way the & and # macros are handled during
  493.      execution of the TEXT command, as follows:
  494.  
  495.                *ON       The TEXT display macros created with & and # are
  496.                          put into the Get Table; usually required for input
  497.                          screens created with TEXT.
  498.                OFF       Display macros are not put into the Get Table;
  499.                          usually required when using TEXT for printer
  500.                          output, as in mail-merge programs.
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.      TEXT                        SRI  VPI  VPIN                        TEXT
  539.  
  540.      SR-Info/VP-Info Reference Manual           Page 389          SECTION 4
  541.  
  542.  
  543.  
  544.                                      TOTAL
  545.  
  546.      Summarize the information from the selected file (indexed) to a new
  547.      file.
  548.  
  549.      ╔════════════════════════════════════════════════════════════════════╗
  550.      ║ TOTAL [<scope>] ON <str exp> TO <file> [FIELDS <field list>]       ║
  551.      ║      [FOR <cond>]                                                  ║
  552.      ║                                                                    ║
  553.      ║ <str exp>    trigger expression                                    ║
  554.      ║ <file>       new file to contain summary information               ║
  555.      ╟────────────────────────────────────────────────────────────────────╢
  556.      ║ Options:                                                           ║
  557.      ║                                                                    ║
  558.      ║ <scope>               selection of records by scope                ║
  559.      ║                          (default scope: ALL)                      ║
  560.      ║ FIELDS <field list>   the fields to be totalled                    ║
  561.      ║ FOR <cond>            selection of records by <cond>               ║
  562.      ╚════════════════════════════════════════════════════════════════════╝
  563.  
  564.           The selected file must be indexed or sorted on <str exp>.  The
  565.      records of the selected file can be grouped by the value of <str exp>:
  566.      in each group <str exp> has the same value.
  567.  
  568.           This command creates a new file <file>; for each group of records
  569.      of the selected file, a record is entered in the new file.
  570.  
  571.           This new record is the same as the first record of the group,
  572.      except that the numeric fields in the <field list> are replaced by
  573.      their total for all the records in the group.  (Specifying a logical
  574.      or a character field in the <field list> will cause an error.)
  575.  
  576.           Deleted records are ignores irrespective of SET DELETED command.
  577.  
  578.           The following steps describe in detail how this command works:
  579.  
  580.           Step 1. Copies the structure of the selected file to <file>.
  581.  
  582.           Step 2. Appends the first record which satisfies the FOR clause
  583.      (note also scope, deleted records are disregarded) from the selected
  584.      file to the new file.
  585.  
  586.           Step 3. Evaluates <str exp> and saves it in a temporary variable.
  587.  
  588.           Step 4. Takes all subsequent records (if any) for which <str exp>
  589.      does not change. Adds up the fields in the FIELDS clause (if any) and
  590.      stores the sum in the record appended to <file> while <str exp>
  591.      continues to match the value saved in the temporary variable.
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.      TOTAL                       SRI  VPI  VPIN                       TOTAL
  599.  
  600.      SR-Info/VP-Info Reference Manual           Page 390          SECTION 4
  601.  
  602.  
  603.           Step 5. Continue with Step 2, using the first record for which
  604.      <str exp> has a new value.
  605.  
  606.           If no FIELDS clause is in the command line no addition is
  607.      performed, and the resulting file consists only of the first record
  608.      encountered for each different value of <str exp>.  A frequent use of
  609.      this feature is to purge the file of records with duplicate keys.
  610.  
  611.           See also the related commands: POST and UPDATE.
  612.  
  613.           Example:  Use the ORDER file to find out which STYLE:NO and COLOR
  614.      have been ordered:
  615.  
  616.      1>USE order
  617.      1>LIST style:no+color
  618.            1  A120B1
  619.            2  C001R3
  620.            3  M100G5
  621.            4  A120B1
  622.            5  M100G5
  623.  
  624.           Of course, this way you get a lot of duplicates.  To get each
  625.      STYLE:NO+COLOR only once, make the file STYLESUM (style summary) with
  626.      TOTAL:
  627.  
  628.      1>INDEX ON style:no+color TO order
  629.            5 RECORDS IN TOTAL INDEXED
  630.      1>TOTAL ON style:no+color TO stylesum
  631.            5 TOTAL(S)
  632.      1>USE stylesum
  633.      1>LIST inven:no, style:no, color
  634.            1  AB0011 A120 B1
  635.            2  AB0110 C001 R3
  636.            3  QA1001 M100 G5
  637.  
  638.           This is the desired list.
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.      TOTAL                       SRI  VPI  VPIN                       TOTAL
  659.  
  660.      SR-Info/VP-Info Reference Manual           Page 391          SECTION 4
  661.  
  662.  
  663.  
  664.                                      UNLOCK
  665.  
  666.      Unlock the current record.
  667.  
  668.      ╔════════════════════════════════════════════════════════════════════╗
  669.      ║ UNLOCK             VP-Info Network Edition only                    ║
  670.      ╚════════════════════════════════════════════════════════════════════╝
  671.  
  672.           This command unlocks the current record previously locked.  See
  673.      the SET NETWORK command on how to get into the multi-user mode.  See
  674.      also LOCK.
  675.  
  676.           Example:
  677.  
  678.      mcust=cust
  679.      FIND &mcust
  680.      LOCK
  681.      REPLACE balance with 0
  682.      UNLOCK
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.      UNLOCK                           VPIN                           UNLOCK
  719.  
  720.      SR-Info/VP-Info Reference Manual           Page 392          SECTION 4
  721.  
  722.  
  723.  
  724.                                  UNLOCK INDEXES
  725.  
  726.      Unlock all indexes on the selected data file.
  727.  
  728.      ╔════════════════════════════════════════════════════════════════════╗
  729.      ║ UNLOCK INDEXES             VP-Info Network Edition only            ║
  730.      ╚════════════════════════════════════════════════════════════════════╝
  731.  
  732.           This command unlocks the indexes previously locked on the
  733.      selected data file with the LOCK INDEXES command.
  734.  
  735.           See the SET NETWORK command on how to get into the multi-user
  736.      mode.  See also LOCK INDEXES.
  737.  
  738.           Example:
  739.  
  740.      UNLOCK INDEXES
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.      UNLOCK INDEXES                   VPIN                   UNLOCK INDEXES
  779.  
  780.      SR-Info/VP-Info Reference Manual           Page 393          SECTION 4
  781.  
  782.  
  783.  
  784.                                      UPDATE
  785.  
  786.      Update the selected file from an indexed file by replacing selected
  787.      fields.
  788.  
  789.      ╔════════════════════════════════════════════════════════════════════╗
  790.      ║ UPDATE FROM [<scope>] <file number> ON <str exp> [REPLACE <field1> ║
  791.      ║      WITH <exp1>,...,<fieldn> WITH <expn>] [FOR <cond>]            ║
  792.      ║                                                                    ║
  793.      ║ <file number>     the location of the FROM file                    ║
  794.      ║ <str exp>         the expression that is the key for finding       ║
  795.      ║                      the record in the FROM file                   ║
  796.      ╟────────────────────────────────────────────────────────────────────╢
  797.      ║ Options:                                                           ║
  798.      ║                                                                    ║
  799.      ║ <scope>         selection restricted by scope (default scope: ALL) ║
  800.      ║ REPLACE <field1> WITH <exp1>,...,<fieldn> WITH <expn>              ║
  801.      ║                 where field1,..,fieldn are fields of the file      ║
  802.      ║                    in use                                          ║
  803.      ║                 <exp1>,...,<expn> are expressions involving fields ║
  804.      ║                    of both files                                   ║
  805.      ║ FOR <cond>      selection restricted by <cond>                     ║
  806.      ╚════════════════════════════════════════════════════════════════════╝
  807.  
  808.           The selected file need not be indexed.  This procedure takes all
  809.      the appropriate records of the selected file one at a time.
  810.  
  811.           The FROM file has to be indexed by <str exp>; the expression,
  812.      <str exp>, is made up of character fields shared by the two files, and
  813.      by memory variables and constants.
  814.  
  815.           This procedure works as follows:
  816.  
  817.                1.   Takes the first appropriate record (that is, the first
  818.                     non-deleted record satisfying the <cond> and within the
  819.                     scope).
  820.  
  821.                2.   Evaluates <str exp> in the selected file.
  822.  
  823.                3.   Finds the first matching record in the FROM file.
  824.  
  825.                     a.   If the FIND is not successful, an "UPDATE ERROR"
  826.                          message is sent showing both the record number and
  827.                          the value of <str exp> in the selected file.  If
  828.                          SET PRINT ON, messages are sent to the printer.
  829.  
  830.                     b.   If the FIND is successful, the procedure replaces
  831.                          the fields of the selected file with the
  832.                          expressions, <str exp>, made up of fields of both
  833.  
  834.  
  835.  
  836.  
  837.  
  838.      UPDATE                      SRI  VPI  VPIN                      UPDATE
  839.  
  840.      SR-Info/VP-Info Reference Manual           Page 394          SECTION 4
  841.  
  842.  
  843.                          files.  All fields names are assumed to be in the
  844.                          updating file, so make sure #n is attached to any
  845.                          field names from the FROM file.
  846.  
  847.                4.   Procedure continues with the next appropriate record as
  848.                     long as records remain within the <scope>.
  849.  
  850.           If there is no REPLACE clause, UPDATE simply checks whether all
  851.      the expected records of the FROM file are present.
  852.  
  853.           See also the commands: POST and TOTAL.  SET ADD ON has no effect
  854.      on UPDATE.
  855.  
  856.           Example:
  857.  
  858.           The cost of an item is kept updated in the INVENTRY file.  To
  859.      update the COST in the ORDER file:
  860.  
  861.      1>USE#4 inventry INDEX inventry
  862.      1>USE order
  863.      1>UPDATE FROM 4 ON inven:no REPLACE cost WITH cost#4
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.      UPDATE                      SRI  VPI  VPIN                      UPDATE
  899.  
  900.      SR-Info/VP-Info Reference Manual           Page 395          SECTION 4
  901.  
  902.  
  903.  
  904.                                       USE
  905.  
  906.      Open data file for use, optionally, with index files.
  907.  
  908.      ╔════════════════════════════════════════════════════════════════════╗
  909.      ║ USE <file> [INDEX <file list>] [<mode>] [COMPILE]                  ║
  910.      ║                                                                    ║
  911.      ║ <file>    the data file to use                                     ║
  912.      ╟────────────────────────────────────────────────────────────────────╢
  913.      ║ Option:                                                            ║
  914.      ║                                                                    ║
  915.      ║ INDEX <file list>    list of index file names to use               ║
  916.      ║ <mode>               the file access mode under which DOS is to    ║
  917.      ║                        open the file                               ║
  918.      ║ COMPILE              open data file at compile time only           ║
  919.      ╚════════════════════════════════════════════════════════════════════╝
  920.  
  921.           The command USE opens a data file for use.  To open one or more
  922.      index files with the data file, use INDEX and the index file name(s).
  923.      The first index file is the Master Index; this one is in use with the
  924.      FIND, LIST, SKIP, etc. commands.  All other index files named will be
  925.      updated by all commands.
  926.  
  927.           The option COMPILE is used to open a data file at compile time
  928.      only.  It is used in situations where the data file to be used at run
  929.      time is not available at compile time.  One remedy is to put the name
  930.      of the data file in a macro, but then all the field names must be in
  931.      macros.  COMPILE offers a better solution if a data file with the same
  932.      structure is available at compile time.  For example,
  933.  
  934.      USE inven COMPILE
  935.      USE &file INDEX &file2
  936.  
  937.      will open the data file INVEN at compile time only.  At compile time
  938.      the command: USE &file index &file2 is ignored.  Now if the structure
  939.      of INVEN is the same as the structure of the data file(s) whose name
  940.      will appear in &file, then the program can use the field name without
  941.      macros.  Note that index files are not opened at compile time, so the
  942.      same problem does not effect index files.
  943.  
  944.           Caution: Avoid using data and index file names that start with
  945.           the letters "COMP", since the compiler may mistake the file name
  946.           for the COMPILE keyword and make it impossible to use the file in
  947.           a program.
  948.  
  949.           VP-Info Professional supports four different modes (READ, WRITE,
  950.      LOCK, and SHARE).  SR-Info and VP-Info support only one mode (READ),
  951.      although the other modes are recognized for compatibility and cause no
  952.      error in any version.  The meaning of the four modes is as follows:
  953.  
  954.  
  955.  
  956.  
  957.  
  958.      USE                         SRI  VPI  VPIN                         USE
  959.  
  960.      SR-Info/VP-Info Reference Manual           Page 396          SECTION 4
  961.  
  962.  
  963.  
  964.           LOCK - Open the file for both reading and writing, and maintain
  965.                exclusive use; allow no other users on a network to read or
  966.                write to the file while it is open in LOCK mode.  This is
  967.                the default mode for all versions.
  968.  
  969.           WRITE - Open the file for both reading and writing, and allow no
  970.                other users on a network to write to the file, but allow
  971.                other users to open the file in READ mode.
  972.  
  973.           READ - Open the file for reading only, without restricting other
  974.                users on a network from opening it in WRITE or SHARE mode.
  975.                When not on a network, READ mode is useful in ensuring that
  976.                changes made to a file are not saved to disk.
  977.  
  978.           SHARE - Open the file for both reading and writing, without
  979.                restricting the ability of others on a network
  980.  
  981.           See also SET INDEX TO.
  982.  
  983.           Examples:
  984.  
  985.           1. To open a data file as file 5 while currently you are on file
  986.      2:
  987.  
  988.      2>USE#5 customer
  989.      2>USE#2 invoice INDEX invoice
  990.      2>USE#1 sales INDEX color,style,ddate
  991.  
  992.           Three data files were opened under the appropriate file numbers.
  993.      Note that the default file number is still 2; the index files are
  994.      separated by commas.
  995.  
  996.           2.  To open a file in READ mode before using EDIT to check data
  997.      without the risk of writing any changes back to disk:
  998.  
  999.      1>USE employee INDEX emplname READ
  1000.      1>FIND TAYLOR
  1001.      1>EDIT
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.      USE                         SRI  VPI  VPIN                         USE
  1019.  
  1020.      SR-Info/VP-Info Reference Manual           Page 397          SECTION 4
  1021.  
  1022.  
  1023.  
  1024.                                    VARIABLES
  1025.  
  1026.  
  1027.      Enters a list of memory variable names into the variables table.
  1028.  
  1029.      ╔════════════════════════════════════════════════════════════════════╗
  1030.      ║ VARIABLES <variables list>                                         ║
  1031.      ║                                                                    ║
  1032.      ║ <variables list>  list of memory-variable names                    ║
  1033.      ╚════════════════════════════════════════════════════════════════════╝
  1034.  
  1035.           SR-Info/VP-Info allows up to 128 variables to be defined at a
  1036.      time.  Their names are listed in a variables table, which is displayed
  1037.      with the LIST MEMORY command.
  1038.  
  1039.           When a program is compiled, each time SR-Info/VP-Info encounters
  1040.      a name not already in the table, it is added.  As a programmer, you
  1041.      can control the order of variables in the table by naming them in the
  1042.      variables list with the VARIABLES command.  This is not only good
  1043.      practice in general, but it can help in debugging, and makes it
  1044.      possible to be sure every variable you use is being defined, and that
  1045.      no others are being inadvertently created.
  1046.  
  1047.           The variables command should never be used in a subroutine, and
  1048.      can be used only once in the main routine.  It should come after any
  1049.      GLOBAL command, but before any other variable is defined.
  1050.  
  1051.           Example in a program:
  1052.  
  1053.      VARIABLES start,finish,mcust,mserial
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.      VARIABLES                   SRI  VPI  VPIN                   VARIABLES
  1079.  
  1080.      SR-Info/VP-Info Reference Manual           Page 398          SECTION 4
  1081.  
  1082.  
  1083.  
  1084.                                       WAIT
  1085.  
  1086.      Accept one character from the keyboard.
  1087.  
  1088.      ╔════════════════════════════════════════════════════════════════════╗
  1089.      ║ WAIT [TO <memvar>]                                                 ║
  1090.      ╟────────────────────────────────────────────────────────────────────╢
  1091.      ║ Option:                                                            ║
  1092.      ║                                                                    ║
  1093.      ║ TO <memvar>    store the character into this variable              ║
  1094.      ╚════════════════════════════════════════════════════════════════════╝
  1095.  
  1096.           When SR-Info/VP-Info encounters the WAIT command, the program
  1097.      execution stops, the message: WAITING is displayed; SR-Info/VP-Info
  1098.      waits for a character to be entered at the keyboard.   When a key is
  1099.      hit, program execution continues.
  1100.  
  1101.           If the option: TO <memvar> is used, the character is stored in
  1102.      the string memory variable <memvar>; this cannot be a matrix variable.
  1103.      If the variable <memvar> does not exist, it will be created.
  1104.  
  1105.           This command is useful to suspend the program execution so that
  1106.      the user can read a message on the screen, and maybe make a choice.
  1107.  
  1108.           See also the INKEY( function.
  1109.  
  1110.           Examples:
  1111.  
  1112.           1. A program segment:
  1113.  
  1114.      @ 20,0 SAY 'Turn the printer on. Hit any key when ready.'
  1115.      WAIT
  1116.  
  1117.           After the message is displayed, SR-Info/VP-Info waits for the
  1118.      user to hit a key indicating that the printer is now on.
  1119.  
  1120.           2. A typical, simple menu using WAIT:
  1121.  
  1122.      DO WHILE T
  1123.         ERASE
  1124.         TEXT
  1125.                                  MENU
  1126.  
  1127.            1. General Ledger
  1128.            2. Invoicing
  1129.            3. Receivables
  1130.  
  1131.            Type in your choice:
  1132.         ENDTEXT
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.      WAIT                        SRI  VPI  VPIN                        WAIT
  1139.  
  1140.      SR-Info/VP-Info Reference Manual           Page 399          SECTION 4
  1141.  
  1142.  
  1143.         WAIT TO ans
  1144.         IF ans>'0' .OR. ans<'4'
  1145.            BREAK
  1146.         ENDIF
  1147.      ENDDO
  1148.      DO CASE
  1149.         CASE ans='1'
  1150.            DO ...
  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.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.      WAIT                        SRI  VPI  VPIN                        WAIT
  1199.  
  1200.      SR-Info/VP-Info Reference Manual           Page 400          SECTION 4
  1201.  
  1202.  
  1203.  
  1204.                                      WINDOW
  1205.  
  1206.      Defines the active window, that part of the screen to which relative
  1207.      output can be sent.
  1208.  
  1209.      ╔════════════════════════════════════════════════════════════════════╗
  1210.      ║ WINDOW                                                             ║
  1211.      ║ WINDOW <row1>,<row2> [COLOR <windowcolor> [<bordercolor>]]         ║
  1212.      ║ WINDOW <row1>,<col1>,<row2>,<col2> [COLOR <windowcolor>            ║
  1213.      ║     [,<bordercolor>]] [BLANK/DOUBLE]                               ║
  1214.      ║                                                                    ║
  1215.      ║ <row1>,<row2>  the top and bottom of the window to be created;     ║
  1216.      ║                  with no column numbers given, the window is       ║
  1217.      ║                  full width with no border permitted               ║
  1218.      ║ <row1>,<col1>  the coordinates of the top-left corner of the window║
  1219.      ║ <row2>,<col2>  the coordinates of the bottom right corner of the   ║
  1220.      ║                  window                                            ║
  1221.      ╟────────────────────────────────────────────────────────────────────╢
  1222.      ║ Options:                                                           ║
  1223.      ║                                                                    ║
  1224.      ║ COLOR <windowcolor>   the color of the area inside the window      ║
  1225.      ║       <bordercolor>   the color of the window border               ║
  1226.      ║ BLANK                 the window has no border                     ║
  1227.      ║ DOUBLE                the window double-line borders (default      ║
  1228.      ║                         single-line borders)                       ║
  1229.      ╚════════════════════════════════════════════════════════════════════╝
  1230.  
  1231.           Unlike the BOX command, WINDOW erases the area within the
  1232.      coordinates given, and if corners are specified, displays an optional
  1233.      border one space outside the border coordinates.
  1234.  
  1235.           Although the fixed-position display commands like @ SAY can write
  1236.      either inside or outside the window, all the relative display commands
  1237.      like ?, ??, LIST, DISPLAY, TEXT, etc., are restricted to the active
  1238.      window.
  1239.  
  1240.           The window can be deactivated (i.e., reset to the entire screen
  1241.      size) by the WINDOW command alone.
  1242.  
  1243.           The rows are numbered 0 to 24. Since a row is always allowed
  1244.      above and below the window coordinates, the actual range of row
  1245.      numbers for the WINDOW command is 1 through 23.
  1246.  
  1247.           The columns are numbered 0 to 79. Since a column is always
  1248.      allowed to the left and right of the window coordinates, the actual
  1249.      range of column numbers for the WINDOW command is 1 through 78.
  1250.  
  1251.           Note that commas are required between coordinates, but are not
  1252.      permitted before the keywords COLOR, BLANK, and DOUBLE.
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.      WINDOW                      SRI  VPI  VPIN                      WINDOW
  1259.  
  1260.      SR-Info/VP-Info Reference Manual           Page 401          SECTION 4
  1261.  
  1262.  
  1263.  
  1264.           In programs, WINDOW is often used to position TEXT and may be
  1265.      useful in setting up BROWSE, EDIT, WRITE and other input/output
  1266.      displays.
  1267.  
  1268.           Examples:
  1269.  
  1270.           1.  Use WRITE to edit a file in the bottom half of the screen:
  1271.  
  1272.      CLS
  1273.      CURSOR 5,20
  1274.      ACCEPT "Enter name of file to edit " to fil_nam
  1275.      WINDOW 8,5,22,74 color 7,112 double
  1276.      WRITE &fil_nam OFF
  1277.      WINDOW
  1278.  
  1279.           2.  Use BROWSE with a TEXT file in a window:
  1280.  
  1281.      USE customer
  1282.      WINDOW 2,22 color 112
  1283.      BROWSE TEXT customer
  1284.      WINDOW
  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.      WINDOW                      SRI  VPI  VPIN                      WINDOW
  1319.  
  1320.      SR-Info/VP-Info Reference Manual           Page 402          SECTION 4
  1321.  
  1322.  
  1323.  
  1324.                                      WRITE
  1325.  
  1326.      Activate the program editor.
  1327.  
  1328.      ╔════════════════════════════════════════════════════════════════════╗
  1329.      ║ WRITE [<file>/.<volume>] [OFF]                                     ║
  1330.      ╟────────────────────────────────────────────────────────────────────╢
  1331.      ║ Options:                                                           ║
  1332.      ║                                                                    ║
  1333.      ║ <file>     name of file to be created or edited                    ║
  1334.      ║ <volume>   number of a volume in the current library; a numeric    ║
  1335.      ║              expression                                            ║
  1336.      ║ OFF        omit header and opportunity to rename file or volume    ║
  1337.      ╚════════════════════════════════════════════════════════════════════╝
  1338.  
  1339.           A simple program editor is provided to make it possible to write
  1340.      and edit programs in SR-Info/VP-Info.  If <file> or <volume> is not
  1341.      specified, the last file used is understood to be the file to edit.
  1342.      If no extension is specified, PRG is assumed.  This editor is very
  1343.      useful for debugging programs and reports.
  1344.  
  1345.           Note that library volumes are addressed by placing a period in
  1346.      front of the volume number, which can be either a numeric constant or
  1347.      a numeric expression.  Do not confuse this usage with a decimal
  1348.      designation.
  1349.  
  1350.           OFF causes WRITE to omit the top three lines of the screen (file
  1351.      name and ruler, etc.) and places the cursor at the beginning of the
  1352.      file in the top left corner of the current window (the entire screen
  1353.      if no window is active), and to save the file immediately upon sensing
  1354.      the <End> key without giving an opportunity to change the file name.
  1355.      WRITE OFF is used primarily inside programs under program control, and
  1356.      with an active window.
  1357.  
  1358.           The editing keys are the same as in full-screen editing.  WRITE
  1359.      uses an 80 character "window" for its 254 character lines.
  1360.  
  1361.           The maximum size of a text file is about 20,000 characters with
  1362.      no data files open.  Using data and index files reduces space
  1363.      available for WRITE, as does running WRITE inside a program; consider
  1364.      running WRITE from a subroutine instead of the main routine if maximum
  1365.      file size is required.
  1366.  
  1367.           Editing keys:
  1368.  
  1369.      <Left> or Ctrl-S        moves the cursor back one character
  1370.      <Right> or Ctrl-D       moves the cursor forward one character
  1371.      <Up> or Ctrl-E          moves the cursor to the previous line
  1372.      <Dn> or Ctrl-X          moves the cursor to the next line
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.      WRITE                       SRI  VPI  VPIN                       WRITE
  1379.  
  1380.      SR-Info/VP-Info Reference Manual           Page 403          SECTION 4
  1381.  
  1382.  
  1383.  
  1384.      Ctrl-<Left>             moves to the beginning of the line
  1385.      Ctrl-<Right>            moves to the end of the line
  1386.  
  1387.      Ctrl-<Home>             moves to the beginning of the document
  1388.      Ctrl-<End>              moves to the end of the document
  1389.  
  1390.      Ctrl-N                  inserts a new line
  1391.      Ctrl-T                  deletes the line
  1392.  
  1393.      <PgUp> or Ctrl-R        displays previous page
  1394.      <PgDn> or Ctrl-C        displays next page
  1395.  
  1396.      <BACKSPACE>             deletes the character to the left of the
  1397.                                 cursor
  1398.      <Del> or Ctrl-G         deletes the character on the cursor
  1399.      Ctrl-Y                  deletes the rest of the line
  1400.  
  1401.      <Ins> or Ctrl-V         puts you in insert mode: what you type gets
  1402.                                 inserted  (normally, you are in overtype
  1403.                                 mode:  what you type overtypes the existing
  1404.                                 text); pressing <Ins> or Ctrl-V again, puts
  1405.                                 you back into overtype mode
  1406.  
  1407.      <End> or Ctrl-W         quits and updates text
  1408.      Ctrl-Q                  quits and does not update text
  1409.  
  1410.      Ctrl-P                  prints entire document on printer
  1411.      Alt-F                   formats program
  1412.      Alt-H                   displays a help screen
  1413.  
  1414.           To break a line into two, press <Ins> to get into insert mode,
  1415.      and press <ENTER>.  To merge two lines, delete the end of line
  1416.      character.  When you leave the line (with a cursor key or <End>), the
  1417.      two lines merge.
  1418.  
  1419.           Alt-F formats program files; it indents the lines according to
  1420.      the program structures and capitalizes the first command verb on every
  1421.      line.
  1422.  
  1423.           When using WRITE, Alt-H displays the following information (press
  1424.      any key, and the help screen disappears):
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.      WRITE                       SRI  VPI  VPIN                       WRITE
  1439.  
  1440.      SR-Info/VP-Info Reference Manual           Page 404          SECTION 4
  1441.  
  1442.  
  1443.  
  1444. ──────────────────────────────────────────────────────────────────────────────
  1445. GENERAL.PRG                        VP-Info WRITE  (Press Alt-H for Help)
  1446.  
  1447. ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
  1448.  
  1449. ┌─────────────────────────────────────────────────────────────────────────────┐
  1450. │                           VP-Info WRITER HELP                               │
  1451. │                                                                             │
  1452. │Delete and Insert              Block Commands            Miscellaneous       │
  1453. │═════════════════              ═══════════════           ═════════════       │
  1454. │Delete character..... <Del>    Mark block.... Alt-B      QUIT:               │
  1455. │Delete to end of line  ^Y      Move block.... Alt-M      with save.... <End> │
  1456. │                               Copy block.... Alt-C      without save.  ^Q   │
  1457. │Delete line..........  ^T      Delete block.. Alt-D                          │
  1458. │Insert line..........  ^N      Remove marks.. Alt-K      PRINT TEXT...  ^P   │
  1459. │                                                                             │
  1460. │Insert-mode toggle... <Ins>    Tab.......... TAB Key     FORMAT PROGRAM Alt-F│
  1461. │                                                                             │
  1462. │ ┌─────────────────────────── FAST CURSOR MOVEMENT ────────────────────────┐ │
  1463. │ │  End of line... ^<Rght>   Page up....... <PgUp>  Top of text... ^<Home> │ │
  1464. │ │  Start of line. ^<Lft>    Page down..... <PgDn>  Bottom of text ^<End>  │ │
  1465. │ └─────────────────────────────────────────────────────────────────────────┘ │
  1466. │                                                                             │
  1467. │NOTES:  1. ^ is Ctrl    2. Keys in pointed brackets are on the Numeric Keypad│
  1468. └─────────────────────────────────────────────────────────────────────────────┘
  1469.                                                  Press any key to continue ...
  1470. ──────────────────────────────────────────────────────────────────────────────
  1471.  
  1472.           Examples:
  1473.  
  1474.      1>WRITE test             ;write TEST.PRG
  1475.      1>WRITE test.txt         ;write TEST.TXT
  1476.      1>WRITE test.dat OFF     ;write TEST.DAT with suppression of header
  1477.      1>WRITE .65              ;write volume 65 in the current library
  1478.      1>WRITE .num             ;write volume number contained in NUM in the
  1479.                                 current library
  1480.      1>WRITE .num OFF         ;write volume number contained in NUM in the
  1481.                                 current library with suppression of header
  1482.      1>WRITE .:avail          ;write the next available volume (Caution: be
  1483.                                 sure to capture this value before using
  1484.                                 this construct or you'll never be able to
  1485.                                 find your text again.)
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.      WRITE                       SRI  VPI  VPIN                       WRITE
  1499.  
  1500.      SR-Info/VP-Info Reference Manual           Page 405          SECTION 4
  1501.  
  1502.  
  1503.  
  1504.                                       ZAP
  1505.  
  1506.      Erase all records in the selected file.
  1507.  
  1508.      ╔════════════════════════════════════════════════════════════════════╗
  1509.      ║ ZAP                                                                ║
  1510.      ╚════════════════════════════════════════════════════════════════════╝
  1511.  
  1512.           This command erases all the records.  This is not a DELETE.  The
  1513.      records cannot be recalled!  Use this command with care!
  1514.  
  1515.           If the selected file is indexed, it is automatically reindexed
  1516.      after ZAP.
  1517.  
  1518.           ZAP releases the disk space previously used by the records of the
  1519.      data file.
  1520.  
  1521.           On a network with SET NETWORK ON in VP-Info Professional Network
  1522.      Edition, attempting to ZAP while another user is accessing the file
  1523.      will cause a LOCK error.  Always LOCK the file before ZAP.
  1524.  
  1525.           Example:
  1526.  
  1527.      1>USE employee
  1528.      1>COPY TO empl1
  1529.      1>USE empl1
  1530.      1>ZAP
  1531.  
  1532.  
  1533.  
  1534.  
  1535.                                    APPENDIX A
  1536.  
  1537.                           The SR-Info/VP-Info Compiler
  1538.  
  1539.  
  1540.  
  1541.           Unlike most database management languages, which execute a
  1542.      program one command at a time, SR-Info/VP-Info compiles its programs
  1543.      -- that is, it processes all the commands before it begins to execute
  1544.      them. Compiling is a major reason why SR-Info/VP-Info runs faster than
  1545.      other database languages.
  1546.  
  1547.           Most of the time, the compiler will be invisible to you. However,
  1548.      compilation presents some advantages and restrictions that are unique
  1549.      to SR-Info/VP-Info, and we'll outline these in this appendix.
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.      ZAP                         SRI  VPI  VPIN                         ZAP
  1559.  
  1560.      SR-Info/VP-Info Reference Manual          Page 406          APPENDIX A
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.                         A.1. What Happens at Compilation
  1567.  
  1568.  
  1569.           Before a program can be executed, SR-Info/VP-Info must perform
  1570.      two tasks:
  1571.  
  1572.           First, the program itself must be translated into compile form.
  1573.      In compiling a program, SR-Info/VP-Info converts its commands into a
  1574.      code that is very speedily executed by your computer. In command lines
  1575.      with macros, only the command verb is coded; such lines are converted
  1576.      into SR-Info/VP-Info code later, when they are executed.
  1577.  
  1578.                               Why Not a COM File?
  1579.  
  1580.                  Many compilers for computer languages produce a single
  1581.             file with the COM or EXE extension; such files can be run
  1582.             without the compiler's presence. Why doesn't SR-Info/VP-Info
  1583.             produce such compiled programs?
  1584.  
  1585.                  Most compilers are made up of two parts. First is the
  1586.             compiler itself, the program that does the translation. Second
  1587.             is the subroutine library;  most compiled commands make a
  1588.             number of calls to this library.
  1589.  
  1590.                  At compilation, the compiled program is "linked" with the
  1591.             library (or with the part that is needed).
  1592.  
  1593.                  SR-Info/VP-Info must have the compiler present at all
  1594.             times because of macros, which are left uncompiled. Whenever it
  1595.             encounters a macro in a running program, SR-Info/VP-Info must
  1596.             access the compiler, translate the macro, then continue
  1597.             execution.
  1598.  
  1599.           Second, SR-Info/VP-Info has to prepare the computer's memory in
  1600.      order to keep track of information that the program uses and
  1601.      manipulates. The state of this memory space at any given time is
  1602.      called the environment.
  1603.  
  1604.           SR-Info/VP-Info always compiles a program before executing it. If
  1605.      you run a program in its text (PRG) form, SR-Info/VP-Info compiles it
  1606.      on the spot. The PRG file on disk is unaffected: if the program fails,
  1607.      you can still edit (or debug it) as needed.
  1608.  
  1609.      Compiled Programs
  1610.  
  1611.           You can store a program in compiled form on disk. The COMPILE
  1612.      command translates a named file with the PRG extension to a compiled
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.      Compilation                    VPI  VPIN                   Compilation
  1619.  
  1620.      SR-Info/VP-Info Reference Manual          Page 407          APPENDIX A
  1621.  
  1622.  
  1623.      program with the same filename, but with the extension CPL. This new,
  1624.      compiled file will load and begin execution more quickly. However, the
  1625.      compiled form in the CPL file can't be edited directly. If you find an
  1626.      error in the program, edit the PRG file, then compile it again.
  1627.  
  1628.           SR-Info/VP-Info always attempts to run the compiled version of a
  1629.      program first. It will run the PRG file only if it finds no compiled
  1630.      version on the disk.
  1631.  
  1632.           You can also compile a list of programs; see the COMPILE command
  1633.      in Section 4.3.
  1634.  
  1635.           In some ways, compiling is a "dry run" of the program: the
  1636.      compiler opens and closes the named data files, creates all of the
  1637.      memory variables (but types and values are not attached), sets up
  1638.      internal tables (stacks) for nested command structures, and tests
  1639.      expressions for validity (for form, not for variable types). The
  1640.      errors found at this stage are called compile-time errors.
  1641.  
  1642.           It's important to remember that compiling a program is not
  1643.      exactly the same as executing it; rather, it is the preparation for
  1644.      speedy execution. Certain types of errors do not appear at compile
  1645.      time. These errors are called run-time errors. Most often they involve
  1646.      variables of the wrong type.
  1647.  
  1648.           Compile-time errors are always reported by SR-Info/VP-Info with
  1649.      the line number. Run-time errors report line numbers only if the line
  1650.      numbers are compiled into the program; this is accomplished with the
  1651.      SET LINE ON command (the default).
  1652.  
  1653.           To understand the effect of the compiler on programs, it helps to
  1654.      know something about how the compiler reads the text of a program and
  1655.      about how SR-Info/VP-Info manages memory - its environment.
  1656.  
  1657.  
  1658.  
  1659.                         A.2. SR-Info/VP-Info Environment
  1660.  
  1661.  
  1662.           The term environment refers to the current arrangement of memory,
  1663.      SR-Info/VP-Info's "workspace."  This is where SR-Info/VP-Info keeps
  1664.      track of all of the data files and variables being used, the program
  1665.      being executed, and other special settings.
  1666.  
  1667.      The SET File
  1668.  
  1669.           SR-Info/VP-Info always runs under DOS, in what is left of the
  1670.      computer's memory after DOS itself (and possibly some memory-resident
  1671.      programs and/or a network) are loaded.  If total memory is 640K,
  1672.      anywhere from 350K to 550K will be available to SR-Info/VP-Info.  If
  1673.      not enough free memory is available, SR-Info/VP-Info cannot be run.
  1674.  
  1675.  
  1676.  
  1677.  
  1678.      Environment                    VPI  VPIN                   Environment
  1679.  
  1680.      SR-Info/VP-Info Reference Manual          Page 408          APPENDIX A
  1681.  
  1682.  
  1683.  
  1684.           SR-Info does not allow the user to custom-tailor memory in any
  1685.      way, since it always attempts to load 128K of internal high memory in
  1686.      addition to the space it takes itself and a 64K work space.  VP-Info
  1687.      Professional, however, allows high-memory to be limited to as little
  1688.      at 32K, and to allocate up to 32K for loading assembly-language
  1689.      modules assembled into binary files and executed from within VP-Info
  1690.      Professional.
  1691.  
  1692.           The DOS memory looks like this when fully loaded
  1693.  
  1694.                                                Top of DOS memory
  1695.      ───────────────────────────────────────────────────────────
  1696.        1. External high memory (used by RUN command)
  1697.      ───────────────────────────────────────────────────────────
  1698.        2. DOS file buffers if files more than 20 (FILES=)
  1699.      ───────────────────────────────────────────────────────────
  1700.        3. BIN file space if any (BINSPACE=)
  1701.      ───────────────────────────────────────────────────────────
  1702.        4. Internal high memory (MEMORY=)
  1703.      ───────────────────────────────────────────────────────────
  1704.        5. Data space (64K)
  1705.      ───────────────────────────────────────────────────────────
  1706.        6. SR-Info/VP-Info (200K)
  1707.      ───────────────────────────────────────────────────────────
  1708.        7. Memory-resident programs, if any (unload in necessary)
  1709.      ───────────────────────────────────────────────────────────
  1710.        8. Operating system (35-50K)
  1711.      ───────────────────────────────────────────────────────────
  1712.                                             Bottom of DOS memory
  1713.  
  1714.           The special files called VPI.SET and VPIN.SET for the single-user
  1715.      and network versions of VP-Info Professional respectively provide
  1716.      control over levels 2 through 4 (see these commands in Section 4.3),
  1717.      while the FIELDS= command affects the allocation of memory within
  1718.      level 5.  (NOEFFECTS is used to suppress screen and sound effects, and
  1719.      has no effect on the environment.)
  1720.  
  1721.      What is the Environment?
  1722.  
  1723.           SR-Info/VP-Info takes control of all memory in levels 2
  1724.      through 6, an area generally termed the "environment."  Much of the
  1725.      environment remains constant, but we are concerned primarily with the
  1726.      items that can change.
  1727.  
  1728.           Therefore, you can think of the environment, in part, as all data
  1729.      files that are currently open (with their respective fields) and the
  1730.      file numbers assigned to them. Changing the set of open data files
  1731.      produces a different environment.
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.      Environment                    VPI  VPIN                   Environment
  1739.  
  1740.      SR-Info/VP-Info Reference Manual          Page 409          APPENDIX A
  1741.  
  1742.  
  1743.           For example, these data file actions serve to establish and
  1744.      change the environment:
  1745.  
  1746.           A.   Opening a data file (with the USE command).
  1747.  
  1748.           B.   Assigning a file number to a data file (SELECT, USE).
  1749.  
  1750.           C.   Closing a data file (CLOSE, CLEAR).
  1751.  
  1752.           D.   Changing the structure of a data file (MODIFY).
  1753.  
  1754.           E.   Opening or closing index files (USE, SET INDEX).
  1755.  
  1756.           (To see a "snapshot" of the environment, give the STATUS command.
  1757.      This displays information about the current state of open data files,
  1758.      SET switches, and memory variables.)
  1759.  
  1760.           Memory variables, too, are part of the environment, and the
  1761.      environment is affected when you create a new memory variable (with =,
  1762.      STORE, et al; see "Variables" in the Topical Reference) or release an
  1763.      existing one (RELEASE, CLEAR). The data-type and contents of the
  1764.      individual memory variables are not significant to the environment;
  1765.      what is important is the order in which they are created.
  1766.  
  1767.           SR-Info/VP-Info keeps track of the data files and memory
  1768.      variables by creating reference tables in memory. These tables are
  1769.      described in more detail later in this section.
  1770.  
  1771.           Finally, there are specific environmental commands: the SET
  1772.      commands (SET . . . TO) and SET switches (SET . . . ON/OFF). They are
  1773.      used in conversational mode, in programs, and in the configuration
  1774.      file VPI.CNF to customize  SR-Info/VP-Info. For explanations of the
  1775.      individual SET controls, refer to the Alphabetical Command Reference.
  1776.  
  1777.      The Configuration File
  1778.  
  1779.           The configuration CNF file is a program that, if present, is
  1780.      automatically executed when you start SR-Info/VP-Info from DOS.
  1781.  
  1782.           VPI.CNF can contain most commands. Its primary purpose, however,
  1783.      is to configure SR-Info/VP-Info's default settings to your computer
  1784.      and to your applications. Typical commands in the configuration file
  1785.      are the SET commands and switches, in particular, SET DEFAULT, SET
  1786.      MEMORY, and SET FIELDS; values assigned to system variables and
  1787.      function keys, in particular, to :COMPANY; also, the structure FILES
  1788.      . . . ENDFILES normally appears in this file.
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.      Environment                    VPI  VPIN                   Environment
  1799.  
  1800.      SR-Info/VP-Info Reference Manual          Page 410          APPENDIX A
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.                         A.3. SR-Info/VP-Info Memory Use
  1807.  
  1808.  
  1809.           The table in Section A.2. illustrates how SR-Info/VP-Info uses
  1810.      memory (RAM) space:
  1811.  
  1812.           SR-Info/VP-Info itself utilizes about 200K of memory. To maximize
  1813.      speed, the EXE program is not overlayed so it all goes into memory at
  1814.      one time . . . an advantage of being kept "lean and mean."
  1815.  
  1816.      Data Space
  1817.  
  1818.           The following table illustrates the use of the 64K of data space
  1819.      reserved by SR-Info/VP-Info:
  1820.  
  1821.      ───────────────────────────────────────────────────────────
  1822.         DOS work space (for Read buffers)
  1823.      ───────────────────────────────────────────────────────────
  1824.         Data file table (Fields Table)
  1825.      ───────────────────────────────────────────────────────────
  1826.         Data Records (data file buffer)
  1827.            Indexes
  1828.            Relations
  1829.            Limit
  1830.      ───────────────────────────────────────────────────────────
  1831.         Work space (about 25K)
  1832.      ───────────────────────────────────────────────────────────
  1833.         DOS stack
  1834.      ───────────────────────────────────────────────────────────
  1835.         Internal data space (fixed)
  1836.      ───────────────────────────────────────────────────────────
  1837.  
  1838.      Data File Table
  1839.  
  1840.           The data file table tracks all open data files. It includes an
  1841.      entry for each field of each data file in use, describing the field,
  1842.      and a pointer (a number indicating location in memory) to the data
  1843.      file buffer for the contents of the field.
  1844.  
  1845.           Any time a data file is opened, a memory area, called a buffer,
  1846.      is set up for it, the size of one record.
  1847.  
  1848.           The size of the data file table is 320 fields, unless changed in
  1849.      the SET file by a FILES= command in VP-Info Professional. For
  1850.      instance, the commands:
  1851.  
  1852.      USE employee
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.      Memory                         VPI  VPIN                        Memory
  1859.  
  1860.      SR-Info/VP-Info Reference Manual          Page 411          APPENDIX A
  1861.  
  1862.  
  1863.      USE#2 supplier
  1864.      USE#3 invntory
  1865.  
  1866.      set up a data file table like this:
  1867.  
  1868.      |-----25----|-----17-----|-----35-----|--------243-----------|
  1869.        employee    supplier     invntory          unused
  1870.  
  1871.           Now if you close supplier:
  1872.  
  1873.      1>CLOSE#2
  1874.  
  1875.      the table becomes:
  1876.  
  1877.      |-----25----|-----17-----|-----35-----|--------243-----------|
  1878.         employee     unused     invntory          unused
  1879.  
  1880.           When the next file is opened, is goes into the vacant space if it
  1881.      has 17 or fewer fields, otherwise it goes after INVNTORY:
  1882.  
  1883.      1>USE#2 order
  1884.  
  1885.      yielding either
  1886.  
  1887.      |-----25----|-----17-----|-----35-----|--------243-----------|
  1888.         employee     order       invntory         unused
  1889.  
  1890.      or
  1891.  
  1892.      |-----25----|-----17-----|-----35-----|--20--------223-------|
  1893.         employee     unused     invntory     order     unused
  1894.  
  1895.           Care must be taken to avoid creating too many "holes."  As a
  1896.      suggestion, assign all files that never close to the lower file
  1897.      numbers (1, 2, 3, . . . ). Then use the succeeding file numbers to put
  1898.      the transient files into use, in the order of their size (in fields),
  1899.      with the largest ones first.
  1900.  
  1901.           If you run into an error message indicating that you've run out
  1902.      of space, then CLOSE ALL data files, and put the needed files into use
  1903.      again. This caution is necessary if you open and close data files more
  1904.      than once in a program, if you use commands that create files (COPY
  1905.      TO, TOTAL, SORT) or if you use commands that temporarily open data
  1906.      files (POST, APPEND FROM).
  1907.  
  1908.      Data Records
  1909.  
  1910.           An index file uses a buffer of 768 bytes. Each relation
  1911.      established with SET RELATION, each filter set with SET FILTER, and
  1912.      each limit set with LIMIT or SCOPE commands, takes 128 bytes.
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.      Memory                         VPI  VPIN                        Memory
  1919.  
  1920.      SR-Info/VP-Info Reference Manual          Page 412          APPENDIX A
  1921.  
  1922.  
  1923.  
  1924.      Program Space
  1925.  
  1926.           Programs load and compile in this space. Certain other commands
  1927.      affect the amount of memory actually available for programs. The
  1928.      REPORT command needs about 5K, so programs that use REPORT must be 18K
  1929.      maximum. The number of bytes available in the program space is given
  1930.      by the SPACE() function and also by the STATUS command.
  1931.  
  1932.      The Internal Data Space
  1933.  
  1934.           The internal data space reserves all the memory SR-Info/VP-Info
  1935.      needs for internal variables, stacks, and so on. The size of the
  1936.      internal SR-Info/VP-Info data space is fixed by SR-Info/VP-Info;  it
  1937.      may change from version to version. Since programs compile right on
  1938.      top of this space, all user programs may have to be recompiled
  1939.      whenever a new version of SR-Info/VP-Info is used.
  1940.  
  1941.           The internal data space contains a number of important tables.
  1942.  
  1943.      The Memory Variable Table
  1944.  
  1945.           This table has 128 entries. It describes all the memory variables
  1946.      in use. For each variable, it contains a pointer (a number indicating
  1947.      location in memory) to the contents of the variable. The contents
  1948.      could be in the compiled text (some strings), in the memory variable
  1949.      storage table, or (for matrix variables) in high memory.
  1950.  
  1951.      The Memory Variable Storage Table
  1952.  
  1953.           This contains the contents of those memory variables not in the
  1954.      compiled text or stored as matrices in high memory. It is 4K in size.
  1955.  
  1956.      Stacks
  1957.  
  1958.           Used during compilation and program execution, stacks are
  1959.      internal tables that keep track of the nesting structures IF and DO
  1960.      WHILE and DO commands. Various stacks are utilized by SR-Info/VP-Info.
  1961.      If too many levels of nesting are used, and one of these stacks runs
  1962.      out of room, an error message is issued.
  1963.  
  1964.      Internal High Memory
  1965.  
  1966.           The internal high memory usage is illustrated in the following
  1967.      table:
  1968.  
  1969.                                            (External high memory)
  1970.                                 High-end of internal high memory
  1971.      ───────────────────────────────────────────────────────────
  1972.         Matrix variables
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.      Memory                         VPI  VPIN                        Memory
  1979.  
  1980.      SR-Info/VP-Info Reference Manual          Page 413          APPENDIX A
  1981.  
  1982.  
  1983.      ───────────────────────────────────────────────────────────
  1984.         Index buffers      (10K-64K)
  1985.      ───────────────────────────────────────────────────────────
  1986.         FILES table
  1987.      ───────────────────────────────────────────────────────────
  1988.         screens 2, 3, 4   (4K each)
  1989.      ───────────────────────────────────────────────────────────
  1990.         Temporary storage
  1991.      ───────────────────────────────────────────────────────────
  1992.         Command lines
  1993.      ───────────────────────────────────────────────────────────
  1994.                                  Low-end of internal high memory
  1995.                                                      (Data space)
  1996.  
  1997.           SR-Info/VP-Info uses 128K of high memory as internal high memory
  1998.      (unless MEMORY= is used in the SET file, VP-Info Professional only;
  1999.      see "External High Memory," below).
  2000.  
  2001.           800 bytes are reserved for command line storage. Index buffers
  2002.      take a minimum of 10K; ordinarily, they take half of internal high
  2003.      memory, to a maximum of 64K.
  2004.  
  2005.           The FILES table is created from the FILES . . . ENDFILES
  2006.      structure.
  2007.  
  2008.           Each matrix variable may occupy up to 64K of memory. There can be
  2009.      at most 20 matrix variables in use at one time.
  2010.  
  2011.           The STATUS command displays the number of bytes left in high
  2012.      memory.
  2013.  
  2014.      External High Memory
  2015.  
  2016.           External high memory is essentially whatever is left over after
  2017.      SR-Info/VP-Info takes the amount it needs plus as much internal high
  2018.      memory and BINSPACE is requested or available, whichever is less.  To
  2019.      maximize external high memory available to the RUN command, VP-Info
  2020.      Professional users can reduce the amount of internal high memory
  2021.      requested; example MEMORY=64.
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.      Memory                         VPI  VPIN                        Memory
  2039.  
  2040.      SR-Info/VP-Info Reference Manual          Page 414          APPENDIX A
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.                           A.4. Modules and Environment
  2047.  
  2048.  
  2049.           The SR-Info/VP-Info compiler treats each kind of module (stored
  2050.      command sequence) differently. The differences lie in the way each
  2051.      module type interacts with the environment.
  2052.  
  2053.      Procedures
  2054.  
  2055.           A procedure is defined in a PROCEDURE . . . ENDPROCEDURE
  2056.      structure, and called (executed) by the PERFORM command.
  2057.  
  2058.           A procedure is compiled only once, the first time it is called.
  2059.      This means that if the procedure is "sensitive" to the environment --
  2060.      that is, if it refers to data files, fields, or memory variables --
  2061.      then it can only be called into the same environment as when it was
  2062.      compiled.
  2063.  
  2064.           If the environment changes -- i.e., if the data file numbers are
  2065.      reassigned or memory variables released -- then the procedure must not
  2066.      be affected by these changes: it must not refer to the changed part of
  2067.      the data file table or memory variable table.
  2068.  
  2069.      Subroutines
  2070.  
  2071.           A subroutine is a command sequence stored in a separate program.
  2072.      It isn't compiled as a separate file, but rather as part of the main
  2073.      program that calls it with the DO command. (See, however, the section
  2074.      "Compiling Multiple Subroutines.")
  2075.  
  2076.           On the disk, the compiled subroutine becomes a part of the
  2077.      compiled main program; in execution, it becomes an overlay. This means
  2078.      that when the execution reaches the subroutine, the main program is
  2079.      exited; its status at this point is recorded. The compiled subroutine
  2080.      is brought in; it overwrites (overlays) the main program. When the
  2081.      subroutine is exited, the main program is brought back, its status
  2082.      recovered, and execution continues.
  2083.  
  2084.           Unlike a procedure, a subroutine is compiled each time it's
  2085.      called. If there are five DO commands that call a single subroutine,
  2086.      then the subroutine is compiled five times - each time with the
  2087.      current environment - into the main program.
  2088.  
  2089.           To avoid unnecessary compilations of subroutines, place them in
  2090.      procedures. For instance, the subroutine SUMMING is used with two
  2091.      different environments 15 times in a program. Using DO SUMMING 15
  2092.      times would result in a compiled program that is far too large.
  2093.      Instead, define two procedures:
  2094.  
  2095.  
  2096.  
  2097.  
  2098.      Program Modules                VPI  VPIN               Program Modules
  2099.  
  2100.      SR-Info/VP-Info Reference Manual          Page 415          APPENDIX A
  2101.  
  2102.  
  2103.  
  2104.      PROCEDURE summing1
  2105.      DO summing
  2106.      ENDPROCEDURE
  2107.  
  2108.      PROCEDURE summing2
  2109.      DO summing
  2110.      ENDPROCEDURE
  2111.  
  2112.           Give the command PERFORM SUMMING1 in the first environment, and
  2113.      PERFORM SUMMING2 in the second environment. This will make the
  2114.      compiled program substantially smaller.
  2115.  
  2116.      Chained Programs
  2117.  
  2118.           The simplest kind of module is a program. One program can be
  2119.      executed from within another using the CHAIN command. When this
  2120.      command is used, the environment is cleared and the new, chained
  2121.      program begins execution with a "clean slate." All data files to be
  2122.      used must be re-opened and memory variables redefined.
  2123.  
  2124.           Memory variables (but not matrices) can be passed between chained
  2125.      files by using the GLOBAL command; see GLOBAL in the Alphabetical
  2126.      Command Reference.
  2127.  
  2128.           A program called by CHAIN does not return to the calling program.
  2129.      Any program may be chained to any other; a program may even be chained
  2130.      to itself (for example, in an ON ESCAPE structure, CHAIN can be used
  2131.      to re-start the current program).
  2132.  
  2133.  
  2134.  
  2135.                           A.5. The Compilation Process
  2136.  
  2137.  
  2138.           Some aspects of compilation have an impact on VP- Info
  2139.      programming. This section gives you an overview of the compilation
  2140.      process.
  2141.  
  2142.      Compiling the Program
  2143.  
  2144.           In compiling a program, SR-Info/VP-Info analyzes the text of each
  2145.      command line, and rewrites it into a language that can call up
  2146.      SR-Info/VP-Info's own internal functions as they are needed.
  2147.  
  2148.           SR-Info/VP-Info is a one pass compiler. This means that
  2149.      SR-Info/VP-Info compiles the command lines one at a time.
  2150.  
  2151.      Steps of compilation:
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.      Compilation Process            VPI  VPIN           Compilation Process
  2159.  
  2160.      SR-Info/VP-Info Reference Manual          Page 416          APPENDIX A
  2161.  
  2162.  
  2163.           A.   The compiler replaces all memory variables by pointers to
  2164.                the memory variable table. At compile time, the type of the
  2165.                variable is not entered into the table, only the name and
  2166.                the order in which they are defined.
  2167.  
  2168.                This should be kept in mind when using the commands:
  2169.                RELEASE, CLEAR, RESTORE FROM, GLOBAL, CHAIN, and DO.
  2170.  
  2171.                All memory variable files (MEM files, created with SAVE TO)
  2172.                have to be present at compilation when a RESTORE command is
  2173.                used.
  2174.  
  2175.           B.   The compiler replaces all fields by pointers to the data
  2176.                file table. In the data file table, there are pointers to
  2177.                the data file buffer for the current contents of the fields.
  2178.  
  2179.                This should be kept in mind when using the commands USE,
  2180.                SELECT, and CLOSE. For instance,
  2181.  
  2182.                USE cust
  2183.  
  2184.                cannot be compiled unless the CUST file is present. Of
  2185.                course, CUST need not have any records (just a structure),
  2186.                and it does not have to be on the same disk drive at
  2187.                execution time (this can be controlled with SET DEFAULT
  2188.                command and the FILES . . . ENDFILES structure).
  2189.  
  2190.                See also "Compiling and Data Files" latter in this Appendix
  2191.                for alternate ways to refer to data files.
  2192.  
  2193.           C.   The commands are rewritten into SR-Info/VP-Info's own
  2194.                internal language. The internal commands mostly call
  2195.                functions in SR-Info/VP-Info.
  2196.  
  2197.                When a macro is encountered, the command verb is coded, and
  2198.                the compilation of the line is put off until execution time.
  2199.  
  2200.           D.   Pointers are placed in compiled command lines to indicate
  2201.                the beginning or end of a control structure, or of some part
  2202.                of the control structure. For instance, each CASE includes a
  2203.                pointer to the line containing the next CASE; each ENDREPEAT
  2204.                includes a pointer to the REPEAT command that begins the
  2205.                structure.
  2206.  
  2207.                More specifically, when SR-Info/VP-Info encounters the
  2208.                command:
  2209.  
  2210.                IF cond
  2211.  
  2212.                where cond is a logical expression, it puts the location of
  2213.                the compiled line on the IF stack. When ENDIF is
  2214.  
  2215.  
  2216.  
  2217.  
  2218.      Compilation Process            VPI  VPIN           Compilation Process
  2219.  
  2220.      SR-Info/VP-Info Reference Manual          Page 417          APPENDIX A
  2221.  
  2222.  
  2223.                encountered, this location is pulled off the IF stack, and
  2224.                the location after ENDIF placed into the IF line. So if cond
  2225.                is false, at execution time SR-Info/VP-Info knows where to
  2226.                jump to go beyond the command sequence it does not have to
  2227.                execute. This is what is known as forward referencing.
  2228.  
  2229.                Forward referencing contributes significantly to
  2230.                SR-Info/VP-Info's speed advantages over other database
  2231.                languages.
  2232.  
  2233.                             Forward Referencing in Action
  2234.  
  2235.                          Here's an example of just how speedy forward
  2236.                     referencing makes SR-Info/VP-Info compared to other
  2237.                     database languages.
  2238.  
  2239.                          Consider the following program:
  2240.  
  2241.                     STORE 0 to count
  2242.                     STORE 1 to a
  2243.                     DO WHILE count<500
  2244.                        DO CASE
  2245.                     ******************** 1
  2246.                        CASE 1=2
  2247.                           STORE a to dummy
  2248.                           STORE a to dummy
  2249.                           STORE a to dummy
  2250.                           * each CASE consists of above STORE line 50 times
  2251.                     ******************** 2
  2252.                           * total of 5 cases, all false,
  2253.                           * all with same line 50 times
  2254.                        CASE 1=2
  2255.                           STORE a to dummy
  2256.                           STORE a to dummy
  2257.                        ENDCASE
  2258.                        STORE count+1 to count
  2259.                     ENDDO
  2260.  
  2261.                          This 267-line program does not do much. It repeats
  2262.                     500 times, using the DO WHILE . . . ENDDO structure
  2263.                     (rather than REPEAT . . . ENDREPEAT which is not a
  2264.                     command of the dBASE languages) and the DO CASE . . .
  2265.                     ENDDO structure. There are 5 CASEs, each one with a
  2266.                     false expression as a condition, so none is ever
  2267.                     executed. Each CASE is 50 lines long; since these lines
  2268.                     never get executed, it does not matter what they
  2269.                     contain.
  2270.  
  2271.                          The SR-Info version was compiled first and the CPL
  2272.                     file was run, beating the fastest dBASE version by
  2273.                     100-1.
  2274.  
  2275.  
  2276.  
  2277.  
  2278.      Compilation Process            VPI  VPIN           Compilation Process
  2279.  
  2280.      SR-Info/VP-Info Reference Manual          Page 418          APPENDIX A
  2281.  
  2282.  
  2283.  
  2284.                          Forward referencing clearly provides a significant
  2285.                     improvement in processing speed. And, although this
  2286.                     program is for testing purposes only, its structure is
  2287.                     very similar to many business programs. For instance, a
  2288.                     payroll program with 5 different types of employees
  2289.                     would have this type of structure.
  2290.  
  2291.           E.   Procedures are compiled wherever they are first performed.
  2292.  
  2293.           F.   Subroutines are compiled into the main program with each
  2294.                calling DO command; a subroutine called three times is
  2295.                compiled three times.
  2296.  
  2297.  
  2298.  
  2299.                          A.6. Compiling and Data Files
  2300.  
  2301.  
  2302.           Several aspects of using data file references within
  2303.      SR-Info/VP-Info programs require special attention. These are covered
  2304.      in the following few sections.
  2305.  
  2306.      Conditional Opening and Closing of Data Files
  2307.  
  2308.           SR-Info/VP-Info compiles all command lines, whether or not the
  2309.      conditions controlling their execution are true (that is, whether or
  2310.      not they are ever executed when the program is run). At compile time,
  2311.      SR-Info/VP-Info cannot know the status of all conditions, since
  2312.      conditions may be decided by the user or the program while it is
  2313.      running, not in advance.
  2314.  
  2315.           This compilation process has implications that need to be
  2316.      considered when opening and closing data files in conditional
  2317.      structures.
  2318.  
  2319.           Take a simple example of two data files; T1 contains the field
  2320.      VAR1 and T2 contains VAR2. Now, say we try to use the following
  2321.      command sequence:
  2322.  
  2323.      USE t2            ;T2 is opened
  2324.      IF cond
  2325.         USE t1         ;T1 is opened
  2326.         ? var1
  2327.      ELSE
  2328.         ? var2
  2329.         T1 is still open
  2330.      ENDIF
  2331.  
  2332.           This command sequence, which would run perfectly under dBASE,
  2333.      fails to compile in SR-Info/VP-Info. Here's why:
  2334.  
  2335.  
  2336.  
  2337.  
  2338.      Compiling and Data Files       VPI  VPIN      Compiling and Data Files
  2339.  
  2340.      SR-Info/VP-Info Reference Manual          Page 419          APPENDIX A
  2341.  
  2342.  
  2343.  
  2344.           When SR-Info/VP-Info compiles the IF structure, it does not know
  2345.      whether cond will be true or false at execution time. So, when the
  2346.      next command line opens data file T1 (thereby closing T2), the
  2347.      SR-Info/VP-Info compiler performs this operation.
  2348.  
  2349.           However, in the ELSE clause (which at execution is performed when
  2350.      the condition is false), the program looks for the field VAR2 (which
  2351.      is in the now closed data file T2). The result is a compiler error.
  2352.      Note also that if the ELSE clause didn't refer to T2, any command
  2353.      following this IF structure that expected T2 to be open would create
  2354.      such an error.
  2355.  
  2356.           Because of the compiler's way of carrying out commands, it is
  2357.      recommended that you open and select all data files at the beginning
  2358.      of a program, if possible. Limit the use of the commands USE, CLOSE,
  2359.      RELEASE, CLEAR, and RESTORE in conditional command structures.
  2360.  
  2361.           If you must include commands such as USE in a DO CASE or IF
  2362.      structure, include one at the beginning of each case (including ELSE
  2363.      and OTHERWISE), and one after the END command:
  2364.  
  2365.      IF
  2366.         USE <filename>
  2367.         <command sequence>
  2368.      ELSE
  2369.         USE <filename>
  2370.         <command sequence>
  2371.      ENDIF
  2372.      USE <filename>
  2373.      . . .
  2374.  
  2375.  
  2376.      DO CASE
  2377.      CASE
  2378.         USE <filename>
  2379.         <command sequence>
  2380.      CASE
  2381.         USE <filename>
  2382.         <command sequence>
  2383.      OTHERWISE
  2384.         USE <filename>
  2385.         <command sequence>
  2386.      ENDCASE
  2387.      USE <filename>
  2388.  
  2389.           Note that such programs also run under dBASE. In fact this
  2390.      technique is good programming practice in either SR-Info/VP-Info or
  2391.      dBASE, since it makes data file choices more explicit.
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.      Compiling and Data Files       VPI  VPIN      Compiling and Data Files
  2399.  
  2400.      SR-Info/VP-Info Reference Manual          Page 420          APPENDIX A
  2401.  
  2402.  
  2403.      Referencing Unknown Data Files
  2404.  
  2405.           To open data files and use field references in a program, it's
  2406.      essential that the data files referred to be present at compile time.
  2407.      Data files must be available on the path specified (either with a
  2408.      FILES structure, with SET DEFAULT, or with USE <drive
  2409.      letter>:<filename>).
  2410.  
  2411.           (Since index files are not opened at compile time, they need not
  2412.      be present on disk when compiling.)
  2413.  
  2414.           If a data file used by a program is unavailable or unknown at
  2415.      compile-time, follow one of these suggestions:
  2416.  
  2417.           A.   If the name and structure are known, but the file doesn't
  2418.                exist, create an empty data file with the name and structure
  2419.                of the missing data file. Remember, the compiler doesn't
  2420.                read data - it only checks to make sure the proper fields
  2421.                are present for the commands to be executed.
  2422.  
  2423.           B.   If the name and structure of the data file are unknown (that
  2424.                is, if these will be supplied by the user at execution),
  2425.                open the data file with a macro in the USE command, and use
  2426.                macros in place of any field references within the program.
  2427.  
  2428.           C.   As an alternative to using macros in place of field
  2429.                references, you can make sure that each command line
  2430.                referring to a field in an unknown data file contains at
  2431.                least one macro. Including a macro defers compiling of a
  2432.                command line until execution, when the structure of the data
  2433.                file will be known.
  2434.  
  2435.           D.   If the structure is known, but the name is unknown (if it
  2436.                will be supplied by the user at execution), give a USE
  2437.                command with the COMPILE keyword. USE . . . COMPILE lets you
  2438.                open a data file with an identical file structure for
  2439.                compile-time references. A second USE command, containing a
  2440.                user-supplied file name in a macro, opens the desired file
  2441.                at run-time (i.e., upon actual execution of the program).
  2442.  
  2443.           The following two USE commands coexist peacefully within the same
  2444.      program, the first working at compile time, the second at execution.
  2445.  
  2446.      USE#2 inven COMPILE
  2447.      USE#2 &filename
  2448.  
  2449.           Here's how this sequence works:
  2450.  
  2451.           At compile time . . . USE#2 inven COMPILE tells the compiler to
  2452.      open the data file INVEN.DBF as a surrogate for file 2. The structure
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.      Compiling and Data Files       VPI  VPIN      Compiling and Data Files
  2459.  
  2460.      SR-Info/VP-Info Reference Manual          Page 421          APPENDIX A
  2461.  
  2462.  
  2463.      of INVEN (field names, field types, etc.) is used wherever file 2 is
  2464.      referred to in the program.
  2465.  
  2466.           USE#2 &filename is only partially compiled (as are all commands
  2467.      with macros).
  2468.  
  2469.           At execution . . . USE#2 inven COMPILE is ignored.
  2470.  
  2471.           USE #2 &filename is used, with the user supplying the filename
  2472.      for this data file. The file structure (field names, field types,
  2473.      etc.) of this file must be the same as that of inven.
  2474.  
  2475.           This is useful when several people use the same program to access
  2476.      data files with the same structure, but different file names; for
  2477.      example, if several sales entry clerks have their own transaction
  2478.      files to which they enter orders.
  2479.  
  2480.      Commands That Close Data Files
  2481.  
  2482.           Another set of commands to be careful with are those used to move
  2483.      data from one data file to another. These are APPEND FROM, COPY, COPY
  2484.      STRUCTURE, POST, SORT, and TOTAL. They are alike in that the data file
  2485.      named in them is left closed once the command is executed.
  2486.  
  2487.           Actually what happens is this: when SR-Info/VP-Info encounters
  2488.      one of these command, it looks for the named file. If the named file
  2489.      is open, it is first closed. Then it is opened as a temporary,
  2490.      internal data file. Once SR-Info/VP-Info finishes executing the
  2491.      command, the internal file is once again closed.
  2492.  
  2493.           As a result, you must reopen any data file named by one of these
  2494.      commands if subsequent commands refer to fields in this named data
  2495.      file.
  2496.  
  2497.           Here is a command sequence that uses a temporary data file
  2498.      (tempcust) to add customer records. When it finds there are no more
  2499.      additions to make, it appends the temporary data file to the main data
  2500.      file (customer):
  2501.  
  2502.      USE#2 customer               ;Opens customer
  2503.      SELECT 1
  2504.      USE tempcust                 ;Opens tempcust
  2505.      ZAP
  2506.      DO WHILE T
  2507.         <command sequence>        ;Commands for record entry
  2508.         IF name ='     '          ;Typical way of ending program
  2509.            SELECT 2
  2510.            USE customer
  2511.            APPEND FROM tempcust   ;Copies from tempcust to customer,
  2512.                                   ;leaving tempcust closed
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.      Compiling and Data Files       VPI  VPIN      Compiling and Data Files
  2519.  
  2520.      SR-Info/VP-Info Reference Manual          Page 422          APPENDIX A
  2521.  
  2522.  
  2523.            CLOSE                  ;Closes customer
  2524.            SELECT 1
  2525.         ENDIF
  2526.         <command sequence>        ;These commands refer again to tempcust
  2527.      ENDDO
  2528.  
  2529.           The flaw in this command sequence should be clear from the above
  2530.      discussion. Since APPEND FROM names tempcust, this data file is closed
  2531.      and then reopened as a temporary, internal data file. As a result,
  2532.      subsequent references to a field in tempcust (in the command sequence
  2533.      following ENDIF) will cause compiling to cease with this error
  2534.      message:
  2535.  
  2536.      "2. Variable not found."
  2537.  
  2538.           This sequence is fixed by simply adding the command USE#1
  2539.      tempcust COMPILE, as follows:
  2540.  
  2541.            . . .
  2542.            SELECT 1
  2543.            USE#1 tempcust COMPILE
  2544.         ENDIF
  2545.         <command sequence>
  2546.      ENDDO
  2547.  
  2548.           All the commands listed above (APPEND FROM, COPY, COPY STRUCTURE,
  2549.      POST, SORT and TOTAL) have the same effect and require a USE . . .
  2550.      COMPILE command as above if fields within the named file are
  2551.      referenced later in the program.
  2552.  
  2553.  
  2554.  
  2555.                  A.7. How SR-Info/VP-Info Reads a Command Line
  2556.  
  2557.  
  2558.           In SR-Info/VP-Info, a command line is defined as the text from
  2559.      the beginning of a line up to a carriage return (indicating the end of
  2560.      the line) or a semicolon. A semicolon followed by a comment is ignored
  2561.      by the compiler; a semicolon followed by a carriage return (ENTER)
  2562.      indicates that the command line continues in the next line.
  2563.  
  2564.      Analyzing a Command Line
  2565.  
  2566.           The compiler analyzes the command line beginning with the first
  2567.      word. It checks the first word by taking the following steps and acts
  2568.      on the first case that applies:
  2569.  
  2570.           Step 1. Is the first word a ? or ?? command?
  2571.  
  2572.           Step 2. Does the first word contain a command redirection (e.g.,
  2573.                     in USE#2)?
  2574.  
  2575.  
  2576.  
  2577.  
  2578.      Reading the Command Line       VPI  VPIN      Reading the Command Line
  2579.  
  2580.      SR-Info/VP-Info Reference Manual          Page 423          APPENDIX A
  2581.  
  2582.  
  2583.  
  2584.           Step 3. If the first word is a number, then the line is rewritten
  2585.                     as a GOTO command.
  2586.  
  2587.           Step 4. The first four letters of the first word are looked up in
  2588.                     a table of command-verbs.
  2589.  
  2590.           Step 5. If the first word is followed by an equal sign (=) or an
  2591.                     open square-bracket ([), the line is rewritten as a
  2592.                     STORE or REPLACE command. (Note that step 5 overrides
  2593.                     the decision made by step 4; see example below.)
  2594.  
  2595.           Step 6. If Steps 4 and 5 both fail, SR-Info/VP-Info displays an
  2596.                     error message.
  2597.  
  2598.           Step 7. The line is checked for a macro (if a macro is permitted
  2599.                     for the command identified in Step 4).
  2600.  
  2601.           Step 8. SR-Info/VP-Info jumps to the compilation routine of the
  2602.                     command found in Step 4.
  2603.  
  2604.           Step 9. If the first word is SET, SR-Info/VP-Info checks whether
  2605.                     it is a setting command (e.g., SET ALTERNATE TO, SET
  2606.                     COLOR TO; these are separate commands) or a switch
  2607.                     (e.g., SET ADD ON, SET BELL OFF; these are all
  2608.                     different parameters of a single command). If no valid
  2609.                     command or parameter is found, the line is ignored.
  2610.  
  2611.      Analyzing Expressions
  2612.  
  2613.           After it has determined the type of command contained in a
  2614.      command line (according to the above steps), SR-Info/VP-Info
  2615.      determines the contents of expressions contained in the command line.
  2616.  
  2617.           Expressions are built up from variables and functions. Wherever
  2618.      SR-Info/VP-Info identifies an expression, it searches for the type of
  2619.      each element in the expression, in the following order:
  2620.  
  2621.           1.   Function
  2622.           2.   Numeric constant
  2623.           3.   String constant
  2624.           4.   System variable
  2625.           5.   Matrix variable
  2626.           6.   Redirected field (e.g., title#2)
  2627.           7.   Field
  2628.           8.   Memory variable
  2629.           9.   Logical constant
  2630.  
  2631.           You can see that memory variables are low on the list. This
  2632.      means, for instance, if you give a memory variable the same name as a
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.      Reading the Command Line       VPI  VPIN      Reading the Command Line
  2639.  
  2640.      SR-Info/VP-Info Reference Manual          Page 424          APPENDIX A
  2641.  
  2642.  
  2643.      field, say, LNAME, then at every mention of that memory variable,
  2644.      SR-Info/VP-Info will reference the field LNAME.
  2645.  
  2646.           Avoid such confusion by giving memory variables names that won't
  2647.      be confused with SR-Info/VP-Info keywords, functions, or field names.
  2648.  
  2649.      Examples of Command Line Analysis
  2650.  
  2651.           Here are some examples of how SR-Info/VP-Info analyzes command
  2652.      lines and expressions, and some guidelines for avoiding confusion.
  2653.  
  2654.           EJECT=T
  2655.  
  2656.           In this line, the first word is "EJECT". Since it is followed by
  2657.      "=", this line is interpreted as a STORE (notice that step 5, which
  2658.      calls for this interpretation, overrides step 4, which would have
  2659.      interpreted EJECT as a command).
  2660.  
  2661.           Next question: what is "T"?  It is not a function, nor is it any
  2662.      of the other first six entries in the priority table above. If it is a
  2663.      field (priority 7) or memory variable (priority 8), EJECT is given the
  2664.      value contained in T. If it is neither, then "T" is interpreted as
  2665.      priority 9, a logical constant, true.
  2666.  
  2667.           Therefore, this command line defines a variable EJECT whose
  2668.      content is the value of a field or variable, or the logical constant
  2669.      true.
  2670.  
  2671.           IF eject
  2672.  
  2673.           In this line, the first word is interpreted as a command (Step
  2674.      4), and compiled as such (Step 8); eject, even though it is a
  2675.      SR-Info/VP-Info command verb, must in this context be a field or a
  2676.      memory variable, and there will be no confusion.
  2677.  
  2678.                "Buried" Remarks
  2679.  
  2680.                Many commands consist of a single word; they have no
  2681.                keywords (e.g., EJECT and ENDDO). Whatever appears on a line
  2682.                starting with one of these commands is disregarded by
  2683.                SR-Info/VP-Info. For instance, you can write an IF structure
  2684.                like this:
  2685.  
  2686.                IF approved .AND. count<100
  2687.                   <command sequence>
  2688.                ENDIF approved .AND. count<100
  2689.  
  2690.      Here, the condition is repeated as a remark within the ENDIF command
  2691.      line to clarify which conditional structure is ended. This is a valid
  2692.      and useful remark; however, using ";" to separate remarks from
  2693.      commands is better practice:
  2694.  
  2695.  
  2696.  
  2697.  
  2698.      Reading the Command Line       VPI  VPIN      Reading the Command Line
  2699.  
  2700.      SR-Info/VP-Info Reference Manual          Page 425          APPENDIX A
  2701.  
  2702.  
  2703.  
  2704.      ENDIF; approved .AND. count<100
  2705.  
  2706.      Miscellaneous Command Line Guidelines
  2707.  
  2708.           A.   Since SR-Info/VP-Info checks only the first four letters of
  2709.                command verbs, SET PRINT, SET PRINTER, SET PRINTERNOW are
  2710.                all the same.
  2711.  
  2712.           B.   Take care to write out in full those keywords that look
  2713.                alike when abbreviated. For instance, ENDD and ENDR are
  2714.                easily misread; such mistakes are difficult to find.
  2715.  
  2716.           C.   To sum up it is possible to use SR-Info/VP-Info keywords as
  2717.                variables and to place comments on command lines, if you are
  2718.                aware of all the above SR-Info/VP-Info conventions. However,
  2719.                to be on the safe side, avoid such practices.
  2720.  
  2721.  
  2722.  
  2723.                       A.8. Compiling Multiple Subroutines
  2724.  
  2725.  
  2726.           In programs that call multiple subroutines, it is easy to get so
  2727.      bogged down in compiling the main (or "calling") program that your
  2728.      subroutines never get debugged. Imagine, for example, that you have a
  2729.      program MAIN.PRG, that calls 45 separate subroutines as follows:
  2730.  
  2731.      . . .
  2732.      DO sub1
  2733.      <command sequence>
  2734.      DO sub2
  2735.      <command sequence>
  2736.      . . .
  2737.      <command sequence>
  2738.      DO sub45
  2739.      . . .
  2740.  
  2741.           Normally, when you compile main, SR-Info/VP-Info has to compile
  2742.      SUB1.PRG, SUB2.PRG, and so on, up through SUB45.PRG. If you are trying
  2743.      to debug SUB45, this will slow you down considerably. The command SET
  2744.      DO takes care of this problem.
  2745.  
  2746.           With SET DO ON (the default) the compiler compiles all
  2747.      subroutines along with the calling program.
  2748.  
  2749.           With SET DO OFF, compiling main does not compile the subroutines.
  2750.      Instead, for each subroutine SR-Info/VP-Info creates an "environment
  2751.      file", with the name of the subroutine file and the extension ENV. For
  2752.      example, the "environment file" for SUB45.PRG is SUB45.ENV.
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.      Multiple Subroutines           VPI  VPIN          Multiple Subroutines
  2759.  
  2760.      SR-Info/VP-Info Reference Manual          Page 426          APPENDIX A
  2761.  
  2762.  
  2763.  
  2764.           Once environment files exist, the subroutines can be individually
  2765.      compiled and debugged. SR-Info/VP-Info uses the environment files for
  2766.      the compilation of each subroutine.
  2767.  
  2768.           With SET DO OFF, you can still compile main so that the
  2769.      subroutines are compiled as overlays. To do so, use the LINK keyword
  2770.      in the COMPILE command:
  2771.  
  2772.      COMPILE main LINK
  2773.  
  2774.      Steps in Debugging Subroutines
  2775.  
  2776.           Here's an example of using SET DO OFF for debugging a subroutine.
  2777.  
  2778.           1. Reset the DO switch:
  2779.  
  2780.      SET DO OFF
  2781.  
  2782.           2. Compile the main program:
  2783.  
  2784.      COMPILE main
  2785.  
  2786.           3. Compile any other subroutines without which the subroutine
  2787.                can't be run, e.g.:
  2788.  
  2789.      COMPILE sub1
  2790.      COMPILE sub10
  2791.  
  2792.           4. Compile the subroutine you are debugging:
  2793.  
  2794.      COMPILE sub45
  2795.  
  2796.            5. Run the main program:
  2797.  
  2798.      DO main
  2799.  
  2800.           Test whether SUB45 works properly. If it does not, edit
  2801.      SUB45.PRG, compile SUB45 again, then test it by executing MAIN.
  2802.  
  2803.  
  2804.  
  2805.                              A.9. Data-File Headers
  2806.  
  2807.  
  2808.           On disk, a data file starts with a data-file header that
  2809.      describes the structure of the data file. SR-Info/VP-Info uses the
  2810.      data file headers to set up the data file table.
  2811.  
  2812.           The data-file headers of all three types of SR-Info/VP-Info data
  2813.      files contain essentially the same data.
  2814.  
  2815.  
  2816.  
  2817.  
  2818.      Data File Headers              VPI  VPIN             Data File Headers
  2819.  
  2820.      SR-Info/VP-Info Reference Manual          Page 427          APPENDIX A
  2821.  
  2822.  
  2823.  
  2824.                             Type 1 Data File Header
  2825.  
  2826.      Introduction:
  2827.      Byte 0              File type indicator (CHR(1))
  2828.      Bytes 1-2           Number of records in file
  2829.      Bytes 3-4           Location of first byte of first record
  2830.      Byte 5              Not used
  2831.      Bytes 6-7           Length of each record
  2832.  
  2833.      Field 1:
  2834.      Bytes 8-18          Field name
  2835.      Byte 19             Type (C, N, or L)
  2836.      Byte 20             Width
  2837.      Bytes 21-22         Offset
  2838.      Byte 23             Decimal places
  2839.  
  2840.      Fields 2 and up:
  2841.      Add (<field number>-1) * 16 to locations shown for Field 1. For
  2842.      example, add 16 to each byte in Field 1 for the location of the
  2843.      corresponding information for Field 2; thus, Field 2's name is found
  2844.      in bytes 24-34. A carriage return in the first byte of a location
  2845.      allocated for a field name indicates that the data file contains no
  2846.      more fields.
  2847.  
  2848.           First byte of first record: Byte specified in Bytes 3-4.
  2849.  
  2850.  
  2851.                             Type 2 Data File Header
  2852.  
  2853.      Introduction:
  2854.      Byte 0              File type indicator (CHR(2))
  2855.      Bytes 1-2           Number of records in file
  2856.      Bytes 3-5           Not used
  2857.      Bytes 6-7           Length of each record
  2858.  
  2859.      Field 1:
  2860.      8-18                Field name
  2861.      Byte 19             Type (C, N, or L)
  2862.      Byte 20             Width
  2863.      Bytes 21-22         Offset
  2864.      Byte 23             Decimal places
  2865.  
  2866.      Fields 2 to 32:
  2867.      Add (<field number>-1) * 16 to locations shown for Field 1 (see Type 1
  2868.      example).
  2869.  
  2870.           First byte of first record: Byte 521.
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.      Data File Headers              VPI  VPIN             Data File Headers
  2879.  
  2880.      SR-Info/VP-Info Reference Manual          Page 428          APPENDIX A
  2881.  
  2882.  
  2883.                             Type 3 Data File Header
  2884.  
  2885.      Introduction:
  2886.      Byte 0              File type indicator (CHR(3) or CHR(131))
  2887.      Bytes 1-3           Not used
  2888.      Bytes 4-7           Number of records in file
  2889.      Bytes 8-9           Location of first byte of first record
  2890.      Bytes 10-11         Length of each record
  2891.      Bytes 12-31         Not used
  2892.  
  2893.      Field 1:
  2894.      Bytes 32-42         Field name
  2895.      Byte 43             Type (C, N, L, D, M, or F)
  2896.      Byte 44-45          Offset
  2897.      Bytes 46-47         Not used
  2898.      Byte 48             Width
  2899.      Byte 49             Decimal places
  2900.      Bytes 50-63         Not used
  2901.  
  2902.      Fields 2 and up:
  2903.      Add (<field number>-1) * 32 to locations shown for Field 1 (see Type 1
  2904.      example).
  2905.  
  2906.           First byte of first record: Byte specified in Bytes 8-9.
  2907.  
  2908.                Note that Type 3 data files originated by dBASE may have two
  2909.                field types not present in SR-Info/VP-Info. Both the Date
  2910.                type and the Memo type are treated as ordinary character-
  2911.                type fields by SR-Info/VP-Info, and the Float type
  2912.                introduced with dBASE IV is treated as an ordinary numeric
  2913.                field. If a memo field is present, the file type indicator
  2914.                in Byte 0 is CHR(131); otherwise it is CHR(3).
  2915.  
  2916.           In all cases, numeric values are stored in a form that is best
  2917.      handled with SR-Info/VP-Info's CHR( and RANK( functions, or in VP-Info
  2918.      Professional, with CTONUM( and NUMTOC(. If the number is longer than
  2919.      one byte, the value in the first byte is ones, the values in the
  2920.      second are 256s, the values in the third are 65536s, and so on.
  2921.  
  2922.           For example, if you find that the values of Bytes 1 and 2 of a
  2923.      Type 2 file are 38 and 2, you could calculate that the data file has
  2924.      38+(2*256) records, or 550. Similarly, if you need to convert the
  2925.      number 550 into a two-character string, your result would be
  2926.      CHR(MOD(550,256))+CHR(550/256).
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.      Data File Headers              VPI  VPIN             Data File Headers
  2939.  
  2940.      SR-Info/VP-Info Reference Manual          Page 429          APPENDIX B
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.                                    APPENDIX B
  2948.  
  2949.                               The SR-Info/VP-Info
  2950.                                     KEYWORDS
  2951.  
  2952.      ABS(                               CLS
  2953.      ACCEPT                             COL(
  2954.      ACOS(                              COLOR
  2955.      ADD  (in SET)                      COLOR  (in SET)
  2956.      ADDITIVE                           COMPILE
  2957.      ALL                                CONFIRM  (in SET)
  2958.      ALTERGATE  (in SET)                CONSOLE  (in SET)
  2959.      ANSI  (in SET)                     CONTINUE
  2960.      APPEPT                             COPY
  2961.      ASC(                               COS(
  2962.      ASIN(                              COSH(
  2963.      AT(                                COUNT
  2964.      ATAN(                              CREATE
  2965.      AVERAGE                            CTONUM(
  2966.      BELL  (in SET)                     CURSOR
  2967.      BIN  (in SET)                      DATE  (in SET)
  2968.      BINLOAD                            DATE(
  2969.      BINSPACE                           DAYS(
  2970.      BINUNLOAD                          DBF(
  2971.      BIT(                               DBFX(
  2972.      BLANK                              DEBUG
  2973.      BLANK(                             DEBUG  (in SET)
  2974.      BOTTOM                             DEFAULT  (in SET)
  2975.      BOX                                DELAY
  2976.      BREAK                              DELE  (in SET)
  2977.      BROWSE                             DELETE
  2978.      CALC(                              DELETED(
  2979.      CALL                               DELIMITED
  2980.      CANCEL                             DELIMITER  (in SET)
  2981.      CARRY  (in SET)                    DIM
  2982.      CASE                               DIR
  2983.      CEIL(                              DIR  (in SET)
  2984.      CEN(                               DIR(
  2985.      CHAIN                              DIRF
  2986.      CHAR                               DIRX(
  2987.      CHR(                               DISPLAY
  2988.      CLEAR                              DISPLAY  (in SET)
  2989.      CLOSE                              DIVZERO  (in SET)
  2990.      CLOSE(                             DO
  2991.  
  2992.  
  2993.      SR-Info/VP-Info Reference Manual          Page 430          APPENDIX B
  2994.  
  2995.  
  2996.      DO  (in SET)                       IF
  2997.      DOUBLE                             IFF(
  2998.      DOWN                               IFKEY(
  2999.      ECHO  (in SET)                     IN(
  3000.      EDIT                               INDEX
  3001.      EJECT                              INDEX  (in SET)
  3002.      EJECT  (in SET)                    INKEY(
  3003.      ELSE                               INPUT
  3004.      END  (in SET)                      INSERT(
  3005.      ENDCASE                            INT(
  3006.      ENDDO                              INTENSITY  (in SET)
  3007.      ENDIF                              KEEP  (in SET)
  3008.      ENDON                              LAST
  3009.      ENDPROCEDURE                       LEFT
  3010.      ENDREPEAT                          LEFT(
  3011.      EOF                                LEN(
  3012.      EOF(                               LENGTH  (in SET)
  3013.      ERASA                              LIBRARY  (in SET)
  3014.      ERROR  (in SET)                    LIKE
  3015.      ESCAPE  (in SET)                   LIMIT
  3016.      EXACT  (in SET)                    LINE  (in SET)
  3017.      EXCEPT                             LINK
  3018.      EXECUTION  (in SET)                LINK  (in SET)
  3019.      EXP(                               LIST
  3020.      F                                  LOC(
  3021.      FIELD                              LOCATE
  3022.      FIELD  (in SET)                    LOCK
  3023.      FIELD(                             LOCK  (in SET)
  3024.      FIELDS                             LOG10(
  3025.      FILE                               LOG
  3026.      FILE(                              LOG  (in SET)
  3027.      FILES                              LOG(
  3028.      FILTER  (in SET)                   LOOP
  3029.      FIND                               LOWER(
  3030.      FLD(                               LTRIM(
  3031.      FLOOR(                             MARGIN  (in SET)
  3032.      FLUSH                              MAX
  3033.      FOR                                MAX(
  3034.      FORM                               MEMORY
  3035.      FORMAT  (in SET)                   MEMORY  (in SET)
  3036.      FROM                               MENU  (in SET)
  3037.      FUNCTION  (in SET)                 MENU(
  3038.      GET                                MIN
  3039.      GET  (in SET)                      MIN(
  3040.      GET(                               MOD(
  3041.      GLOBAL                             MODIFY
  3042.      GO                                 MONO  (in SET)
  3043.      GOTO                               MONTHS(
  3044.      HEADING  (in SET)                  N
  3045.      HELP                               NDX(
  3046.  
  3047.      SR-Info/VP-Info Reference Manual          Page 431          APPENDIX B
  3048.  
  3049.  
  3050.  
  3051.  
  3052.      SR-Info/VP-Info Reference Manual          Page 432          APPENDIX B
  3053.  
  3054.  
  3055.      NEAREST                            RUN
  3056.      NETWORK  (in SET)                  SAVE
  3057.      NEXT                               SAVE  (in SET)
  3058.      NOEFFECTS                          SAY
  3059.      NUMTOC(                            SCOPE
  3060.      OFF                                SCREEN
  3061.      ON                                 SCREEN  (in SET)
  3062.      OTHERWISE                          SCROLL
  3063.      OUT(                               SDF
  3064.      OVERWRITE                          SECONDARY
  3065.      PACK                               SEEK
  3066.      PAGE                               SEEK(
  3067.      PERFORM                            SELECT
  3068.      PIC(                               SET
  3069.      PICTURE                            SET(
  3070.      POST                               SFX(
  3071.      POW(                               SIN(
  3072.      PRIMARY                            SINH(
  3073.      PRINT                              SKIP
  3074.      PRINT  (in SET)                    SND(
  3075.      PRINTER(                           SNOW  (in SET)
  3076.      PROCEDURE                          SORT
  3077.      PROMPT                             SOUND
  3078.      PUT(                               SPACE(
  3079.      QUIT                               SPOOL
  3080.      RAND(                              SQRT(
  3081.      RANK(                              SSEEK(
  3082.      RAW  (in SET)                      STATUS
  3083.      READ                               STEP  (in SET)
  3084.      READ(                              STORE
  3085.      RECALL                             STR(
  3086.      RECNO(                             STRUCTURE
  3087.      REINDEX                            SUBSTR(
  3088.      RELATION  (in SET)                 SUM
  3089.      RELEASE                            SYSTEM
  3090.      REMARK                             T
  3091.      REMLIB(                            TALK  (in SET)
  3092.      RENAME                             TAN(
  3093.      REPEAT                             TANH(
  3094.      REPLACE                            TEAR
  3095.      REPLACE(                           TEST
  3096.      REPORT                             TEST(
  3097.      RESET(                             TEXT
  3098.      RESTORE                            TEXT  (in SET)
  3099.      RETURN                             TIME(
  3100.      RIGHT                              TIMES
  3101.      RIGHT(                             TO
  3102.      RING                               TOP
  3103.      ROPEN(                             TOTAL
  3104.      ROW(                               TRIM  (in SET)
  3105.  
  3106.      SR-Info/VP-Info Reference Manual          Page 433          APPENDIX B
  3107.  
  3108.  
  3109.  
  3110.  
  3111.      SR-Info/VP-Info Reference Manual          Page 434          APPENDIX B
  3112.  
  3113.  
  3114.      TRIM(
  3115.      TRUNCATE
  3116.      TYPE(
  3117.      UNLOCK
  3118.      UP
  3119.      UPDATE
  3120.      UPPER  (in SET)
  3121.      UPPER(
  3122.      USE
  3123.      USING
  3124.      VAL(
  3125.      VARIABLE
  3126.      VARYING
  3127.      WAIT
  3128.      WHILE
  3129.      WIDTH  (in SET)
  3130.      WINDOW
  3131.      WITH
  3132.      WOPEN(
  3133.      WRAP(
  3134.      WRITE
  3135.      WRITE(
  3136.      Y
  3137.      ZAP
  3138.      ZERO  (in SET)
  3139.  
  3140.  
  3141.      SR-Info/VP-Info Reference Manual          Page 435          APPENDIX C
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.                                    APPENDIX C
  3149.  
  3150.                               The SR-Info/VP-Info
  3151.                                  ERROR MESSAGES
  3152.  
  3153.      1. Invalid variable type found when executing an expression.
  3154.      2. Variable not found.
  3155.      3. Illegal expression.
  3156.      4. Missing the second operand in an expression.
  3157.      5. File not found.
  3158.      6. Index file not found.
  3159.      7. Record specified is out of range.
  3160.      8. Error in reading file.
  3161.      9. Index file is not functioning.
  3162.      10. Missing 'TO' in command.
  3163.      11. 128 memory variables have been used.
  3164.      12. Missing or mismatched string delimiter.
  3165.      13. No space is left in a control stack.
  3166.      14. No valid command was found.
  3167.      15. Invalid nesting of DO WHILE or IF statements.
  3168.      16. File pointers must be between 1 and 10.
  3169.      17. Strings cannot be larger than 256 characters.
  3170.      18. Missing parenthesis ')' or '(' in expression.
  3171.      19. Invalid CASE construction. (Problem may be in PROCEDURE or DO
  3172.                module.)
  3173.      20. Must be numeric argument.
  3174.      21. Invalid variable or constant.
  3175.      22. Program not found or too many files open.
  3176.      23. Program is too large for memory.
  3177.      24. Invalid nesting of DO or RETURN statements. (Problem may be in DO
  3178.                module.)
  3179.      25. The PROCEDURE must be defined in this module if it is to be
  3180.                PERFORMed.
  3181.      26. Disk full or error in writing data to disk.
  3182.      27. File must be indexed for this command.
  3183.      28. Missing WITH in REPLACE command.
  3184.      29. Only 10 expressions can be used in the SUM command.
  3185.      30. Missing FOR clause of LOCATE or CONTINUE command.
  3186.      31. Insufficient space to do the sort.
  3187.      32. Improper syntax for dimension variables.
  3188.      33. Internal macro space has been exceeded.
  3189.      34. Not enough memory for a buffer to be made.
  3190.      35. No more than 32 external memory variables are allowed.
  3191.      36. This program must be re-compiled.
  3192.      37. This program exceeds the available program memory.
  3193.      38. A data file must be in USE for this command.
  3194.      39. Missing 'ON' in this command.
  3195.      40. CREATE must be followed by a file name.
  3196.  
  3197.      SR-Info/VP-Info Reference Manual          Page 436          APPENDIX C
  3198.  
  3199.  
  3200.      41. Two coordinates must be specified.
  3201.      42. Screen coordinates are out of range.
  3202.      43. This command is not authorized for use by end users.
  3203.      44. This matrix variable is already defined.
  3204.      45. Not enough memory for this matrix to be defined.
  3205.      46. Index is outside the range of a buffer or matrix.
  3206.      47. Sequential file numbers must be between 1 and 4.
  3207.      48. The index expression cannot exceed 60 characters.
  3208.      49. Date format cannot exceed 8 characters in length.
  3209.      50. Indexes for file vectors must be 1 to number of fields in file.
  3210.      51. Illegal use of macro.
  3211.      52. Maximum number of fields must in range 128 to 1000.
  3212.      53. The index file switched to is not open.
  3213.      54. Screens can be defined from 1-4.
  3214.      55. Invalid window coordinates.
  3215.      56. Screen library is not open.
  3216.      57. Missing = sign.
  3217.      58. Bit position parameter is out of range.
  3218.      59. Invalid field or :field reference %s in ON FIELD; check TEXT.
  3219.      60. Command not found or not enough space to execute. (See: MEMORY=)
  3220.      61. Network must use DOS 3.1 or greater.
  3221.      62. Read-only files cannot be changed.
  3222.      63. %s file locked.
  3223.      64. Record locked in file %s.
  3224.      65. Index error. Reduce the key size to index this file.
  3225.      66. Format lines in a TEXT command exceeded 64 (clear with CLEAR
  3226.                GETS).
  3227.      67. Only 30 fields can be used in the REPORT command.
  3228.      68. Invalid file operation due to sharing violation.
  3229.      69. Memory variable space exceeds limit.
  3230.      70. Expression is too complex; requires too many temporary variables.
  3231.      71. Invalid nesting; ENDDO implies a DO WHILE.
  3232.      72. Invalid nesting; ENDCASE implies a DO CASE.
  3233.      73. Invalid nesting; ENDIF implies an IF.
  3234.      74. Invalid nesting; ENDPROC implies a PROCEDURE.
  3235.      75. Invalid nesting; ENDREPEAT implies a REPEAT.
  3236.      76. Invalid nesting; ENDON implies a ON ESCAPE, ON ERROR, or ON FIELD.
  3237.      77. Expecting ENDTEXT command.
  3238.      78. Expecting ENDFILE command.
  3239.      79. CASE or OTHERWISE encountered with no corresponding DO CASE
  3240.                command.
  3241.      80. ELSE command encountered with no corresponding IF command.
  3242.      81. FIELD command encountered with no corresponding ON FIELD command.
  3243.      82. LOOP or BREAK encountered with no DO WHILE or REPEAT command.
  3244.      83. Not enough memory for REPORT (try calling from a DO module).
  3245.      84. Unable to create a file.
  3246.      85. Compiled expression too long to save. Simplify.
  3247.      86. Missing file name in command
  3248.      87. Division by zero. Permitted only if SET DIVZERO ON (default).
  3249.      88. Index reference by number must be in range 1 to number of active
  3250.                indexes.
  3251.      89. Minimum window is 50 characters wide and 5 lines deep for EDIT or
  3252.  
  3253.      SR-Info/VP-Info Reference Manual          Page 437          APPENDIX C
  3254.  
  3255.  
  3256.                APPEND.
  3257.      90. Too many fields requested. Exit VP-Info, increase FIELDS= in
  3258.                VPI.SET file.
  3259.      91. Function number invalid (file sharing loaded).
  3260.      92. File not found.
  3261.      93. Path not found (of file does not exist).
  3262.      94. No file handle available; check "FILES=n" in CONFIG.SYS and
  3263.                VPI.SET.
  3264.      95. Access denied.
  3265.      96. DO nesting level exceeds limit.
  3266.      97. VP-Info workspace full. (Try breaking program into modules.)
  3267.      98. Keyword following ON not recognized.
  3268.      99. SYSTEM ERROR, file access code invalid.
  3269.      100. SET BIN request cannot be greater than 32K.
  3270.      101. Unable to satisfy SET BIN request.
  3271.      102. LOAD failed!  Unable to open BIN file.
  3272.      103. Cannot LOAD BIN blocks larger than 32K.
  3273.      104. BIN high memory cannot satisfy LOAD request.
  3274.      105. A maximum of eight BIN files can be LOADED at once.
  3275.      106. SET BIN must be run before using LOAD or CALL commands.
  3276.      107. CALL failed! Memory variable not recognized.
  3277.      108. CALL failed! Command not recognized.
  3278.      109. Drive not ready.
  3279.      110. Attempt to write on protected diskette.
  3280.      111. FAT error - disk may not be formatted.
  3281.      112. DOS reports critical error. Check floppy drive or printer.
  3282.  
  3283.