SR-Info/VP-Info Reference Manual Page 381 SECTION 4 TEXT Send text to screen or printer. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � TEXT [/.] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � the name of the text file to use � � the number of a volume in the current library; a � � numeric constant � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The TEXT command has two forms. The first form is the TEXT/ENDTEXT program structure: TEXT ENDTEXT All lines following the TEXT command up to ENDTEXT are displayed on the screen or if the command SET PRINT ON was given, then also sent to the printer. The second form is: TEXT /. where the text is taken from the file (default extension TXT) or from the numbered volume in the current library (see SET LIBRARY TO command). This is the same as TEXT the text from or . ENDTEXT The second form is preferable in many circumstances, since it: 1. Keeps the size of the program module down 2. Allows manipulation of the text in or in . 3. Allows the choice of text to be used, since can be a macro, and can be a numeric expression Note that library volumes are addressed by placing a period in front of the volume number, which can be either a numeric constant or TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 382 SECTION 4 a numeric expression. Do not confuse this usage with a decimal designation. TEXT macros. Contents of fields and variables can be merged into text blocks for data input, reporting, listing and mail-merge applications. SR-Info/VP-Info provides four special macro symbols for this purpose as follows: Fixed position Floating position Input macros (display/edit) @ % Output macros (display only) # & When a text macro symbol is encountered, SR-Info/VP-Info does the following: 1. Checks whether the following characters are the name of a field in the selected file. If it is, the current contents of the field replaces & in the text. 2. If not a field name, then the characters following the macro symbol are assumed to be a memory variable name. If that name is valid, the contents of the memory variable replaces in the text. 3. If is neither a field nor a variable, it is assumed not to be a macro, and both the macro symbol and are output as a literal. When the macro symbol & is used and SET TRIM ON, is trimmed before it is merged. The position of all text to the right of in the same line is adjusted so that the number of spaces after in the output is the same as in the TEXT, no matter how wide is. Caution: In a TEXT macro, must be terminated by blank, tab, punctuation mark, or a macro symbol; it cannot be terminated by a graphics character (since in many non-English character sets these characters are normal or accented alphanumeric characters). It also cannot be terminated by a colon or an underscore, since these are valid parts of a field or variable name. Output (list processing). This command can be used to do list processing. Any variable (field, memory variable, or system variable) can be merged into the document and output by using & or # in the text. TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 383 SECTION 4 As described above, the & macro will trim the contents of when output when SET TRIM ON, and always adjusts the material to its right on the same line depending on the width of the contents of . Sometimes, it is more useful to output at an absolute location with a variable (as opposed to merging); to do this use the # form. # does not trim or adjust the position of other items on the line, creating the possibility that later items in the line may be overwritten. A paragraph is a portion of the text between two carriage returns (obtained by hitting ). A paragraph is formatted by the TEXT command using word wrap (if there is not enough room for a word on a line, it is displayed/printed at the start of the next line). The page width and the left margin are set by the SET WIDTH and the SET MARGIN commands (see SET WIDTH and SET MARGIN). Control codes can be sent from the text using the symbols ^ (caret) and \ (backslash). The caret. When SR-Info/VP-Info comes across a ^, it checks for the next character. If the next character is also a ^, the two characters are sent as a single ^. If the next character is not a ^, it is sent as a control character; for instance, ^C is sent as Ctrl-C. Examples for ^: ^^ sent as ^ ^C sent as Ctrl-C ^^C sent as ^C The backslash. When SR-Info/VP-Info comes across a \, it checks for the next character. If the next character is also a \, the two characters are sent as a single \. If the next character is not a \, SR-Info/VP-Info checks for digits; it grabs as many digits as there are, up to three. The digits are converted into a number, and the number is sent as a code between 0 and 255. Examples for \: \\ sent as \ \2a sent as code 2, followed by a \0020 sent as code 2, followed by the character 0 (002 is the 2) \27x\000 sent as code 27 (escape), x, code 0 Examples: TEXT TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 384 SECTION 4 This text will be sent to the screen or the printer. You can set the; left margin and the text width. The text is automatically word; wrapped. ENDTEXT Now the same in letter quality mode on the Epson LQ-1500 printer: TEXT \27x\001This text will be sent to the screen or the printer. You can; set the left margin and the text width. The text is automatically; word wrapped. ENDTEXT Input screen painting. The TEXT command can be used "to paint" input screens. @ is a GET, activated by a READ command. @ also has a floating-position form, %, which adjusts the material to its right on the same line depending on the width of the contents of . Neither @ nor % trims the present contents of the variable. TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 385 SECTION 4 Examples: TEXT @fname @name @dept ENDTEXT TEXT %fname %name %dept ENDTEXT Both create a one-line input format that can be used with BROWSE OFF (or, if the macro line is placed in a text file, with BROWSE TEXT. The second form is easier to use, since there is no concern about the width of the various fields. For example, the maximum width available for NAME in the first form is 20 characters; if it is 20, it runs into DEPT, and if more than 20, it will suppress DEPT input completely. Formats in TEXT. TEXT formats let you control the display on fields and variables used in TEXT macros. They are similar to the formats used in the PICTURE and USING clauses of the @ command (see @ for format rules and examples). In TEXT blocks and files, formats must appear at the beginning of the block, with a separate line for each formatted variable. Each line must begin with two periods and a space, followed by the name of the field or variable, a comma, and the format picture. Examples: .. cust,!!!!-!-99 .. today,99/99/99 .. balance,$$$$$$$$$9,99> .. price,$$,$$$.99 .. codes#3,' xxx xxx xxx ' .. exception,'First: "xxxxxxxxxx"' Format lines may not contain comments, and need no quote marks unless the format itself includes leading or trailing blanks (not recommended) or quote marks of the other type; see last two example above. If a field is not in the selected data file, be sure to use field redirection as in CODES#3 above. Effect of SET TEXT ON/OFF and CLEAR GETS. A Get Table with room for up to 64 gets is available for full- screen editing commands, like READ, EDIT, and BROWSE. Whenever a GET is issued (either by TEXT or @ GET), it is entered into the Get Table so that SR-Info/VP-Info can rapidly ascertain its position and format TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 386 SECTION 4 during later processing. When SET TEXT ON, the TEXT display macros created with & and # are put into the Get Table. This setting is usually required for input screens created with TEXT. When SET TEXT OFF, display macros are not put into the Get Table. This setting is required when using TEXT for printer output, as in mail-merge programs, to avoid trying to create a 65th entry in the Get Table. Over-filling the Get Table is an error that causes termination of a program. It is good practice to place a CLEAR GETS command before the TEXT command to ensure that the Get Table is empty before starting to fill it again. Examples: 1. A text file used in data input with EDIT TEXT (see screen output in EDIT command section): .. zip,!9! 9!9 .. phone,999-9999 (999) .. wphone,999-9999 (999) .. training,99/99 NAME........... %FNAME %NAME ADD_1.......... %ADD_1 %AREA ZIP............ @ZIP PHONE.......... @PHONE WPHONE......... @WPHONE EXPERIENCE..... @EXPERIENCE COMMENTS @COMMENT1 @COMMENT2 2. A program that does formatted output from a data file, including multi-line output from certain fields: SET PRINT ON SET TEXT OFF SET MARGIN TO 0 SET WIDTH TO 80 IF row()>1 ;if current row not at top of form, SPOOL junk ; eject into throw-away spool file EJECT SPOOL ENDIF TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 387 SECTION 4 USE customer INDEX customer page=1 PERFORM heading DO WHILE .not. eof IF ROW()>50 ;start new page if past line 50 EJECT PERFORM heading ENDIF nameline=TRIM(fname)+' '+TRIM(name) address=TRIM(addr:1)+' '+TRIM(addr:2)+' '+TRIM(city) remarks=comments nameline2=WRAP(nameline,15) ;WRAP( function trim long strings, address2=WRAP(address,17) ; leaving remainder for next line remarks2=WRAP(remarks,20) * text for main line includes customer number, formatted with picture TEXT .. cust,xxx-x-xx #cust #nameline2 #address2 #remarks2 ENDTEXT * test in next line depends on fact that concatenating several fields * of blanks and then trimming the result leaves a single blank DO WHILE ' '<>TRIM(nameline+address+remarks) IF ROW()>55 ;start new page if past line 55 EJECT PERFORM heading ENDIF nameline2=WRAP(nameline,15) address2=WRAP(address,17) remarks2=WRAP(remarks,20) * text same as main text except customer number omitted TEXT #nameline2 #address2 #remarks2 ENDTEXT ENDDO ? ;skip line after every customer SKIP ;get next customer record ENDDO EJECT SET PRINT OFF * PROCEDURE heading ? DATE(full) ?? BLANK(52-col()),'Page '+LTRIM(STR(page,5)) ? CEN(:COMPANY,60) ? CEN('Current Customer Listing',60) ? ? 'Number Name Address Comments' ? '======== =============== ================= ====================' ? page=page+1 ENDPROCEDURE heading TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 388 SECTION 4 * PROCEDURE heading ? ?? DATE(full) ?? BLANK(52-col()),'Page '+LTRIM(STR(page,5)) ? CEN(:COMPANY,60) ? CEN('Current Customer Listing',60) ? ? 'Number Name Address Comments' ? '======== =============== ================= ====================' ? page=page+1 ENDPROCEDURE heading Sample output: Saturday, March 31, 1990 Page 1 Computer Resellers Corp. Current Customer Listing Number Name Address Comments ======== =============== ================= ==================== ALB-A-65 Arthur 876 Main Street Develops LAN-based Albredge Suite 987A San software Francisco BRO-W-53 Walter Freeridge Hard-disk Brownstone Company 8765 controller and Corvis Drive San cache expert Jose, CA TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 388.1 SECTION 4 Note on TEXT Command The two primary uses of TEXT are list processing (output) and screen design (input). Since Info cannot "know" which purpose you have in mind when your execute the command, you should "tell" Info how the TEXT command should be implemented. Use the SET TEXT OFF command for list processing, and SET TEXT ON for screen painting. SET TEXT controls the way the & and # macros are handled during execution of the TEXT command, as follows: *ON The TEXT display macros created with & and # are put into the Get Table; usually required for input screens created with TEXT. OFF Display macros are not put into the Get Table; usually required when using TEXT for printer output, as in mail-merge programs. TEXT SRI VPI VPIN TEXT SR-Info/VP-Info Reference Manual Page 389 SECTION 4 TOTAL Summarize the information from the selected file (indexed) to a new file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � TOTAL [] ON TO [FIELDS ] � � [FOR ] � � � � trigger expression � � new file to contain summary information � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � selection of records by scope � � (default scope: ALL) � � FIELDS the fields to be totalled � � FOR selection of records by � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The selected file must be indexed or sorted on . The records of the selected file can be grouped by the value of : in each group has the same value. This command creates a new file ; for each group of records of the selected file, a record is entered in the new file. This new record is the same as the first record of the group, except that the numeric fields in the are replaced by their total for all the records in the group. (Specifying a logical or a character field in the will cause an error.) Deleted records are ignores irrespective of SET DELETED command. The following steps describe in detail how this command works: Step 1. Copies the structure of the selected file to . Step 2. Appends the first record which satisfies the FOR clause (note also scope, deleted records are disregarded) from the selected file to the new file. Step 3. Evaluates and saves it in a temporary variable. Step 4. Takes all subsequent records (if any) for which does not change. Adds up the fields in the FIELDS clause (if any) and stores the sum in the record appended to while continues to match the value saved in the temporary variable. TOTAL SRI VPI VPIN TOTAL SR-Info/VP-Info Reference Manual Page 390 SECTION 4 Step 5. Continue with Step 2, using the first record for which has a new value. If no FIELDS clause is in the command line no addition is performed, and the resulting file consists only of the first record encountered for each different value of . A frequent use of this feature is to purge the file of records with duplicate keys. See also the related commands: POST and UPDATE. Example: Use the ORDER file to find out which STYLE:NO and COLOR have been ordered: 1>USE order 1>LIST style:no+color 1 A120B1 2 C001R3 3 M100G5 4 A120B1 5 M100G5 Of course, this way you get a lot of duplicates. To get each STYLE:NO+COLOR only once, make the file STYLESUM (style summary) with TOTAL: 1>INDEX ON style:no+color TO order 5 RECORDS IN TOTAL INDEXED 1>TOTAL ON style:no+color TO stylesum 5 TOTAL(S) 1>USE stylesum 1>LIST inven:no, style:no, color 1 AB0011 A120 B1 2 AB0110 C001 R3 3 QA1001 M100 G5 This is the desired list. TOTAL SRI VPI VPIN TOTAL SR-Info/VP-Info Reference Manual Page 391 SECTION 4 UNLOCK Unlock the current record. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � UNLOCK VP-Info Network Edition only � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command unlocks the current record previously locked. See the SET NETWORK command on how to get into the multi-user mode. See also LOCK. Example: mcust=cust FIND &mcust LOCK REPLACE balance with 0 UNLOCK UNLOCK VPIN UNLOCK SR-Info/VP-Info Reference Manual Page 392 SECTION 4 UNLOCK INDEXES Unlock all indexes on the selected data file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � UNLOCK INDEXES VP-Info Network Edition only � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command unlocks the indexes previously locked on the selected data file with the LOCK INDEXES command. See the SET NETWORK command on how to get into the multi-user mode. See also LOCK INDEXES. Example: UNLOCK INDEXES UNLOCK INDEXES VPIN UNLOCK INDEXES SR-Info/VP-Info Reference Manual Page 393 SECTION 4 UPDATE Update the selected file from an indexed file by replacing selected fields. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � UPDATE FROM [] ON [REPLACE � � WITH ,..., WITH ] [FOR ] � � � � the location of the FROM file � � the expression that is the key for finding � � the record in the FROM file � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � selection restricted by scope (default scope: ALL) � � REPLACE WITH ,..., WITH � � where field1,..,fieldn are fields of the file � � in use � � ,..., are expressions involving fields � � of both files � � FOR selection restricted by � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The selected file need not be indexed. This procedure takes all the appropriate records of the selected file one at a time. The FROM file has to be indexed by ; the expression, , is made up of character fields shared by the two files, and by memory variables and constants. This procedure works as follows: 1. Takes the first appropriate record (that is, the first non-deleted record satisfying the and within the scope). 2. Evaluates in the selected file. 3. Finds the first matching record in the FROM file. a. If the FIND is not successful, an "UPDATE ERROR" message is sent showing both the record number and the value of in the selected file. If SET PRINT ON, messages are sent to the printer. b. If the FIND is successful, the procedure replaces the fields of the selected file with the expressions, , made up of fields of both UPDATE SRI VPI VPIN UPDATE SR-Info/VP-Info Reference Manual Page 394 SECTION 4 files. All fields names are assumed to be in the updating file, so make sure #n is attached to any field names from the FROM file. 4. Procedure continues with the next appropriate record as long as records remain within the . If there is no REPLACE clause, UPDATE simply checks whether all the expected records of the FROM file are present. See also the commands: POST and TOTAL. SET ADD ON has no effect on UPDATE. Example: The cost of an item is kept updated in the INVENTRY file. To update the COST in the ORDER file: 1>USE#4 inventry INDEX inventry 1>USE order 1>UPDATE FROM 4 ON inven:no REPLACE cost WITH cost#4 UPDATE SRI VPI VPIN UPDATE SR-Info/VP-Info Reference Manual Page 395 SECTION 4 USE Open data file for use, optionally, with index files. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � USE [INDEX ] [] [COMPILE] � � � � the data file to use � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � INDEX list of index file names to use � � the file access mode under which DOS is to � � open the file � � COMPILE open data file at compile time only � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command USE opens a data file for use. To open one or more index files with the data file, use INDEX and the index file name(s). The first index file is the Master Index; this one is in use with the FIND, LIST, SKIP, etc. commands. All other index files named will be updated by all commands. The option COMPILE is used to open a data file at compile time only. It is used in situations where the data file to be used at run time is not available at compile time. One remedy is to put the name of the data file in a macro, but then all the field names must be in macros. COMPILE offers a better solution if a data file with the same structure is available at compile time. For example, USE inven COMPILE USE &file INDEX &file2 will open the data file INVEN at compile time only. At compile time the command: USE &file index &file2 is ignored. Now if the structure of INVEN is the same as the structure of the data file(s) whose name will appear in &file, then the program can use the field name without macros. Note that index files are not opened at compile time, so the same problem does not effect index files. Caution: Avoid using data and index file names that start with the letters "COMP", since the compiler may mistake the file name for the COMPILE keyword and make it impossible to use the file in a program. VP-Info Professional supports four different modes (READ, WRITE, LOCK, and SHARE). SR-Info and VP-Info support only one mode (READ), although the other modes are recognized for compatibility and cause no error in any version. The meaning of the four modes is as follows: USE SRI VPI VPIN USE SR-Info/VP-Info Reference Manual Page 396 SECTION 4 LOCK - Open the file for both reading and writing, and maintain exclusive use; allow no other users on a network to read or write to the file while it is open in LOCK mode. This is the default mode for all versions. WRITE - Open the file for both reading and writing, and allow no other users on a network to write to the file, but allow other users to open the file in READ mode. READ - Open the file for reading only, without restricting other users on a network from opening it in WRITE or SHARE mode. When not on a network, READ mode is useful in ensuring that changes made to a file are not saved to disk. SHARE - Open the file for both reading and writing, without restricting the ability of others on a network See also SET INDEX TO. Examples: 1. To open a data file as file 5 while currently you are on file 2: 2>USE#5 customer 2>USE#2 invoice INDEX invoice 2>USE#1 sales INDEX color,style,ddate Three data files were opened under the appropriate file numbers. Note that the default file number is still 2; the index files are separated by commas. 2. To open a file in READ mode before using EDIT to check data without the risk of writing any changes back to disk: 1>USE employee INDEX emplname READ 1>FIND TAYLOR 1>EDIT USE SRI VPI VPIN USE SR-Info/VP-Info Reference Manual Page 397 SECTION 4 VARIABLES Enters a list of memory variable names into the variables table. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � VARIABLES � � � � list of memory-variable names � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 SR-Info/VP-Info allows up to 128 variables to be defined at a time. Their names are listed in a variables table, which is displayed with the LIST MEMORY command. When a program is compiled, each time SR-Info/VP-Info encounters a name not already in the table, it is added. As a programmer, you can control the order of variables in the table by naming them in the variables list with the VARIABLES command. This is not only good practice in general, but it can help in debugging, and makes it possible to be sure every variable you use is being defined, and that no others are being inadvertently created. The variables command should never be used in a subroutine, and can be used only once in the main routine. It should come after any GLOBAL command, but before any other variable is defined. Example in a program: VARIABLES start,finish,mcust,mserial VARIABLES SRI VPI VPIN VARIABLES SR-Info/VP-Info Reference Manual Page 398 SECTION 4 WAIT Accept one character from the keyboard. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � WAIT [TO ] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � TO store the character into this variable � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 When SR-Info/VP-Info encounters the WAIT command, the program execution stops, the message: WAITING is displayed; SR-Info/VP-Info waits for a character to be entered at the keyboard. When a key is hit, program execution continues. If the option: TO is used, the character is stored in the string memory variable ; this cannot be a matrix variable. If the variable does not exist, it will be created. This command is useful to suspend the program execution so that the user can read a message on the screen, and maybe make a choice. See also the INKEY( function. Examples: 1. A program segment: @ 20,0 SAY 'Turn the printer on. Hit any key when ready.' WAIT After the message is displayed, SR-Info/VP-Info waits for the user to hit a key indicating that the printer is now on. 2. A typical, simple menu using WAIT: DO WHILE T ERASE TEXT MENU 1. General Ledger 2. Invoicing 3. Receivables Type in your choice: ENDTEXT WAIT SRI VPI VPIN WAIT SR-Info/VP-Info Reference Manual Page 399 SECTION 4 WAIT TO ans IF ans>'0' .OR. ans<'4' BREAK ENDIF ENDDO DO CASE CASE ans='1' DO ... WAIT SRI VPI VPIN WAIT SR-Info/VP-Info Reference Manual Page 400 SECTION 4 WINDOW Defines the active window, that part of the screen to which relative output can be sent. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � WINDOW � � WINDOW , [COLOR []] � � WINDOW ,,, [COLOR � � [,]] [BLANK/DOUBLE] � � � � , the top and bottom of the window to be created; � � with no column numbers given, the window is � � full width with no border permitted � � , the coordinates of the top-left corner of the window� � , the coordinates of the bottom right corner of the � � window � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � COLOR the color of the area inside the window � � the color of the window border � � BLANK the window has no border � � DOUBLE the window double-line borders (default � � single-line borders) � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 Unlike the BOX command, WINDOW erases the area within the coordinates given, and if corners are specified, displays an optional border one space outside the border coordinates. Although the fixed-position display commands like @ SAY can write either inside or outside the window, all the relative display commands like ?, ??, LIST, DISPLAY, TEXT, etc., are restricted to the active window. The window can be deactivated (i.e., reset to the entire screen size) by the WINDOW command alone. The rows are numbered 0 to 24. Since a row is always allowed above and below the window coordinates, the actual range of row numbers for the WINDOW command is 1 through 23. The columns are numbered 0 to 79. Since a column is always allowed to the left and right of the window coordinates, the actual range of column numbers for the WINDOW command is 1 through 78. Note that commas are required between coordinates, but are not permitted before the keywords COLOR, BLANK, and DOUBLE. WINDOW SRI VPI VPIN WINDOW SR-Info/VP-Info Reference Manual Page 401 SECTION 4 In programs, WINDOW is often used to position TEXT and may be useful in setting up BROWSE, EDIT, WRITE and other input/output displays. Examples: 1. Use WRITE to edit a file in the bottom half of the screen: CLS CURSOR 5,20 ACCEPT "Enter name of file to edit " to fil_nam WINDOW 8,5,22,74 color 7,112 double WRITE &fil_nam OFF WINDOW 2. Use BROWSE with a TEXT file in a window: USE customer WINDOW 2,22 color 112 BROWSE TEXT customer WINDOW WINDOW SRI VPI VPIN WINDOW SR-Info/VP-Info Reference Manual Page 402 SECTION 4 WRITE Activate the program editor. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � WRITE [/.] [OFF] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � name of file to be created or edited � � number of a volume in the current library; a numeric � � expression � � OFF omit header and opportunity to rename file or volume � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 A simple program editor is provided to make it possible to write and edit programs in SR-Info/VP-Info. If or is not specified, the last file used is understood to be the file to edit. If no extension is specified, PRG is assumed. This editor is very useful for debugging programs and reports. Note that library volumes are addressed by placing a period in front of the volume number, which can be either a numeric constant or a numeric expression. Do not confuse this usage with a decimal designation. OFF causes WRITE to omit the top three lines of the screen (file name and ruler, etc.) and places the cursor at the beginning of the file in the top left corner of the current window (the entire screen if no window is active), and to save the file immediately upon sensing the key without giving an opportunity to change the file name. WRITE OFF is used primarily inside programs under program control, and with an active window. The editing keys are the same as in full-screen editing. WRITE uses an 80 character "window" for its 254 character lines. The maximum size of a text file is about 20,000 characters with no data files open. Using data and index files reduces space available for WRITE, as does running WRITE inside a program; consider running WRITE from a subroutine instead of the main routine if maximum file size is required. Editing keys: or Ctrl-S moves the cursor back one character or Ctrl-D moves the cursor forward one character or Ctrl-E moves the cursor to the previous line or Ctrl-X moves the cursor to the next line WRITE SRI VPI VPIN WRITE SR-Info/VP-Info Reference Manual Page 403 SECTION 4 Ctrl- moves to the beginning of the line Ctrl- moves to the end of the line Ctrl- moves to the beginning of the document Ctrl- moves to the end of the document Ctrl-N inserts a new line Ctrl-T deletes the line or Ctrl-R displays previous page or Ctrl-C displays next page deletes the character to the left of the cursor or Ctrl-G deletes the character on the cursor Ctrl-Y deletes the rest of the line or Ctrl-V puts you in insert mode: what you type gets inserted (normally, you are in overtype mode: what you type overtypes the existing text); pressing or Ctrl-V again, puts you back into overtype mode or Ctrl-W quits and updates text Ctrl-Q quits and does not update text Ctrl-P prints entire document on printer Alt-F formats program Alt-H displays a help screen To break a line into two, press to get into insert mode, and press . To merge two lines, delete the end of line character. When you leave the line (with a cursor key or ), the two lines merge. Alt-F formats program files; it indents the lines according to the program structures and capitalizes the first command verb on every line. When using WRITE, Alt-H displays the following information (press any key, and the help screen disappears): WRITE SRI VPI VPIN WRITE SR-Info/VP-Info Reference Manual Page 404 SECTION 4 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 GENERAL.PRG VP-Info WRITE (Press Alt-H for Help) ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� � VP-Info WRITER HELP � � � �Delete and Insert Block Commands Miscellaneous � 獲様様様様様様様様 様様様様様様様� 様様様様様様� � �Delete character..... Mark block.... Alt-B QUIT: � �Delete to end of line ^Y Move block.... Alt-M with save.... � � Copy block.... Alt-C without save. ^Q � �Delete line.......... ^T Delete block.. Alt-D � �Insert line.......... ^N Remove marks.. Alt-K PRINT TEXT... ^P � � � �Insert-mode toggle... Tab.......... TAB Key FORMAT PROGRAM Alt-F� � � � 敖陳陳陳陳陳陳陳陳陳陳陳陳陳 FAST CURSOR MOVEMENT 陳陳陳陳陳陳陳陳陳陳陳陳� � � � End of line... ^ Page up....... Top of text... ^ � � � � Start of line. ^ Page down..... Bottom of text ^ � � � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� � � � �NOTES: 1. ^ is Ctrl 2. Keys in pointed brackets are on the Numeric Keypad� 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Press any key to continue ... 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 Examples: 1>WRITE test ;write TEST.PRG 1>WRITE test.txt ;write TEST.TXT 1>WRITE test.dat OFF ;write TEST.DAT with suppression of header 1>WRITE .65 ;write volume 65 in the current library 1>WRITE .num ;write volume number contained in NUM in the current library 1>WRITE .num OFF ;write volume number contained in NUM in the current library with suppression of header 1>WRITE .:avail ;write the next available volume (Caution: be sure to capture this value before using this construct or you'll never be able to find your text again.) WRITE SRI VPI VPIN WRITE SR-Info/VP-Info Reference Manual Page 405 SECTION 4 ZAP Erase all records in the selected file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � ZAP � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command erases all the records. This is not a DELETE. The records cannot be recalled! Use this command with care! If the selected file is indexed, it is automatically reindexed after ZAP. ZAP releases the disk space previously used by the records of the data file. On a network with SET NETWORK ON in VP-Info Professional Network Edition, attempting to ZAP while another user is accessing the file will cause a LOCK error. Always LOCK the file before ZAP. Example: 1>USE employee 1>COPY TO empl1 1>USE empl1 1>ZAP APPENDIX A The SR-Info/VP-Info Compiler Unlike most database management languages, which execute a program one command at a time, SR-Info/VP-Info compiles its programs -- that is, it processes all the commands before it begins to execute them. Compiling is a major reason why SR-Info/VP-Info runs faster than other database languages. Most of the time, the compiler will be invisible to you. However, compilation presents some advantages and restrictions that are unique to SR-Info/VP-Info, and we'll outline these in this appendix. ZAP SRI VPI VPIN ZAP SR-Info/VP-Info Reference Manual Page 406 APPENDIX A A.1. What Happens at Compilation Before a program can be executed, SR-Info/VP-Info must perform two tasks: First, the program itself must be translated into compile form. In compiling a program, SR-Info/VP-Info converts its commands into a code that is very speedily executed by your computer. In command lines with macros, only the command verb is coded; such lines are converted into SR-Info/VP-Info code later, when they are executed. Why Not a COM File? Many compilers for computer languages produce a single file with the COM or EXE extension; such files can be run without the compiler's presence. Why doesn't SR-Info/VP-Info produce such compiled programs? Most compilers are made up of two parts. First is the compiler itself, the program that does the translation. Second is the subroutine library; most compiled commands make a number of calls to this library. At compilation, the compiled program is "linked" with the library (or with the part that is needed). SR-Info/VP-Info must have the compiler present at all times because of macros, which are left uncompiled. Whenever it encounters a macro in a running program, SR-Info/VP-Info must access the compiler, translate the macro, then continue execution. Second, SR-Info/VP-Info has to prepare the computer's memory in order to keep track of information that the program uses and manipulates. The state of this memory space at any given time is called the environment. SR-Info/VP-Info always compiles a program before executing it. If you run a program in its text (PRG) form, SR-Info/VP-Info compiles it on the spot. The PRG file on disk is unaffected: if the program fails, you can still edit (or debug it) as needed. Compiled Programs You can store a program in compiled form on disk. The COMPILE command translates a named file with the PRG extension to a compiled Compilation VPI VPIN Compilation SR-Info/VP-Info Reference Manual Page 407 APPENDIX A program with the same filename, but with the extension CPL. This new, compiled file will load and begin execution more quickly. However, the compiled form in the CPL file can't be edited directly. If you find an error in the program, edit the PRG file, then compile it again. SR-Info/VP-Info always attempts to run the compiled version of a program first. It will run the PRG file only if it finds no compiled version on the disk. You can also compile a list of programs; see the COMPILE command in Section 4.3. In some ways, compiling is a "dry run" of the program: the compiler opens and closes the named data files, creates all of the memory variables (but types and values are not attached), sets up internal tables (stacks) for nested command structures, and tests expressions for validity (for form, not for variable types). The errors found at this stage are called compile-time errors. It's important to remember that compiling a program is not exactly the same as executing it; rather, it is the preparation for speedy execution. Certain types of errors do not appear at compile time. These errors are called run-time errors. Most often they involve variables of the wrong type. Compile-time errors are always reported by SR-Info/VP-Info with the line number. Run-time errors report line numbers only if the line numbers are compiled into the program; this is accomplished with the SET LINE ON command (the default). To understand the effect of the compiler on programs, it helps to know something about how the compiler reads the text of a program and about how SR-Info/VP-Info manages memory - its environment. A.2. SR-Info/VP-Info Environment The term environment refers to the current arrangement of memory, SR-Info/VP-Info's "workspace." This is where SR-Info/VP-Info keeps track of all of the data files and variables being used, the program being executed, and other special settings. The SET File SR-Info/VP-Info always runs under DOS, in what is left of the computer's memory after DOS itself (and possibly some memory-resident programs and/or a network) are loaded. If total memory is 640K, anywhere from 350K to 550K will be available to SR-Info/VP-Info. If not enough free memory is available, SR-Info/VP-Info cannot be run. Environment VPI VPIN Environment SR-Info/VP-Info Reference Manual Page 408 APPENDIX A SR-Info does not allow the user to custom-tailor memory in any way, since it always attempts to load 128K of internal high memory in addition to the space it takes itself and a 64K work space. VP-Info Professional, however, allows high-memory to be limited to as little at 32K, and to allocate up to 32K for loading assembly-language modules assembled into binary files and executed from within VP-Info Professional. The DOS memory looks like this when fully loaded Top of DOS memory 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 1. External high memory (used by RUN command) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 2. DOS file buffers if files more than 20 (FILES=) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 3. BIN file space if any (BINSPACE=) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 4. Internal high memory (MEMORY=) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 5. Data space (64K) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 6. SR-Info/VP-Info (200K) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 7. Memory-resident programs, if any (unload in necessary) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 8. Operating system (35-50K) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Bottom of DOS memory The special files called VPI.SET and VPIN.SET for the single-user and network versions of VP-Info Professional respectively provide control over levels 2 through 4 (see these commands in Section 4.3), while the FIELDS= command affects the allocation of memory within level 5. (NOEFFECTS is used to suppress screen and sound effects, and has no effect on the environment.) What is the Environment? SR-Info/VP-Info takes control of all memory in levels 2 through 6, an area generally termed the "environment." Much of the environment remains constant, but we are concerned primarily with the items that can change. Therefore, you can think of the environment, in part, as all data files that are currently open (with their respective fields) and the file numbers assigned to them. Changing the set of open data files produces a different environment. Environment VPI VPIN Environment SR-Info/VP-Info Reference Manual Page 409 APPENDIX A For example, these data file actions serve to establish and change the environment: A. Opening a data file (with the USE command). B. Assigning a file number to a data file (SELECT, USE). C. Closing a data file (CLOSE, CLEAR). D. Changing the structure of a data file (MODIFY). E. Opening or closing index files (USE, SET INDEX). (To see a "snapshot" of the environment, give the STATUS command. This displays information about the current state of open data files, SET switches, and memory variables.) Memory variables, too, are part of the environment, and the environment is affected when you create a new memory variable (with =, STORE, et al; see "Variables" in the Topical Reference) or release an existing one (RELEASE, CLEAR). The data-type and contents of the individual memory variables are not significant to the environment; what is important is the order in which they are created. SR-Info/VP-Info keeps track of the data files and memory variables by creating reference tables in memory. These tables are described in more detail later in this section. Finally, there are specific environmental commands: the SET commands (SET . . . TO) and SET switches (SET . . . ON/OFF). They are used in conversational mode, in programs, and in the configuration file VPI.CNF to customize SR-Info/VP-Info. For explanations of the individual SET controls, refer to the Alphabetical Command Reference. The Configuration File The configuration CNF file is a program that, if present, is automatically executed when you start SR-Info/VP-Info from DOS. VPI.CNF can contain most commands. Its primary purpose, however, is to configure SR-Info/VP-Info's default settings to your computer and to your applications. Typical commands in the configuration file are the SET commands and switches, in particular, SET DEFAULT, SET MEMORY, and SET FIELDS; values assigned to system variables and function keys, in particular, to :COMPANY; also, the structure FILES . . . ENDFILES normally appears in this file. Environment VPI VPIN Environment SR-Info/VP-Info Reference Manual Page 410 APPENDIX A A.3. SR-Info/VP-Info Memory Use The table in Section A.2. illustrates how SR-Info/VP-Info uses memory (RAM) space: SR-Info/VP-Info itself utilizes about 200K of memory. To maximize speed, the EXE program is not overlayed so it all goes into memory at one time . . . an advantage of being kept "lean and mean." Data Space The following table illustrates the use of the 64K of data space reserved by SR-Info/VP-Info: 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� DOS work space (for Read buffers) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Data file table (Fields Table) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Data Records (data file buffer) Indexes Relations Limit 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Work space (about 25K) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� DOS stack 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Internal data space (fixed) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Data File Table The data file table tracks all open data files. It includes an entry for each field of each data file in use, describing the field, and a pointer (a number indicating location in memory) to the data file buffer for the contents of the field. Any time a data file is opened, a memory area, called a buffer, is set up for it, the size of one record. The size of the data file table is 320 fields, unless changed in the SET file by a FILES= command in VP-Info Professional. For instance, the commands: USE employee Memory VPI VPIN Memory SR-Info/VP-Info Reference Manual Page 411 APPENDIX A USE#2 supplier USE#3 invntory set up a data file table like this: |-----25----|-----17-----|-----35-----|--------243-----------| employee supplier invntory unused Now if you close supplier: 1>CLOSE#2 the table becomes: |-----25----|-----17-----|-----35-----|--------243-----------| employee unused invntory unused When the next file is opened, is goes into the vacant space if it has 17 or fewer fields, otherwise it goes after INVNTORY: 1>USE#2 order yielding either |-----25----|-----17-----|-----35-----|--------243-----------| employee order invntory unused or |-----25----|-----17-----|-----35-----|--20--------223-------| employee unused invntory order unused Care must be taken to avoid creating too many "holes." As a suggestion, assign all files that never close to the lower file numbers (1, 2, 3, . . . ). Then use the succeeding file numbers to put the transient files into use, in the order of their size (in fields), with the largest ones first. If you run into an error message indicating that you've run out of space, then CLOSE ALL data files, and put the needed files into use again. This caution is necessary if you open and close data files more than once in a program, if you use commands that create files (COPY TO, TOTAL, SORT) or if you use commands that temporarily open data files (POST, APPEND FROM). Data Records An index file uses a buffer of 768 bytes. Each relation established with SET RELATION, each filter set with SET FILTER, and each limit set with LIMIT or SCOPE commands, takes 128 bytes. Memory VPI VPIN Memory SR-Info/VP-Info Reference Manual Page 412 APPENDIX A Program Space Programs load and compile in this space. Certain other commands affect the amount of memory actually available for programs. The REPORT command needs about 5K, so programs that use REPORT must be 18K maximum. The number of bytes available in the program space is given by the SPACE() function and also by the STATUS command. The Internal Data Space The internal data space reserves all the memory SR-Info/VP-Info needs for internal variables, stacks, and so on. The size of the internal SR-Info/VP-Info data space is fixed by SR-Info/VP-Info; it may change from version to version. Since programs compile right on top of this space, all user programs may have to be recompiled whenever a new version of SR-Info/VP-Info is used. The internal data space contains a number of important tables. The Memory Variable Table This table has 128 entries. It describes all the memory variables in use. For each variable, it contains a pointer (a number indicating location in memory) to the contents of the variable. The contents could be in the compiled text (some strings), in the memory variable storage table, or (for matrix variables) in high memory. The Memory Variable Storage Table This contains the contents of those memory variables not in the compiled text or stored as matrices in high memory. It is 4K in size. Stacks Used during compilation and program execution, stacks are internal tables that keep track of the nesting structures IF and DO WHILE and DO commands. Various stacks are utilized by SR-Info/VP-Info. If too many levels of nesting are used, and one of these stacks runs out of room, an error message is issued. Internal High Memory The internal high memory usage is illustrated in the following table: (External high memory) High-end of internal high memory 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Matrix variables Memory VPI VPIN Memory SR-Info/VP-Info Reference Manual Page 413 APPENDIX A 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Index buffers (10K-64K) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� FILES table 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� screens 2, 3, 4 (4K each) 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Temporary storage 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Command lines 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� Low-end of internal high memory (Data space) SR-Info/VP-Info uses 128K of high memory as internal high memory (unless MEMORY= is used in the SET file, VP-Info Professional only; see "External High Memory," below). 800 bytes are reserved for command line storage. Index buffers take a minimum of 10K; ordinarily, they take half of internal high memory, to a maximum of 64K. The FILES table is created from the FILES . . . ENDFILES structure. Each matrix variable may occupy up to 64K of memory. There can be at most 20 matrix variables in use at one time. The STATUS command displays the number of bytes left in high memory. External High Memory External high memory is essentially whatever is left over after SR-Info/VP-Info takes the amount it needs plus as much internal high memory and BINSPACE is requested or available, whichever is less. To maximize external high memory available to the RUN command, VP-Info Professional users can reduce the amount of internal high memory requested; example MEMORY=64. Memory VPI VPIN Memory SR-Info/VP-Info Reference Manual Page 414 APPENDIX A A.4. Modules and Environment The SR-Info/VP-Info compiler treats each kind of module (stored command sequence) differently. The differences lie in the way each module type interacts with the environment. Procedures A procedure is defined in a PROCEDURE . . . ENDPROCEDURE structure, and called (executed) by the PERFORM command. A procedure is compiled only once, the first time it is called. This means that if the procedure is "sensitive" to the environment -- that is, if it refers to data files, fields, or memory variables -- then it can only be called into the same environment as when it was compiled. If the environment changes -- i.e., if the data file numbers are reassigned or memory variables released -- then the procedure must not be affected by these changes: it must not refer to the changed part of the data file table or memory variable table. Subroutines A subroutine is a command sequence stored in a separate program. It isn't compiled as a separate file, but rather as part of the main program that calls it with the DO command. (See, however, the section "Compiling Multiple Subroutines.") On the disk, the compiled subroutine becomes a part of the compiled main program; in execution, it becomes an overlay. This means that when the execution reaches the subroutine, the main program is exited; its status at this point is recorded. The compiled subroutine is brought in; it overwrites (overlays) the main program. When the subroutine is exited, the main program is brought back, its status recovered, and execution continues. Unlike a procedure, a subroutine is compiled each time it's called. If there are five DO commands that call a single subroutine, then the subroutine is compiled five times - each time with the current environment - into the main program. To avoid unnecessary compilations of subroutines, place them in procedures. For instance, the subroutine SUMMING is used with two different environments 15 times in a program. Using DO SUMMING 15 times would result in a compiled program that is far too large. Instead, define two procedures: Program Modules VPI VPIN Program Modules SR-Info/VP-Info Reference Manual Page 415 APPENDIX A PROCEDURE summing1 DO summing ENDPROCEDURE PROCEDURE summing2 DO summing ENDPROCEDURE Give the command PERFORM SUMMING1 in the first environment, and PERFORM SUMMING2 in the second environment. This will make the compiled program substantially smaller. Chained Programs The simplest kind of module is a program. One program can be executed from within another using the CHAIN command. When this command is used, the environment is cleared and the new, chained program begins execution with a "clean slate." All data files to be used must be re-opened and memory variables redefined. Memory variables (but not matrices) can be passed between chained files by using the GLOBAL command; see GLOBAL in the Alphabetical Command Reference. A program called by CHAIN does not return to the calling program. Any program may be chained to any other; a program may even be chained to itself (for example, in an ON ESCAPE structure, CHAIN can be used to re-start the current program). A.5. The Compilation Process Some aspects of compilation have an impact on VP- Info programming. This section gives you an overview of the compilation process. Compiling the Program In compiling a program, SR-Info/VP-Info analyzes the text of each command line, and rewrites it into a language that can call up SR-Info/VP-Info's own internal functions as they are needed. SR-Info/VP-Info is a one pass compiler. This means that SR-Info/VP-Info compiles the command lines one at a time. Steps of compilation: Compilation Process VPI VPIN Compilation Process SR-Info/VP-Info Reference Manual Page 416 APPENDIX A A. The compiler replaces all memory variables by pointers to the memory variable table. At compile time, the type of the variable is not entered into the table, only the name and the order in which they are defined. This should be kept in mind when using the commands: RELEASE, CLEAR, RESTORE FROM, GLOBAL, CHAIN, and DO. All memory variable files (MEM files, created with SAVE TO) have to be present at compilation when a RESTORE command is used. B. The compiler replaces all fields by pointers to the data file table. In the data file table, there are pointers to the data file buffer for the current contents of the fields. This should be kept in mind when using the commands USE, SELECT, and CLOSE. For instance, USE cust cannot be compiled unless the CUST file is present. Of course, CUST need not have any records (just a structure), and it does not have to be on the same disk drive at execution time (this can be controlled with SET DEFAULT command and the FILES . . . ENDFILES structure). See also "Compiling and Data Files" latter in this Appendix for alternate ways to refer to data files. C. The commands are rewritten into SR-Info/VP-Info's own internal language. The internal commands mostly call functions in SR-Info/VP-Info. When a macro is encountered, the command verb is coded, and the compilation of the line is put off until execution time. D. Pointers are placed in compiled command lines to indicate the beginning or end of a control structure, or of some part of the control structure. For instance, each CASE includes a pointer to the line containing the next CASE; each ENDREPEAT includes a pointer to the REPEAT command that begins the structure. More specifically, when SR-Info/VP-Info encounters the command: IF cond where cond is a logical expression, it puts the location of the compiled line on the IF stack. When ENDIF is Compilation Process VPI VPIN Compilation Process SR-Info/VP-Info Reference Manual Page 417 APPENDIX A encountered, this location is pulled off the IF stack, and the location after ENDIF placed into the IF line. So if cond is false, at execution time SR-Info/VP-Info knows where to jump to go beyond the command sequence it does not have to execute. This is what is known as forward referencing. Forward referencing contributes significantly to SR-Info/VP-Info's speed advantages over other database languages. Forward Referencing in Action Here's an example of just how speedy forward referencing makes SR-Info/VP-Info compared to other database languages. Consider the following program: STORE 0 to count STORE 1 to a DO WHILE count<500 DO CASE ******************** 1 CASE 1=2 STORE a to dummy STORE a to dummy STORE a to dummy * each CASE consists of above STORE line 50 times ******************** 2 * total of 5 cases, all false, * all with same line 50 times CASE 1=2 STORE a to dummy STORE a to dummy ENDCASE STORE count+1 to count ENDDO This 267-line program does not do much. It repeats 500 times, using the DO WHILE . . . ENDDO structure (rather than REPEAT . . . ENDREPEAT which is not a command of the dBASE languages) and the DO CASE . . . ENDDO structure. There are 5 CASEs, each one with a false expression as a condition, so none is ever executed. Each CASE is 50 lines long; since these lines never get executed, it does not matter what they contain. The SR-Info version was compiled first and the CPL file was run, beating the fastest dBASE version by 100-1. Compilation Process VPI VPIN Compilation Process SR-Info/VP-Info Reference Manual Page 418 APPENDIX A Forward referencing clearly provides a significant improvement in processing speed. And, although this program is for testing purposes only, its structure is very similar to many business programs. For instance, a payroll program with 5 different types of employees would have this type of structure. E. Procedures are compiled wherever they are first performed. F. Subroutines are compiled into the main program with each calling DO command; a subroutine called three times is compiled three times. A.6. Compiling and Data Files Several aspects of using data file references within SR-Info/VP-Info programs require special attention. These are covered in the following few sections. Conditional Opening and Closing of Data Files SR-Info/VP-Info compiles all command lines, whether or not the conditions controlling their execution are true (that is, whether or not they are ever executed when the program is run). At compile time, SR-Info/VP-Info cannot know the status of all conditions, since conditions may be decided by the user or the program while it is running, not in advance. This compilation process has implications that need to be considered when opening and closing data files in conditional structures. Take a simple example of two data files; T1 contains the field VAR1 and T2 contains VAR2. Now, say we try to use the following command sequence: USE t2 ;T2 is opened IF cond USE t1 ;T1 is opened ? var1 ELSE ? var2 T1 is still open ENDIF This command sequence, which would run perfectly under dBASE, fails to compile in SR-Info/VP-Info. Here's why: Compiling and Data Files VPI VPIN Compiling and Data Files SR-Info/VP-Info Reference Manual Page 419 APPENDIX A When SR-Info/VP-Info compiles the IF structure, it does not know whether cond will be true or false at execution time. So, when the next command line opens data file T1 (thereby closing T2), the SR-Info/VP-Info compiler performs this operation. However, in the ELSE clause (which at execution is performed when the condition is false), the program looks for the field VAR2 (which is in the now closed data file T2). The result is a compiler error. Note also that if the ELSE clause didn't refer to T2, any command following this IF structure that expected T2 to be open would create such an error. Because of the compiler's way of carrying out commands, it is recommended that you open and select all data files at the beginning of a program, if possible. Limit the use of the commands USE, CLOSE, RELEASE, CLEAR, and RESTORE in conditional command structures. If you must include commands such as USE in a DO CASE or IF structure, include one at the beginning of each case (including ELSE and OTHERWISE), and one after the END command: IF USE ELSE USE ENDIF USE . . . DO CASE CASE USE CASE USE OTHERWISE USE ENDCASE USE Note that such programs also run under dBASE. In fact this technique is good programming practice in either SR-Info/VP-Info or dBASE, since it makes data file choices more explicit. Compiling and Data Files VPI VPIN Compiling and Data Files SR-Info/VP-Info Reference Manual Page 420 APPENDIX A Referencing Unknown Data Files To open data files and use field references in a program, it's essential that the data files referred to be present at compile time. Data files must be available on the path specified (either with a FILES structure, with SET DEFAULT, or with USE :). (Since index files are not opened at compile time, they need not be present on disk when compiling.) If a data file used by a program is unavailable or unknown at compile-time, follow one of these suggestions: A. If the name and structure are known, but the file doesn't exist, create an empty data file with the name and structure of the missing data file. Remember, the compiler doesn't read data - it only checks to make sure the proper fields are present for the commands to be executed. B. If the name and structure of the data file are unknown (that is, if these will be supplied by the user at execution), open the data file with a macro in the USE command, and use macros in place of any field references within the program. C. As an alternative to using macros in place of field references, you can make sure that each command line referring to a field in an unknown data file contains at least one macro. Including a macro defers compiling of a command line until execution, when the structure of the data file will be known. D. If the structure is known, but the name is unknown (if it will be supplied by the user at execution), give a USE command with the COMPILE keyword. USE . . . COMPILE lets you open a data file with an identical file structure for compile-time references. A second USE command, containing a user-supplied file name in a macro, opens the desired file at run-time (i.e., upon actual execution of the program). The following two USE commands coexist peacefully within the same program, the first working at compile time, the second at execution. USE#2 inven COMPILE USE#2 &filename Here's how this sequence works: At compile time . . . USE#2 inven COMPILE tells the compiler to open the data file INVEN.DBF as a surrogate for file 2. The structure Compiling and Data Files VPI VPIN Compiling and Data Files SR-Info/VP-Info Reference Manual Page 421 APPENDIX A of INVEN (field names, field types, etc.) is used wherever file 2 is referred to in the program. USE#2 &filename is only partially compiled (as are all commands with macros). At execution . . . USE#2 inven COMPILE is ignored. USE #2 &filename is used, with the user supplying the filename for this data file. The file structure (field names, field types, etc.) of this file must be the same as that of inven. This is useful when several people use the same program to access data files with the same structure, but different file names; for example, if several sales entry clerks have their own transaction files to which they enter orders. Commands That Close Data Files Another set of commands to be careful with are those used to move data from one data file to another. These are APPEND FROM, COPY, COPY STRUCTURE, POST, SORT, and TOTAL. They are alike in that the data file named in them is left closed once the command is executed. Actually what happens is this: when SR-Info/VP-Info encounters one of these command, it looks for the named file. If the named file is open, it is first closed. Then it is opened as a temporary, internal data file. Once SR-Info/VP-Info finishes executing the command, the internal file is once again closed. As a result, you must reopen any data file named by one of these commands if subsequent commands refer to fields in this named data file. Here is a command sequence that uses a temporary data file (tempcust) to add customer records. When it finds there are no more additions to make, it appends the temporary data file to the main data file (customer): USE#2 customer ;Opens customer SELECT 1 USE tempcust ;Opens tempcust ZAP DO WHILE T ;Commands for record entry IF name =' ' ;Typical way of ending program SELECT 2 USE customer APPEND FROM tempcust ;Copies from tempcust to customer, ;leaving tempcust closed Compiling and Data Files VPI VPIN Compiling and Data Files SR-Info/VP-Info Reference Manual Page 422 APPENDIX A CLOSE ;Closes customer SELECT 1 ENDIF ;These commands refer again to tempcust ENDDO The flaw in this command sequence should be clear from the above discussion. Since APPEND FROM names tempcust, this data file is closed and then reopened as a temporary, internal data file. As a result, subsequent references to a field in tempcust (in the command sequence following ENDIF) will cause compiling to cease with this error message: "2. Variable not found." This sequence is fixed by simply adding the command USE#1 tempcust COMPILE, as follows: . . . SELECT 1 USE#1 tempcust COMPILE ENDIF ENDDO All the commands listed above (APPEND FROM, COPY, COPY STRUCTURE, POST, SORT and TOTAL) have the same effect and require a USE . . . COMPILE command as above if fields within the named file are referenced later in the program. A.7. How SR-Info/VP-Info Reads a Command Line In SR-Info/VP-Info, a command line is defined as the text from the beginning of a line up to a carriage return (indicating the end of the line) or a semicolon. A semicolon followed by a comment is ignored by the compiler; a semicolon followed by a carriage return (ENTER) indicates that the command line continues in the next line. Analyzing a Command Line The compiler analyzes the command line beginning with the first word. It checks the first word by taking the following steps and acts on the first case that applies: Step 1. Is the first word a ? or ?? command? Step 2. Does the first word contain a command redirection (e.g., in USE#2)? Reading the Command Line VPI VPIN Reading the Command Line SR-Info/VP-Info Reference Manual Page 423 APPENDIX A Step 3. If the first word is a number, then the line is rewritten as a GOTO command. Step 4. The first four letters of the first word are looked up in a table of command-verbs. Step 5. If the first word is followed by an equal sign (=) or an open square-bracket ([), the line is rewritten as a STORE or REPLACE command. (Note that step 5 overrides the decision made by step 4; see example below.) Step 6. If Steps 4 and 5 both fail, SR-Info/VP-Info displays an error message. Step 7. The line is checked for a macro (if a macro is permitted for the command identified in Step 4). Step 8. SR-Info/VP-Info jumps to the compilation routine of the command found in Step 4. Step 9. If the first word is SET, SR-Info/VP-Info checks whether it is a setting command (e.g., SET ALTERNATE TO, SET COLOR TO; these are separate commands) or a switch (e.g., SET ADD ON, SET BELL OFF; these are all different parameters of a single command). If no valid command or parameter is found, the line is ignored. Analyzing Expressions After it has determined the type of command contained in a command line (according to the above steps), SR-Info/VP-Info determines the contents of expressions contained in the command line. Expressions are built up from variables and functions. Wherever SR-Info/VP-Info identifies an expression, it searches for the type of each element in the expression, in the following order: 1. Function 2. Numeric constant 3. String constant 4. System variable 5. Matrix variable 6. Redirected field (e.g., title#2) 7. Field 8. Memory variable 9. Logical constant You can see that memory variables are low on the list. This means, for instance, if you give a memory variable the same name as a Reading the Command Line VPI VPIN Reading the Command Line SR-Info/VP-Info Reference Manual Page 424 APPENDIX A field, say, LNAME, then at every mention of that memory variable, SR-Info/VP-Info will reference the field LNAME. Avoid such confusion by giving memory variables names that won't be confused with SR-Info/VP-Info keywords, functions, or field names. Examples of Command Line Analysis Here are some examples of how SR-Info/VP-Info analyzes command lines and expressions, and some guidelines for avoiding confusion. EJECT=T In this line, the first word is "EJECT". Since it is followed by "=", this line is interpreted as a STORE (notice that step 5, which calls for this interpretation, overrides step 4, which would have interpreted EJECT as a command). Next question: what is "T"? It is not a function, nor is it any of the other first six entries in the priority table above. If it is a field (priority 7) or memory variable (priority 8), EJECT is given the value contained in T. If it is neither, then "T" is interpreted as priority 9, a logical constant, true. Therefore, this command line defines a variable EJECT whose content is the value of a field or variable, or the logical constant true. IF eject In this line, the first word is interpreted as a command (Step 4), and compiled as such (Step 8); eject, even though it is a SR-Info/VP-Info command verb, must in this context be a field or a memory variable, and there will be no confusion. "Buried" Remarks Many commands consist of a single word; they have no keywords (e.g., EJECT and ENDDO). Whatever appears on a line starting with one of these commands is disregarded by SR-Info/VP-Info. For instance, you can write an IF structure like this: IF approved .AND. count<100 ENDIF approved .AND. count<100 Here, the condition is repeated as a remark within the ENDIF command line to clarify which conditional structure is ended. This is a valid and useful remark; however, using ";" to separate remarks from commands is better practice: Reading the Command Line VPI VPIN Reading the Command Line SR-Info/VP-Info Reference Manual Page 425 APPENDIX A ENDIF; approved .AND. count<100 Miscellaneous Command Line Guidelines A. Since SR-Info/VP-Info checks only the first four letters of command verbs, SET PRINT, SET PRINTER, SET PRINTERNOW are all the same. B. Take care to write out in full those keywords that look alike when abbreviated. For instance, ENDD and ENDR are easily misread; such mistakes are difficult to find. C. To sum up it is possible to use SR-Info/VP-Info keywords as variables and to place comments on command lines, if you are aware of all the above SR-Info/VP-Info conventions. However, to be on the safe side, avoid such practices. A.8. Compiling Multiple Subroutines In programs that call multiple subroutines, it is easy to get so bogged down in compiling the main (or "calling") program that your subroutines never get debugged. Imagine, for example, that you have a program MAIN.PRG, that calls 45 separate subroutines as follows: . . . DO sub1 DO sub2 . . . DO sub45 . . . Normally, when you compile main, SR-Info/VP-Info has to compile SUB1.PRG, SUB2.PRG, and so on, up through SUB45.PRG. If you are trying to debug SUB45, this will slow you down considerably. The command SET DO takes care of this problem. With SET DO ON (the default) the compiler compiles all subroutines along with the calling program. With SET DO OFF, compiling main does not compile the subroutines. Instead, for each subroutine SR-Info/VP-Info creates an "environment file", with the name of the subroutine file and the extension ENV. For example, the "environment file" for SUB45.PRG is SUB45.ENV. Multiple Subroutines VPI VPIN Multiple Subroutines SR-Info/VP-Info Reference Manual Page 426 APPENDIX A Once environment files exist, the subroutines can be individually compiled and debugged. SR-Info/VP-Info uses the environment files for the compilation of each subroutine. With SET DO OFF, you can still compile main so that the subroutines are compiled as overlays. To do so, use the LINK keyword in the COMPILE command: COMPILE main LINK Steps in Debugging Subroutines Here's an example of using SET DO OFF for debugging a subroutine. 1. Reset the DO switch: SET DO OFF 2. Compile the main program: COMPILE main 3. Compile any other subroutines without which the subroutine can't be run, e.g.: COMPILE sub1 COMPILE sub10 4. Compile the subroutine you are debugging: COMPILE sub45 5. Run the main program: DO main Test whether SUB45 works properly. If it does not, edit SUB45.PRG, compile SUB45 again, then test it by executing MAIN. A.9. Data-File Headers On disk, a data file starts with a data-file header that describes the structure of the data file. SR-Info/VP-Info uses the data file headers to set up the data file table. The data-file headers of all three types of SR-Info/VP-Info data files contain essentially the same data. Data File Headers VPI VPIN Data File Headers SR-Info/VP-Info Reference Manual Page 427 APPENDIX A Type 1 Data File Header Introduction: Byte 0 File type indicator (CHR(1)) Bytes 1-2 Number of records in file Bytes 3-4 Location of first byte of first record Byte 5 Not used Bytes 6-7 Length of each record Field 1: Bytes 8-18 Field name Byte 19 Type (C, N, or L) Byte 20 Width Bytes 21-22 Offset Byte 23 Decimal places Fields 2 and up: Add (-1) * 16 to locations shown for Field 1. For example, add 16 to each byte in Field 1 for the location of the corresponding information for Field 2; thus, Field 2's name is found in bytes 24-34. A carriage return in the first byte of a location allocated for a field name indicates that the data file contains no more fields. First byte of first record: Byte specified in Bytes 3-4. Type 2 Data File Header Introduction: Byte 0 File type indicator (CHR(2)) Bytes 1-2 Number of records in file Bytes 3-5 Not used Bytes 6-7 Length of each record Field 1: 8-18 Field name Byte 19 Type (C, N, or L) Byte 20 Width Bytes 21-22 Offset Byte 23 Decimal places Fields 2 to 32: Add (-1) * 16 to locations shown for Field 1 (see Type 1 example). First byte of first record: Byte 521. Data File Headers VPI VPIN Data File Headers SR-Info/VP-Info Reference Manual Page 428 APPENDIX A Type 3 Data File Header Introduction: Byte 0 File type indicator (CHR(3) or CHR(131)) Bytes 1-3 Not used Bytes 4-7 Number of records in file Bytes 8-9 Location of first byte of first record Bytes 10-11 Length of each record Bytes 12-31 Not used Field 1: Bytes 32-42 Field name Byte 43 Type (C, N, L, D, M, or F) Byte 44-45 Offset Bytes 46-47 Not used Byte 48 Width Byte 49 Decimal places Bytes 50-63 Not used Fields 2 and up: Add (-1) * 32 to locations shown for Field 1 (see Type 1 example). First byte of first record: Byte specified in Bytes 8-9. Note that Type 3 data files originated by dBASE may have two field types not present in SR-Info/VP-Info. Both the Date type and the Memo type are treated as ordinary character- type fields by SR-Info/VP-Info, and the Float type introduced with dBASE IV is treated as an ordinary numeric field. If a memo field is present, the file type indicator in Byte 0 is CHR(131); otherwise it is CHR(3). In all cases, numeric values are stored in a form that is best handled with SR-Info/VP-Info's CHR( and RANK( functions, or in VP-Info Professional, with CTONUM( and NUMTOC(. If the number is longer than one byte, the value in the first byte is ones, the values in the second are 256s, the values in the third are 65536s, and so on. For example, if you find that the values of Bytes 1 and 2 of a Type 2 file are 38 and 2, you could calculate that the data file has 38+(2*256) records, or 550. Similarly, if you need to convert the number 550 into a two-character string, your result would be CHR(MOD(550,256))+CHR(550/256). Data File Headers VPI VPIN Data File Headers SR-Info/VP-Info Reference Manual Page 429 APPENDIX B APPENDIX B The SR-Info/VP-Info KEYWORDS ABS( CLS ACCEPT COL( ACOS( COLOR ADD (in SET) COLOR (in SET) ADDITIVE COMPILE ALL CONFIRM (in SET) ALTERGATE (in SET) CONSOLE (in SET) ANSI (in SET) CONTINUE APPEPT COPY ASC( COS( ASIN( COSH( AT( COUNT ATAN( CREATE AVERAGE CTONUM( BELL (in SET) CURSOR BIN (in SET) DATE (in SET) BINLOAD DATE( BINSPACE DAYS( BINUNLOAD DBF( BIT( DBFX( BLANK DEBUG BLANK( DEBUG (in SET) BOTTOM DEFAULT (in SET) BOX DELAY BREAK DELE (in SET) BROWSE DELETE CALC( DELETED( CALL DELIMITED CANCEL DELIMITER (in SET) CARRY (in SET) DIM CASE DIR CEIL( DIR (in SET) CEN( DIR( CHAIN DIRF CHAR DIRX( CHR( DISPLAY CLEAR DISPLAY (in SET) CLOSE DIVZERO (in SET) CLOSE( DO SR-Info/VP-Info Reference Manual Page 430 APPENDIX B DO (in SET) IF DOUBLE IFF( DOWN IFKEY( ECHO (in SET) IN( EDIT INDEX EJECT INDEX (in SET) EJECT (in SET) INKEY( ELSE INPUT END (in SET) INSERT( ENDCASE INT( ENDDO INTENSITY (in SET) ENDIF KEEP (in SET) ENDON LAST ENDPROCEDURE LEFT ENDREPEAT LEFT( EOF LEN( EOF( LENGTH (in SET) ERASA LIBRARY (in SET) ERROR (in SET) LIKE ESCAPE (in SET) LIMIT EXACT (in SET) LINE (in SET) EXCEPT LINK EXECUTION (in SET) LINK (in SET) EXP( LIST F LOC( FIELD LOCATE FIELD (in SET) LOCK FIELD( LOCK (in SET) FIELDS LOG10( FILE LOG FILE( LOG (in SET) FILES LOG( FILTER (in SET) LOOP FIND LOWER( FLD( LTRIM( FLOOR( MARGIN (in SET) FLUSH MAX FOR MAX( FORM MEMORY FORMAT (in SET) MEMORY (in SET) FROM MENU (in SET) FUNCTION (in SET) MENU( GET MIN GET (in SET) MIN( GET( MOD( GLOBAL MODIFY GO MONO (in SET) GOTO MONTHS( HEADING (in SET) N HELP NDX( SR-Info/VP-Info Reference Manual Page 431 APPENDIX B SR-Info/VP-Info Reference Manual Page 432 APPENDIX B NEAREST RUN NETWORK (in SET) SAVE NEXT SAVE (in SET) NOEFFECTS SAY NUMTOC( SCOPE OFF SCREEN ON SCREEN (in SET) OTHERWISE SCROLL OUT( SDF OVERWRITE SECONDARY PACK SEEK PAGE SEEK( PERFORM SELECT PIC( SET PICTURE SET( POST SFX( POW( SIN( PRIMARY SINH( PRINT SKIP PRINT (in SET) SND( PRINTER( SNOW (in SET) PROCEDURE SORT PROMPT SOUND PUT( SPACE( QUIT SPOOL RAND( SQRT( RANK( SSEEK( RAW (in SET) STATUS READ STEP (in SET) READ( STORE RECALL STR( RECNO( STRUCTURE REINDEX SUBSTR( RELATION (in SET) SUM RELEASE SYSTEM REMARK T REMLIB( TALK (in SET) RENAME TAN( REPEAT TANH( REPLACE TEAR REPLACE( TEST REPORT TEST( RESET( TEXT RESTORE TEXT (in SET) RETURN TIME( RIGHT TIMES RIGHT( TO RING TOP ROPEN( TOTAL ROW( TRIM (in SET) SR-Info/VP-Info Reference Manual Page 433 APPENDIX B SR-Info/VP-Info Reference Manual Page 434 APPENDIX B TRIM( TRUNCATE TYPE( UNLOCK UP UPDATE UPPER (in SET) UPPER( USE USING VAL( VARIABLE VARYING WAIT WHILE WIDTH (in SET) WINDOW WITH WOPEN( WRAP( WRITE WRITE( Y ZAP ZERO (in SET) SR-Info/VP-Info Reference Manual Page 435 APPENDIX C APPENDIX C The SR-Info/VP-Info ERROR MESSAGES 1. Invalid variable type found when executing an expression. 2. Variable not found. 3. Illegal expression. 4. Missing the second operand in an expression. 5. File not found. 6. Index file not found. 7. Record specified is out of range. 8. Error in reading file. 9. Index file is not functioning. 10. Missing 'TO' in command. 11. 128 memory variables have been used. 12. Missing or mismatched string delimiter. 13. No space is left in a control stack. 14. No valid command was found. 15. Invalid nesting of DO WHILE or IF statements. 16. File pointers must be between 1 and 10. 17. Strings cannot be larger than 256 characters. 18. Missing parenthesis ')' or '(' in expression. 19. Invalid CASE construction. (Problem may be in PROCEDURE or DO module.) 20. Must be numeric argument. 21. Invalid variable or constant. 22. Program not found or too many files open. 23. Program is too large for memory. 24. Invalid nesting of DO or RETURN statements. (Problem may be in DO module.) 25. The PROCEDURE must be defined in this module if it is to be PERFORMed. 26. Disk full or error in writing data to disk. 27. File must be indexed for this command. 28. Missing WITH in REPLACE command. 29. Only 10 expressions can be used in the SUM command. 30. Missing FOR clause of LOCATE or CONTINUE command. 31. Insufficient space to do the sort. 32. Improper syntax for dimension variables. 33. Internal macro space has been exceeded. 34. Not enough memory for a buffer to be made. 35. No more than 32 external memory variables are allowed. 36. This program must be re-compiled. 37. This program exceeds the available program memory. 38. A data file must be in USE for this command. 39. Missing 'ON' in this command. 40. CREATE must be followed by a file name. SR-Info/VP-Info Reference Manual Page 436 APPENDIX C 41. Two coordinates must be specified. 42. Screen coordinates are out of range. 43. This command is not authorized for use by end users. 44. This matrix variable is already defined. 45. Not enough memory for this matrix to be defined. 46. Index is outside the range of a buffer or matrix. 47. Sequential file numbers must be between 1 and 4. 48. The index expression cannot exceed 60 characters. 49. Date format cannot exceed 8 characters in length. 50. Indexes for file vectors must be 1 to number of fields in file. 51. Illegal use of macro. 52. Maximum number of fields must in range 128 to 1000. 53. The index file switched to is not open. 54. Screens can be defined from 1-4. 55. Invalid window coordinates. 56. Screen library is not open. 57. Missing = sign. 58. Bit position parameter is out of range. 59. Invalid field or :field reference %s in ON FIELD; check TEXT. 60. Command not found or not enough space to execute. (See: MEMORY=) 61. Network must use DOS 3.1 or greater. 62. Read-only files cannot be changed. 63. %s file locked. 64. Record locked in file %s. 65. Index error. Reduce the key size to index this file. 66. Format lines in a TEXT command exceeded 64 (clear with CLEAR GETS). 67. Only 30 fields can be used in the REPORT command. 68. Invalid file operation due to sharing violation. 69. Memory variable space exceeds limit. 70. Expression is too complex; requires too many temporary variables. 71. Invalid nesting; ENDDO implies a DO WHILE. 72. Invalid nesting; ENDCASE implies a DO CASE. 73. Invalid nesting; ENDIF implies an IF. 74. Invalid nesting; ENDPROC implies a PROCEDURE. 75. Invalid nesting; ENDREPEAT implies a REPEAT. 76. Invalid nesting; ENDON implies a ON ESCAPE, ON ERROR, or ON FIELD. 77. Expecting ENDTEXT command. 78. Expecting ENDFILE command. 79. CASE or OTHERWISE encountered with no corresponding DO CASE command. 80. ELSE command encountered with no corresponding IF command. 81. FIELD command encountered with no corresponding ON FIELD command. 82. LOOP or BREAK encountered with no DO WHILE or REPEAT command. 83. Not enough memory for REPORT (try calling from a DO module). 84. Unable to create a file. 85. Compiled expression too long to save. Simplify. 86. Missing file name in command 87. Division by zero. Permitted only if SET DIVZERO ON (default). 88. Index reference by number must be in range 1 to number of active indexes. 89. Minimum window is 50 characters wide and 5 lines deep for EDIT or SR-Info/VP-Info Reference Manual Page 437 APPENDIX C APPEND. 90. Too many fields requested. Exit VP-Info, increase FIELDS= in VPI.SET file. 91. Function number invalid (file sharing loaded). 92. File not found. 93. Path not found (of file does not exist). 94. No file handle available; check "FILES=n" in CONFIG.SYS and VPI.SET. 95. Access denied. 96. DO nesting level exceeds limit. 97. VP-Info workspace full. (Try breaking program into modules.) 98. Keyword following ON not recognized. 99. SYSTEM ERROR, file access code invalid. 100. SET BIN request cannot be greater than 32K. 101. Unable to satisfy SET BIN request. 102. LOAD failed! Unable to open BIN file. 103. Cannot LOAD BIN blocks larger than 32K. 104. BIN high memory cannot satisfy LOAD request. 105. A maximum of eight BIN files can be LOADED at once. 106. SET BIN must be run before using LOAD or CALL commands. 107. CALL failed! Memory variable not recognized. 108. CALL failed! Command not recognized. 109. Drive not ready. 110. Attempt to write on protected diskette. 111. FAT error - disk may not be formatted. 112. DOS reports critical error. Check floppy drive or printer.