SR-Info/VP-Info Reference Manual Page 109 SECTION 3 STR( Converts a number to a string. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � STR(,[,]) � � � � the number to be converted � � the width of the string � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � the number of decimals � 把陳陳陳陳陳陳陳陳� � � Type: character � � 藩様様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様夕 This function gets a number by evaluating the , and converts it into a string of given width. Optionally, the number of decimals can be specified (the default is 0). See also PIC(. Examples: 1>x=123.456 1>? STR(x,8) 123 1>? LEN(STR(x,8)) 8.00 1>? STR(x,10) 123 1>? STR(x,10,1) 123.1 When combined with the VAL( function, STR( is a convenient way of rounding decimal numbers with a given precision. For example: 1>:PICTURE='9999.99999' 1>a=29.95748 1>? a 29.95748 1>? VAL(STR(a+.005,10,2)) 29.96000 1>? VAL(STR(a+.00005,10,4)) 29.95750 STR( SRI VPI VPIN STR( SR-Info/VP-Info Reference Manual Page 110 SECTION 3 SUBSTR( Gets a substring of a string. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � SUBSTR(, , ) � � � � the string from which the new string is formed � � the position from which the new string is � � taken � � the number of characters to place in the � � new string � 把陳陳陳陳陳陳陳陳� � � Type: character � � 藩様様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様夕 This function, a synonym for the $( function, takes the string in from position (fractions are thrown away); the number of characters taken is . (In both numeric expressions, the fractions are disregarded). Examples: 1>name='David Barberr' 1>? SUBSTR(name, 7,3) Bar 1>? SUBSTR(name, 7,12) Barberr 1>? LEN(SUBSTR(name,7,12)) 7.00 Note that SUBSTR(name,7,12) is of width 7, not 12; there are only 7 letters left in name from position 7. 1>s=3 1>t=1 1>? SUBSTR(name+name,(s+t)/2,1.9) a Note that 1.9 was taken as 1. SUBSTR( SRI VPI VPIN SUBSTR( SR-Info/VP-Info Reference Manual Page 111 SECTION 3 TEST( Tests a string whether it is a valid expression. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � TEST() � � � � the string to be tested � 把陳陳陳陳陳陳陳� � � Type: logical � � 藩様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様様夕 This function tests the string in as to whether it is a valid expression; in particular, all variables must be defined and must be of the proper type. It returns T if it is, F otherwise. If the test is successful, TYPE( can be used to find the type of the expression. In a SR-Info/VP-Info program, use TEST( to find out whether a selection criteria typed in by the user is correct. Or use it to ensure that a variable exists in a subroutine that may be called from several programs. Examples: 1>? TEST('check=0') F false because check is not defined 1>check=0 1>? TEST('check=0') T 1>? TEST('check=0.or.check=1') T 1>? TEST('check="A".or.check=1') F false because "A" is of character type 1>? TEST('num') F 1>num=5 1>? TEST('num') T 1>? TEST('num+') false because the second operand is missing F IF .NOT. TEST('check') check=0 ENDIF TEST( SRI VPI VPIN TEST( SR-Info/VP-Info Reference Manual Page 112 SECTION 3 TIME( Gets the system time. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � TIME([]) � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � one of three types of information requested, as listed � � below � 把陳陳陳陳陳陳陳陳� � � Type: character � � 藩様様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様夕 This function returns a string containing the current system time, and changes the format of the system variable :TIME to this format. (See the system variable :TIME in Section 2. Recall that :TIME is initialized when SR-Info/VP-Info starts up, but can be reinitialized with a :TIME= command.) The can be given in either of two forms, a name or number (numeric expression) as follows: Type Explanation Example 1 or HMS Hours,minutes,seconds,hundredths 17:26:36.07 2 or AMPM Hours,minutes with AM/PM 5:36 pm 3 or Seconds Seconds since midnight 62804.80 Shortcut: When specifying type by name, only the first character is required. The default parameter is 1, the time in the 24-hour format hh:mm:ss.hh. Examples: 1>? :TIME 15:45:59 1>? TIME(2) 3:46 pm 1>:TIME 3:46 pm start=VAL(TIME(seconds)) finish=VAL(TIME(seconds)) ? 'Program execution took',start-finish,'seconds.' TIME( SRI VPI VPIN TIME( SR-Info/VP-Info Reference Manual Page 113 SECTION 3 This displays how long the running of took, in seconds. TIME( SRI VPI VPIN TIME( SR-Info/VP-Info Reference Manual Page 114 SECTION 3 TRIM( Trims blanks from the right-hand side of a string. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � TRIM() � � � � the string to be trimmed � 把陳陳陳陳陳陳陳陳� � � Type: character � � 藩様様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様夕 SR-Info/VP-Info stores strings in fields padded on the right with blanks. In actual use, these blanks may get in the way. TRIM( gets rid of the blanks on the right of a string. TRIM( can be used in the key of an index. See also LTRIM(. Examples: 1>a='David ' 1>? a David 1>? LEN(a) 10.00 1>? TRIM(a)+' is trimmed' David is trimmed 1>? LEN(TRIM(a)) 5.00 1>blank=' ' 1>? LEN(TRIM(blank)) 1.00 Note: TRIM(blank) is a single blank. TRIM( SRI VPI VPIN TRIM( SR-Info/VP-Info Reference Manual Page 115 SECTION 3 TYPE( Gets the type of an expression. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � TYPE() � � � � any expression � 把陳陳陳陳陳陳陳陳� � � Type: character � � 藩様様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様夕 For an expression, , this function returns the type of the expression as a one character string: C for character L for logical N for numeric U Undefined ;created by GLOBAL or VARIABLES command, but not yet given a value or type To test whether a string is a valid expression, use the TEST( function. Examples: 1>a='name' 1>? TYPE(a) C 1>? TYPE(a+a) C 1>n=12 1>? TYPE(a+n) 1. Invalid variable type found when executing an expression. 1>? TYPE(a? TYPE(aTYPE(n+5/10) N TYPE( SRI VPI VPIN TYPE( SR-Info/VP-Info Reference Manual Page 116 SECTION 3 UPPER( Converts a string to upper case. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � UPPER() � � � � the text to be converted to upper case � 把陳陳陳陳陳陳陳陳� � � Type: character � � 藩様様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様夕 All lower-case letters in the are converted into upper case by the UPPER( function, which is a synonym for the !( function. See also the LOWER( function. Examples: 1>a='Aa12b' 1>? UPPER(a) AA12B 1>? UPPER('David!') DAVID! Note that only the lower-case letters are changed. UPPER( SRI VPI VPIN UPPER( SR-Info/VP-Info Reference Manual Page 117 SECTION 3 VAL( Converts a string to its numeric value. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � VAL() � � � � the string to be evaluated � 把陳陳陳陳陳陳陳� � � Type: numeric � � 藩様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様様夕 This function takes the string which is a number, and returns it as a number. If the whole string cannot be interpreted as a number, it takes as much of the front part as it can. Examples: 1>a='123.23' 1>? VAL(a) 123.23 1>? VAL(123.23) 1. Invalid variable type found when executing an expression. 1>? VAL('a12') 0.00 1>? VAL('12a') 12.00 1>? VAL(DATE(2)) yields the current month as a number. VAL( SRI VPI VPIN VAL( SR-Info/VP-Info Reference Manual Page 118 SECTION 3 WOPEN( Opens a DOS file for writing. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � WOPEN([,]) � � � � the file name � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � the DOS file number (between 1 and 4) � 把陳陳陳陳陳陳陳� � � Type: logical � � 藩様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様様夕 This function opens the DOS file, and in particular, the sequential file (or output device, such as COM1:) for writing; if the file does not exist, it will be created. If filenum is not given, filenum=1 is assumed. If no file extension is given, the extension TXT is used. It returns T if successful, F otherwise. See the functions ROPEN(, CLOSE(, GET(, PUT(, SEEK(, SSEEK(, WRITE(, READ(, IN(, OUT(. Example: 1>ok=WOPEN('a:label.prg') 1>? ok T In a SR-Info/VP-Info program, WOPEN( normally appears in an IF command: IF WOPEN('file',2) 2. Two programs to print a text file, TEST (in the second version it is assumed that TEST has no more than 20 lines): SET WIDTH TO 80 SET PRINT ON IF ROPEN('test') DO WHILE READ(line) ? line ENDDO ok=CLOSE() ENDIF WOPEN( SRI VPI VPIN WOPEN( SR-Info/VP-Info Reference Manual Page 119 SECTION 3 WRAP( Wraps text for output. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � WRAP(, ) � � � � the string to be wrapped � � the line width � 把陳陳陳陳陳陳陳陳� � � Type: character � � 藩様様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様夕 This function returns one line of text with word wrapping from the string in ; now contains what is left of the string. In other words, the string returned will contain as many words as will fit in a line (the line width is given by ). If the whole contents of is one line, becomes the blank string (of length 1) WRAP(, IN(, GET(, and READ( are the only functions that change the contents of the memory variable used as an argument. Examples: 1>text='This text line is going to be wrapped in a printed line of width 30.' 1>? text This text line is going to be wrapped in a printed line of width 30. 1>temp=text 1>WRAP(temp,30) This text line is going to be 1>? temp wrapped in a printed line of width 30. 1>WRAP(temp,30) wrapped in a printed line of 1>? temp width 30. 1>WRAP(temp,30) width 30. 1>? temp 1>? LEN(temp) 1.00 WRAP( SRI VPI VPIN WRAP( SR-Info/VP-Info Reference Manual Page 120 SECTION 3 WRITE( Writes a new line into the sequential file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � WRITE([,]) � � � � the line to be written � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � the DOS file number (between 1 and 4) � 把陳陳陳陳陳陳陳� � � Type: logical � � 藩様様様様様様様詫様様様様様様様様様様様様様様様様様様様様様様様様様夕 This function writes (appends) the contents of the string variable to the end of a sequential file opened with the WOPEN( function. If filenum is not given, filenum=1 is assumed. WRITE( returns T if successful, F otherwise. See the functions ROPEN(, WOPEN(, READ(, IN(, OUT(, GET(, PUT(, and CLOSE(. Example: 1>ok=WOPEN('customer.frm',2) 1>ok=WRITE('FIELDS - cust,orderno,amount',2) 1>ok=CLOSE(2) creates the CUSTOMER.FRM report form file: FIELDS - cust,orderno,amount Now the command REPORT CUSTOMER will run the report. This example illustrates how a program can be written that creates a report form file. In a SR-Info/VP-Info program, WRITE( normally appears in an IF command: IF WRITE('file',2) WRITE( SRI VPI VPIN WRITE( SR-Info/VP-Info Reference Manual Page 121 SECTION 3 3.5. Expressions Expressions can be formed from constants (Section 3.1) and variables (Section 2.3) using operations (Section 3.2), relations (Section 3.3), and functions (Section 3.4). There are three types of expressions: numeric, string, and logical. Numeric expressions are built up from numeric constants, numeric variables, and from functions that give results of numeric type; they are formed with the operations: +, -, *, /, and the parentheses: ( and ). String expressions are formed from string constants, string variables, and from functions that give results of character type; they use the operation + and the parentheses: ( and ). Logical expressions (also called conditions) are formed from logical constants, logical variables, functions that give results of logical type, and the results of relations; they use the logical operations: .AND., .OR., .NOT., and the parentheses: ( and ). Examples: (in these examples, str1, str2 are string variables, num1, num2 are numeric variables, log1, log2 are logical variables): String expressions: str1 str1+str2 str1+TRIM(str2) str1+STR(num1+num2,10,2)+'Bach' Numeric expressions: num1 num1+5 (num1+5)/5 num1+(num2*VAL(str1)) LEN(str1)+LEN(TRIM(str2))+2 Conditions (logical expressions): num1 < num2 num1+num2+LEN(str1) <> 15 .AND. .NOT. EOF (str1='Boston') .AND. (num1 <> LEN(str1)).AND.log1.AND.(.NOT.log2) Expressions SRI VPI VPIN Expressions SR-Info/VP-Info Reference Manual Page 122 SECTION 3 3.6. Rules of Precedence In an expression such as 2+3*4 SR-Info/VP-Info has to decide whether to perform the + first (result: 20) or the * first (result: 23). The Rules of Precedence decide such questions. Functions have the highest precedence. Arithmetic operations have the second highest precedence; among themselves: *, / then +, - Relations are next; among themselves they all have the same precedence. Logical operations come last; among themselves: .NOT. then .AND., .OR. When two or more of the above have the same precedence, they are performed from left to right. The parentheses: ( and ) have higher precedence than functions, operations, or relations. Thus you can set the precedence explicitly using parentheses. This means that you do not have to get involved in familiarizing yourself with the Rules of Precedence. If you want + first, write (2+3)*4 If you want * first, write: 2+(3*4) Expressions SRI VPI VPIN Expressions SR-Info/VP-Info Reference Manual Page 123 SECTION 3 The parentheses tell SR-Info/VP-Info how you want the operations performed! Since SR-Info/VP-Info throws away the parentheses when the expression is compiled, you gain readability by using parentheses and loose nothing. Expressions SRI VPI VPIN Expressions SR-Info/VP-Info Reference Manual Page 124 SECTION 4 SECTION 4. SR-Info/VP-Info COMMANDS All SR-Info and VP-Info Professional commands are defined in this section. Wherever differences exist between the two versions, they are noted. All comments applicable to SR-Info also apply to VP-Info Professional. First, the form of the commands and the symbols used in defining them are discussed. The sample files used are described in the Appendix. Then all the commands are listed alphabetically. 4.1. The Form of the Commands A SR-Info/VP-Info command consists of a command verb, such as LIST, REPLACE; this is mostly followed by clauses that describe in more detail what is to be done; for instance, in LIST NEXT 10 the clause: "NEXT 10" restricts the LIST to the next 10 records beginning with the current record. In REPLACE amount WITH price*qty  the clause "amount WITH price*qty" means that the field AMOUNT is to be replaced with the expression "price*qty". The command LIST NEXT 10 FOR amount<1000 has two clauses. The command verb is always the first one or two words; in the command listing, the command verb is shown as the heading. For instance, APPEND FROM is a command verb; so is COPY (and also COPY STRUCTURE). In the command: name='DAVID' Form of the Commands Form of the Commands SR-Info/VP-Info Reference Manual Page 125 SECTION 4 = is the command verb; this is the only exception to the rule that the first word of a command line is always the command verb. The clauses are put together from SR-Info/VP-Info keywords, such as WITH, FOR, NEXT, and from variables. As a rule, in this manual, keywords will be shown in capital letters; however, the user can type them with upper- or lower-case letters. All SR-Info/VP-Info keywords are listed in Appendix ???. The power of SR-Info/VP-Info derives from the fact that each command can be made more selective with these clauses. Two of the most powerful clauses are scope (such as NEXT and WHILE ) and selection (FOR ). 4.2. Symbols In Section 4.3, all commands will be described in detail. The following symbols are used to describe the form of a command: [ ] clauses in square brackets are optional. Do not type the brackets! (The only exception is the DIM command and matrix names that use [ and ].) Example: APPEND [OFF] APPEND is a command and so is APPEND OFF. There may be many optional clauses in a command. / clauses connected with / indicate an option or a switch; you can choose the clause before or after the /, but not both (the switch can also be optional). Examples: SET EXACT ON/OFF SET EXACT ON and SET EXACT OFF are valid commands. APPEND FROM [FOR ] [SDF/SDF DELIMITED] SDF and SDF DELIMITED are optional clauses; you can choose neither, or either one, but not both. < > Pointed brackets indicate that the user has to type in some information, for instance, indicates that a file Symbols Symbols SR-Info/VP-Info Reference Manual Page 126 SECTION 4 name has to be typed in. Never type the pointed brackets. Here are the most common information requests: condition (logical expression), see . Examples: name='David' !(name)='DAVID' num3 < (num1+5) * 2.71 constant (see Section 3.1). Examples: Numeric constant: 3.5 String constant: 'bread' Logical constant: T or F. If the constant has to be one of these specified types, instead of , you find , , . expression (see Section 3.5). Examples: Numeric expression: num1+3 (NUM1 is a numeric variable) String expression: name+$(fname,1,5) (NAME and FNAME are string variables, $( is a string function) Logical expression (or condition): (2 < num1) .OR. male (NUM1 is a numeric variable, MALE is a logical variable) If the expression has to be one of these specified types, instead of , you find , , . (Note that a logical expression is the same as a condition, see Section 3.5.) expression list; separate the expressions by commas. An expression is an expression list with one item on the list, so an will do wherever is requested. Examples: name name,fname,tel:no,price*qty Symbols Symbols SR-Info/VP-Info Reference Manual Page 127 SECTION 4 field name. field list; a list of fields separated by commas. A field is a field list with one item on the list, so a will do wherever is requested. Examples: name name,fname,tel_no file name. Examples: trans,data3 See Section 2 on SR-Info/VP-Info files. The general rule is that the extension, if not typed, is supplied by SR-Info/VP-Info. For instance, if asks for the name of a data file, type TRANS, and SR-Info/VP-Info supplies ".DBF". file list; separate the files by commas. Examples: trans trans,cust3,telno file number, a number between 1 and 10 for VP-Info Professional, between 1 and 6 for SR-Info). See the SELECT command on how a file number is selected. format string. See the @ command for the definition of format strings. Examples: '99,999.99' 'XXA!XXA' line number and column number; both line and col are numeric expressions. Examples: 15,23 mrow+1,mcol+10 Symbols Symbols SR-Info/VP-Info Reference Manual Page 128 SECTION 4 memory variable; see Section 2.3. a list of memory variables separated by commas. Example: name,fname,salary,tel:no numeric constant Example: 5 numeric expression, see . Examples: (num1+5)/5 VAL('3.14')+INT(field2) procedure name. See the PROCEDURE and PERFORM commands. program name. Example: invoice a number of SR-Info/VP-Info commands. Example: price=23 amount=price * qty @ 20,2 SAY amount the scope of the command. There are four scopes: ALL execute for all records NEXT n execute for the next n records RECORD n execute only for this record WHILE execute while holds; should be used only if holds for the current record; this scope is very useful for large data files The scope is always optional; however, if none is specified, the command will use the default scope. For each command that can have a scope, the default scope is given. Symbols Symbols SR-Info/VP-Info Reference Manual Page 129 SECTION 4 any type of string; a line of text. Examples: This is a string 12.89! '' A string in quotation marks (' or ", but matching) Examples: 'This is a string' "This is a string" '1234' "Alice's Restaurant" string expression, see . Example: 'Number: ' string expression, see . Examples: 'Number: '+'34.89' TRIM(str1)+$(field3,3,2) any number of lines of text. Example: This is a sample text for the TEXT command. Notice that you do not have to press at the end of the line, the words jump to the next line where necessary. You press only at the end of a paragraph. This is a new paragraph. variable name; see Section 2.3 for variables (same as or ). Examples: name num1 Symbols Symbols SR-Info/VP-Info Reference Manual Page 130 SECTION 4 4.3. Command List This section gives a complete listing of all the commands. For more examples of the use of these commands, the reader is referred to the original VP-Info Manual published by Paperback Software International and distributed by Sub Rosa Publishing Inc. (Note that the original VP-Info Manual describes the language as it was released in 1986; all commands and functions of that release are still supported, although many are substantially enhanced. The descriptive material is generally accurate and applies equally to all versions of SR-Info/VP-Info except that networking is supported only by VP-Info Professional Network Edition.) As explained in Section 2.2, all commands that refer to data files can be modified with a #n; for instance, LIST#3 NEXT 4 FOR cost < 500 modifies the LIST command to use file 3. To avoid cluttering up the description of the commands, this [#n] option is not given. Normally, the explanation of the command is in five parts. First, the command verb is displayed. Second, a brief explanation of the command is given. The third part is the syntax, that is, the form of the command, with an explanation of what each symbol stands for. This part is framed for easy recognition. The next part is a detailed explanation of how the command works. This is followed, as a rule, by examples. The HELP command brings to the screen the first three parts and some examples when you use the standard help file; when you use the long help file, the entire text given here is displayed on the screen. In the examples, the data files of Appendix ??? will be used without any reference. Command List Command List SR-Info/VP-Info Reference Manual Page 131 SECTION 4 * Place comments -- notes -- in programs. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � * [] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � any text line: the comment � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command * (or NOTE) is used for placing comments in a program. SR-Info/VP-Info ignores any line that starts with * (or NOTE). Since the compilation removes all the comment lines, the number of comments has no effect on the speed of the compiled program. Notes can also be added with semicolon(;) at the end of any SR-Info/VP-Info command line. Example: In a program: ******************************************************************** * This is the start of the payroll computation module * Programmer: David Simco * Date: 2/8/90 ******************************************************************** USE employee INDEX employee ;opening EMPLOYEE ordered by name * SRI VPI VPIN * SR-Info/VP-Info Reference Manual Page 132 SECTION 4 = Assign value to a memory variable, or to a field when a record is referenced as a vector of fields. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � = � � []= � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 Assigning values to memory variables. The first form of this command assigns a value to a memory variable; if the variable does not exist, it will be created. This command is equivalent to the STORE command (see STORE). Treating a data file as a vector. The second form assigns a value to a field of a data file. In this form, [ and ] do not indicate an option, [ and ] have to be typed in. For instance, EMPLOYEE[3] is the third field, ADDR, of the EMPLOYEE data file. This is the only way to assign a value to a field with the = command. Normally, field values are assigned with the REPLACE command. Special care must be taken when using this second form when the data file is opened with a macros (see USE). Opening a file with a macro allows a standard program to work with a wide variety of files, provided the compiler is told the data file structure. Suppose a data file is opened with the following commands: USE inven COMPILE ACCEPT 'Enter name of data file to use: ' to fil_nam USE &fil_nam In this case, the compiled program assumes INVEN.DBF is in use, even though some other file with the same structure is actually opened. Therefore, if fil_nam='INVEN88', the proper way to reference the 3rd field of the open data file is inven[3], not inven88[3]. Examples: 1>cost=23.89 1>qty=45 1>? cost*qty 1075.05 1>employee[1]='Steiner' 1>n=6 1>order[n+1]='Short-sleeve golf shirts' = SRI VPI VPIN = SR-Info/VP-Info Reference Manual Page 133 SECTION 4 Comment: = is the only SR-Info/VP-Info command verb that does not appear at the start of the command line. All of the following are identical in effect: 1>employee[1]='Steiner' 1>REPLACE employee[1] WITH 'Steiner' 1>REPLACE name WITH 'Steiner' = SRI VPI VPIN = SR-Info/VP-Info Reference Manual Page 134 SECTION 4 ? � Display expression or expression list. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � ? [] � � ?? [] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � the expression or expressions to be displayed � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The ? command evaluates the expression or expressions in the list (remember the commas to separate the expressions in the list!) and displays the results on a new line. In particular, this command is often used to display the contents of memory variables and fields. The displayed items are separated by blanks if SET RAW OFF (see the SET command; on is the default). When SET RAW ON, they appear side by side. ? with no expression displays a blank line; it is used for spacing on the screen and printer. While the ? command moves the cursor to the beginning of the next line before the items are displayed, the ?? command displays the items at the current cursor position. The ?? command is used in programs to build lines of text on the screen or on the printer from several pieces. For displaying matrices, see Section 2.5. Examples: 1. Displaying fields: 1>USE employee 1>GO 5 1>? fname Poyner 1>? fname,tel:no Poyner 403-1193 2. Using the ? command as a calculator: 1>b=7 1>? 25/5+b,b*2,b*b 12.00 14.00 49.00 ?/?? SRI VPI VPIN ?/?? SR-Info/VP-Info Reference Manual Page 135 SECTION 4 3. A composite print line in a program segment (CUSTN and DEBIT are fields in the selected file): amount=0 mcust=custn ? 'The amount of the invoice is: ' DO WHILE custn=mcust.AND..NOT.EOF amount=amount+debit SKIP ENDDO ?? amount Note how the third and eighth command lines make one print line. ?/?? SRI VPI VPIN ?/?? SR-Info/VP-Info Reference Manual Page 136 SECTION 4 @ Display data and data input request at specific line and column position on screen or printer, or erase the screen line starting at the specified coordinates. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � @ [SAY [USING ]] [GET [PICTURE � � ]] � � � � line the line number for the display, a numeric expression; � � the fractional part (if any) will be discarded � � col the column number for the display, numeric expression; � � the fractional part (if any) will be discarded � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � none erase the screen line starting at the specified � � row and column position; when printing, move print head � � to specified position � � � � SAY [USING ] � � � � SAY displays the expression, ; if there is a USING � � clause, is displayed using the format � � specification � � � � GET [PICTURE ] � � GET asks for an input into the variable ; the present � � contents of the is displayed; if there is a � � PICTURE clause, is displayed using . � � The input request is activated by the READ command � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The @ command is used in SR-Info/VP-Info programs, first, to display formatted data at specific locations on the screen or printer, and second, to prompt the user to type in data (in conjunction with the READ command). If the SET FORMAT option is TO PRINT (see the SET FORMAT command), then the (formatted) data is sent to the printer and there can be no GET clause; otherwise the SET FORMAT TO SCREEN is in effect, and the data is sent to, and can be obtained from, the screen. The keywords of the @ command: SAY, USING, GET, PICTURE cannot be in macros. This command is a crucial element in making input screens and reports in SR-Info/VP-Info, but also consider the TEXT command, with many features of the @ command, and is usually used in preference to @ for full-screen input and output, and printed output. @ SRI VPI VPIN @ SR-Info/VP-Info Reference Manual Page 137 SECTION 4 For the IBM screen, the line numbers (see the ROW() function) go from 0 to 24, column numbers (see the COL() function) from 0 to 79. For the printer, the line number counter begins at 0 (line 1); it is reset to 0 by the EJECT command (see the commands: EJECT, SET EJECT, SET LENGTH TO). If there are several @ commands for the printer, each @ command must display past the display of the previous @ command (that is, if the first @ command displays at line1, col1, and the next at line2, col2, then either line1 is used, the variable, must exist; it is not created by this command. The present value of is shown on the screen; the new value typed in by the user becomes the contents of ; if is a field, the field in the selected file is changed (a REPLACE is performed). If no option is used in screen output, for instance @ 10,0, the line is cleared on the screen starting at the indicated column. On the printer, the print head is moved to the new position. If there is no clause, the variable is displayed as follows: fields are displayed with the width specified in the data file structure; string memory variables are displayed as stored; numeric variables are displayed as specified by the :PICTURE system variable (see Section 2.6). The GET clauses are activated by the READ command. There can be no more than 64 GET clauses for a READ command. The GET clauses with their pictures are stored in a Get Table, which remains in effect after a READ until another GET clause is encountered or a CLEAR GETS command is encountered. It may also be cleared when leaving the current program module, depending on the setting of the SET GET command (see the commands: READ, SET GET, CLEAR GETS, and ON FIELD). Format clause. A format clause is a string composed of format characters and background characters. The format characters format the output, serve as holding places for characters in output, and mask the input; the background characters are placed in the output to make it prettier and in the input to make the input easier. For instance, if the variable DATE is a string of blanks, the command @ 5,1 SAY 'Type date (mm/dd/yy) ' GET date PICTURE '99/99/99' will display in line 5, column 1: Type date (mm/dd/yy) / / @ SRI VPI VPIN @ SR-Info/VP-Info Reference Manual Page 138 SECTION 4 In this example, 9 is a format character; it accepts only digits (0 to 9). The slash (/) is a background character; it is displayed to help the input; the cursor jumps over the displayed / when the input is typed. The format characters do not become part of the resulting input. Formatting numbers. Formatting numbers is very easy. Specify the number of decimals, the placement of commas, and perhaps a floating dollar sign. Here are some examples: Number Format Display Comment 1123.89 '9,999.99' 1,123.89 1000.89 '99999' 1000 the decimals were dropped 100.89 '$9,999.99' $ 100.89 the comma does not appear; note the two blanks after the $ 100.89 '$,$$$.99' $100.89 the $ floats to the number up to the last $ in the format 100.89 '99' ** stars means number is too large to display 100.89 '999.999' 100.890 This is how the format works both with the SAY and the GET clause in displaying numbers; extreme care, however, must be exercised in using format with GET when inputting values to a numeric field, since the field and the picture must have the same number of digits before the decimal point. The GET clause displays the number in the variable or field; after the READ command, SR-Info/VP-Info waits for input. The input is typed in on top of the displayed number, ignoring where the number is, the dollar sign, commas, and the decimal point. Only digits, the minus sign, and the decimal point are accepted. Once the input is complete (by filling the field or by pressing ), the new number is reformatted by the format clause, and redisplayed. Remember that in SR-Info/VP-Info, all numbers in a field have a specified width and number of decimals; these are recorded in the data file. It is important to understand that a GET command does not change the width or the number of decimals for a field. The field and the picture must have the same number of digits before the decimal point. @ SRI VPI VPIN @ SR-Info/VP-Info Reference Manual Page 139 SECTION 4 The number zero is displayed as a zero (in the specified format) or as blanks depending on whether SET ZERO is ON or OFF (the default is ON). To sum up: for numbers, only 9, $, the comma (,), and the period (.) are the format characters. Any other character is a background character, except the two characters that format negative numbers, see below. Numbers are displayed as specified by the :PICTURE system variable (see Section 2.6); this can be changed by the . Formatting negative numbers. In some applications, the negative number -241.56 should appear as 241.56- or as <241.56>. To achieve that, simply add - or > to the end of the picture format string: Number Format Display -241.56 9999.99 -241.56 -241.56 9999.99- 241.56- -241.56 9999.99> <241.56> 241.56 9999.99- 241.56 241.56 9999.99> 241.56 Formatting strings. For displaying strings, use four format characters: 9, X (or x), A (or a), and !. Every other character is a background character. The format characters are just place holders for display purposes; each one will be replaced by a character of the string to be displayed: String Format Display Comment 'abcd' 'xXxx' abcd x and X are the same 'abcd' '!Xxx' Abcd ! forces character to caps 'abcd' '9X9!' abcD 9 also displays letters 'abcd' 'xx' ab displays as much as it can 'abcd' 'xxxxx' abcd if the format has too many place-holding characters, the string is padded with blanks on the right Background characters can be mixed with the format characters: String Format Display Comment @ SRI VPI VPIN @ SR-Info/VP-Info Reference Manual Page 140 SECTION 4 'abcd' 'X-X-X-X' a-b-c-d - is a background character 'abcd' '(xx)-x/x' (ab)-c/d - and / are background characters '2048856543' '(xxx) xxx-xxxx' (204) 885-6543 (, ), and - are background characters String: 'DavidBrand' Format: "1st: xxxxx, L'st: xxxxx" Display: 1st: David, L'st: Brand Comment: This is an artificial example to show the pitfalls in using background characters. In the format "1st name" will not work instead of "1st", because a is not a background character; that is also why "L'st" replaced "Last". Finally, note the use of " as the format delimiter, so ' can be used in "L'st". In GET format clauses, 9, X, A, and ! are also place holders to display the present contents of the variable. However, when SR-Info/VP-Info receives the input after the READ command, 9, X, A, and ! become place holders that take only certain characters: 9 takes only digits (0 to 9), - (minus), blank, and . (period) A takes only letters (a to z and A to Z) X takes any character ! takes any character but converts lower-case letters (a to z) to upper case letters (A to Z) For instance, if the memory variable tel_no contains 10 blanks, then @ 10,10 GET tel_no PICTURE '(999) 999-9999' will display ( ) - , the cursor is after (, and only digits (and -, blank, .) are accepted for input. The @ GET command does not change the length of a string variable . If the variable is a field, the width is defined when the file was created; for a memory variable, the width is determined by the current value. Note that the format clause is also used by the PIC( function. Examples: 1. Erase line 15 on the screen; or with SET PRINT ON, print a blank line 15. @ SRI VPI VPIN @ SR-Info/VP-Info Reference Manual Page 141 SECTION 4 1>@ 15,0 This is the same as 1>ERASE 15,15 2. Display (print) on line 15, column 10: 1>@ 15,10 SAY name David Simco 3. Display on line 20: 1>number=523.89 1>@ 20,12 SAY number USING '999' 523 4. Display on line 10, column 5: 1>number=7756.90 1>@ 10,5 SAY number USING '9,999.99' 7,756.90 5. Display on line 20: 1>@ 20,0 SAY number USING '$$$,$$$.99' $7,756.90 6. Display on line 15: 1>@ 15,0 SAY name USING '!!!!!!!!!!' DAVID SIMC 7. Display on line 2: 1>@ 2,0 SAY name USING '!!!!!!!!!!!!!!!' DAVID SIMCO 8. Display on line 5: 1>@ 5,0 SAY name USING 'xxxxx-----xxxxx' David----- Simc @ SRI VPI VPIN @ SR-Info/VP-Info Reference Manual Page 142 SECTION 4 9. Display on line 10: 1>telno='2025554321' 1>@ 10,5 SAY telno USING '(xxx) xxx-xxxx' (202) 555-4321 10. Display "Hello" on the second line from the current line: 1>@ ROW()+2,0 SAY 'Hello' 11. Using GET and a number (possible only in a program): a. Issue the GET command: number=4452.78 @ 10,10 GET number PICTURE '99999.99' This displays in line 10: 4452.78 b. Now give a READ command: READ The cursor is now on the first character of the number. c. Type 7805.44, you see: 7805.448 (notice the final 8, which remained from the original value of NUMBER, is not part of the new value; as soon as a digit is typed in a numeric editing field, all digits to its right are marked to be cleared) the cursor is on the last character; press . This gives the display: 7,805.44 Note that background characters may not be used in a picture for a numeric GET. No error will be shown, but the resulting values may be not what you intend. @ SRI VPI VPIN @ SR-Info/VP-Info Reference Manual Page 143 SECTION 4 ACCEPT Input request for strings. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � ACCEPT [''] TO � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � '' the prompt message � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command is used in SR-Info/VP-Info programs to request character information to be placed into a memory variable. The text in will be displayed as a prompt message. Note that has to be delimited by ' or by ", and may not be either a macro or a string expression. ACCEPT cannot be used to input data into a field or element of a matrix. If the does not exist, it will be created. The optional character string is used as a prompt. A character expression cannot be used, but a macro is permitted, provided the macro expression includes quotation marks. To input numeric or logical data, use the INPUT command. Example: In a program: ACCEPT 'Your name: ' TO name Your name: David Simco The following illustrates use of a variable instead of a string as the prompt: 1>prompt='"This is a prompt: "' 1>ACCEPT &prompt TO hello This is a prompt: George 1>LIST MEMORY Name Type Width Contents PROMPT C 20 "This is a prompt: " HELLO C 6 George ** Total ** 2 variables... 26 bytes ACCEPT SRI VPI VPIN ACCEPT SR-Info/VP-Info Reference Manual Page 144 SECTION 4 APPEND Append record to data file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � APPEND [FIELDS / TEXT ] / OFF ] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � FIELDS the fields to be edited during APPEND � � TEXT erases the screen, displays the text � � file, and then does APPEND OFF � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option in VP-Info Professional only: � � � � OFF rather than generate an APPEND input screen, � � uses an exiting screen and its Get Table � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The APPEND command without either the OFF or TEXT option allows the user to add records to the selected file. Once the command is given, the screen shows the new record in full-screen editing mode. For instance, if the selected file has 201 records, the screen will show record 202 with all fields filled with blanks; once record 202 is filled in, a blank record 203 is shown. To exit from APPEND, use (or Ctrl-W) once you have filled in the fields of the last record desired. If all the fields of the last record are blank, it will not be appended. To switch from APPEND to EDIT mode, press . Note that APPEND is actually a special mode of EDIT; the only difference is that EDIT begins by displaying the current record, while APPEND adds a new blank record to the data file and displays that. All the editing fields are the same as in EDIT. See the EDIT command for the complete list of editing keys. APPEND updates all index files in use. Example: 1>USE employee 1>APPEND SR-Info/VP-Info goes into screen editing mode and displays record 7 with all fields blank (the box showing editing keys is displayed when SET MENU is ON): APPEND SRI VPI VPIN APPEND SR-Info/VP-Info Reference Manual Page 145 SECTION 4 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 #1 EMPLOYEE.DBF APPEND Record 7 Page 1 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� �REC: prev next delete ^U PAGE: prev ^K next ^L � �FILE: top ^ bottom ^ DELETE: char to end of field ^Y � �APPEND MODE: begin ^ exit EXIT: with save no save ^Q � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� NAME........... FNAME.......... ADDR........... CITY........... STATE.......... ZIP............ TEL_NO......... MARRIED........ SALARY......... YEAR_EMP....... DEPT........... ADD_1.......... 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 SR-Info/VP-Info offers two options that allow users to format their APPEND and EDIT screens to their specific requirements. APPEND OFF suppresses the standard APPEND/EDIT screen and uses an existing screen and its associated Get Table to accept the input. It is available only in a program. Example in a program: 1>USE employee 1>CLS 1>TEXT add_empl 1>APPEND OFF APPEND TEXT can be used in both conversational mode and programs. The following combines all the steps in the above example: Example: 1>USE employee 1>APPEND TEXT add_empl The input screen can be constructed with either @ GET or TEXT command. See @ and TEXT commands. APPEND SRI VPI VPIN APPEND SR-Info/VP-Info Reference Manual Page 146 SECTION 4 APPEND BLANK Append a blank record to data file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � APPEND BLANK � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � BLANK append blank record, no full-screen editing � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 APPEND BLANK adds a blank record to the selected file, and sets the current record number to this record. The new record is not shown. The fields of such a record are usually filled by the user with the REPLACE, @ GET, or EDIT commands (or variants of these, see the commands READ, =, TEXT, BROWSE). APPEND BLANK updates all index files in use. APPEND BLANK SRI VPI VPIN APPEND BLANK SR-Info/VP-Info Reference Manual Page 147 SECTION 4 APPEND FROM Append data to the selected file from another file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � APPEND FROM [FOR ] [SDF/SDF DELIMITED [WITH ]] � � � � the name of the source file � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � FOR select by condition (not with sequential source � � files) � � SDF sequential source file � � SDF DELIMITED sequential source file with delimited fields � � SDF DELIMITED WITH sequential source file with fields � � delimited with a specific character � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command appends records from the source file to the selected file. Fields are copied from the source file to the selected file into fields with the same name. Deleted records are not appended. If a field in the source file has no matching field in the selected file, then the field is ignored. If a field in the selected file has no matching field in the source file, then the field is set to blank. For character fields, if the field width gets smaller, then the field is truncated on the right; if the field width gets larger, then the field is padded with blanks on the right. For number fields, if a number will not fit in the new field, digits are lost on the left side of the number. Be careful when moving numbers with different field widths. If the source field has more decimals than the target field, decimals on the right will be dropped. If the target field has too few positions to the left of the decimal point, the value will be lost and the field filled with a zero followed by asterisks. The FOR clause is used to append a subset of the file specified. The condition is made up of memory variables and the fields of the source file; permitted only when the source is a data file. If the structure of two data files is identical in all respects, the records are appended very quickly; otherwise the APPEND is done one field at a time. If a field name occurs only in the source file, its values will not be copied into the target data file. (To change the name of a field, use the RENAME FIELD command.) APPEND FROM SRI VPI VPIN APPEND FROM SR-Info/VP-Info Reference Manual Page 148 SECTION 4 APPEND FROM updates all index files in use. With any of the SDF options, SR-Info/VP-Info reads the sequential file, and each line is turned into a new record of the data file appended to the end. Each line must end with a carriage return (character 13) or a carriage return-line feed pair (characters 13 and 10). The characters of the line are placed in the new record one after another from the left, see examples. See also the related command: COPY TO ... SDF. APPEND FROM ... SDF assumes that fields are not trimmed or delimited. With the SDF DELIMITED option, the line of the sequential file is regarded as a number of trimmed fields, separated by commas. Strings can, in addition, be delimited by quotation marks. These fields are placed in the fields of the data file from the left. The remaining fields of the data file (if any) are left blank; the remainder of the line (after all the fields are filled), if any, is ignored. With the SDF DELIMITED WITH option, the line of the sequential file is regarded as a number of fields, separated by commas. Strings are trimmed, and the specified character is used to surround strings and logical constants. Otherwise, this option is identical to SDF DELIMITED. The functions to read and write sequential files give much better control over sequential files. See Section 3. Important programming note: The APPEND FROM command automatically opens the FROM file in its internal work area; if the FROM file is already open in another work area, the compiler will assume it is closed when the APPEND FROM command is passed during execution, even if that command is in an IF, CASE or other structure module that is not executed! Therefore, if there is any reference to the FROM file later in the program, open the file in the proper work area again immediately after the APPEND FROM command. If it is not actually needed after the APPEND FROM is executed (e.g., the program exits after the APPEND FROM), open it with the COMPILE keyword. Example: USE#4 invoices COMPILE Examples: 1. Appending from a file with the same structure: 1>USE employee APPEND FROM SRI VPI VPIN APPEND FROM SR-Info/VP-Info Reference Manual Page 149 SECTION 4 1>COPY STRUCTURE TO empl1 1>USE empl1 1>APPEND FROM employee FOR name < 'Q' 3 APPEND(S) 1>LIST name 1 Marek 2 Balzer 3 Poyner 1>ZAP 1>APPEND FROM employee FOR tel_no < '5' 1 APPEND(S) 2. Appending from a file with a different structure. Append from EMPLOYEE.DBF. The selected file is: Datafile name : EMPL2.DBF Number of records: 0 Database selected is #1 Field Name Type Width Dec 1 NAME C 15 2 NAME1 C 10 3 ADDR C 5 4 CITY C 25 5 STATE C 2 6 ZIP C 5 7 TEL_NO C 8 8 MARRIED L 1 9 SALARY N 2 0 10 YEAR_EMP N 6 2 11 DEPT C 15 ** Record Length ** 95 EMPL2 has a field NAME1 that does not occur in EMPLOYEE; the field FNAME in EMPLOYEE does not occur in EMPL2. The ADDR field in EMPLOYEE has width 20, in EMPL2 it has width 5. The CITY field in EMPLOYEE has width 20, in EMPL2 it has width 25. The SALARY field in EMPLOYEE has width 9, in EMPL2 it has width 2. The YEAR_EMP field in EMPLOYEE has width 4, in EMPL2 it has width 6; but only 3 characters are available for the number to the left of the decimal point. 1>USE empl2 1>APPEND FROM employee 6 APPEND(S) 1>EDIT 1 APPEND FROM SRI VPI VPIN APPEND FROM SR-Info/VP-Info Reference Manual Page 150 SECTION 4 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 #1 EMPL2.DBF EDIT Record 1 Page 1 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� �REC: prev next delete ^U PAGE: prev ^K next ^L � �FILE: top ^ bottom ^ DELETE: char to end of field ^Y � �APPEND MODE: begin ^ exit EXIT: with save no save ^Q � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� NAME........... Marek NAME1.......... ADDR........... 231 R CITY........... Broomsdale STATE.......... MD ZIP............ 02110 TEL_NO......... 566-7012 MARRIED........ y SALARY......... 0* YEAR_EMP....... 0***** DEPT........... Maintenance 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 Note that ADDR was cut down to 5 characters; CITY was padded by 5 blanks; SALARY and YEAR_EMP indicate that there was not enough room for the numbers. 3. Appending with the SDF option. Use the EMPLOYEE file, and append from a sequential file: DATA.TXT. Give the commands: 1>USE employee 1>APPEND FROM DATA SDF Let the first line of DATA.TXT be: Smith Robert 412 River Street then the first three fields will be correctly placed. Note that the APPEND with SDF does not check for data correctness (numbers into numeric fields), for field width, etc. This option can be used if some other program already formatted the sequential file in absolute conformity with the structure of the data file. 4. APPEND with the SDF DELIMITED option is easier to use. Continuing the previous example, Smith,Robert,412 River Street APPEND FROM SRI VPI VPIN APPEND FROM SR-Info/VP-Info Reference Manual Page 151 SECTION 4 or 'Smith','Robert','412 River Street' would do. It is important to have the fields delimited with quotation marks if any field contains a comma. Fields for which no data is supplied should be represented by commas as "place holders." For instance, ,,'412 River Street' 5. APPEND with the SDF DELIMITED WITH option works the same way. Continuing the previous example, the command APPEND FROM source SDF DELIMITED WITH | working on the following line |Smith|,|Robert|,|412 River Street| would append the record correctly. The use of a specified character other than single quote reduces or eliminates the concern about having commas, apostrophes and quotation marks in field contents. Fields for which no data is supplied should be represented by the specified character as "place holders." For instance, ||,||,412 River Street| APPEND FROM SRI VPI VPIN APPEND FROM SR-Info/VP-Info Reference Manual Page 152 SECTION 4 APPEND TO Append current record to another file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � APPEND TO � � � � append record to file in select area � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command appends the current record from the selected file to the file numbered . The same rules apply as in the APPEND FROM command. You can also append to the same file by giving its file number. Examples: 1. Interactive use. There is a Backorder File; you are looking through it with EDIT or BROWSE to find which orders should be filled. Store "^Q;APPEND TO 4;BROWSE;^X;" into a function key, and whenever an order to ship is found, you press the function key. File 4 is the file of orders to be shipped. 2. There is a Name-and-Address file, and a label printing program that prints a whole file, the Label file. The Name-and-Address file is searched by the above method, and APPEND TO is used to put the addresses to be printed in the Label file. 3. A program segment. File 2 is a backorder file; each record contains 25 fields including Q1 to Q8, the quantities for the eight sizes. This program segment asks how much of each size should be shipped; the end result is that the items to be shipped are appended to the end of File 2, while the original record is changed to reflect the shipped quantities. SELECT 2 STORE # TO gback APPEND TO 5 @ y,35 GET q1 @ y,39 GET q2 @ y,43 GET q3 @ y,47 GET q4 @ y,51 GET q5 @ y,55 GET q6 @ y,59 GET q7 @ y,63 GET q8 READ REPLACE quant WITH q1+q2+q3+q4+q5+q6+q7+q8 APPEND TO SRI VPI VPIN APPEND TO SR-Info/VP-Info Reference Manual Page 153 SECTION 4 SELECT 5 REPLACE q1 WITH q1-q1#2,q2 WITH q2-q2#2,q3 WITH q3-q3#2 REPLACE q4 WITH q4-q4#2,q5 WITH q5-q5#2,q6 WITH q6-q6#2 REPLACE q7 WITH q7-q7#2,q8 WITH q8-q8#2 REPLACE quant WITH q1+q2+q3+q4+q5+q6+q7+q8 REPLACE type WITH 'O' APPEND TO 2 SELECT 2 GOTO gback APPEND TO SRI VPI VPIN APPEND TO SR-Info/VP-Info Reference Manual Page 154 SECTION 4 AVERAGE Average numeric expressions for selected records. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � AVERAGE [TO ] [] [FOR ] � � � � the numeric expressions to average � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � store the results in these memory variables � � select by scope (default scope: ALL) � � FOR select by condition � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command AVERAGE adds up numeric expressions for selected records of the selected data file and divides the result with the number of records summed. Up to 10 expressions can be averaged with one command. Optionally, the results can be stored in numeric memory variables; the expression list and the numeric memory variable list should have the same number of entries. cannot contain numeric matrix variables. Records flagged as DELETED are not averaged. Memory variables in need not exist; if any variable in the does not exist, this command creates it. Example: The average earning of the employees (in the data file EMPLOYEE), and the average year employment began: 1>USE employee 1>AVERAGE salary, year_emp 6 AVERAGE(S) 32502.16 1980.50 AVERAGE SRI VPI VPIN AVERAGE SR-Info/VP-Info Reference Manual Page 155 SECTION 4 BINLOAD Load a binary (assembly-language) program into memory. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � BINLOAD � � � � a binary file to be executed under � � VP-Info Professional (not available under � � SR-Info); default extension BIN � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 VP-Info Professional only: Assembly-language programs may be copied from disk into a special area of memory called BINSPACE, which must be set aside with the BINSPACE= command in your VPI.SET or VPIN.SET file. When no longer needed, the program can be removed from the BINSPACE with the BINUNLOAD command, allowing room for another binary program to take its place. A maximum of eight binary files, with default extension BIN, may be loaded into memory at one time. Once loaded into the BINSPACE, the program may be executed with the CALL command (see the CALL and BINUNLOAD commands). Examples: 1>BINLOAD test BINLOAD VPI VPIN BINLOAD SR-Info/VP-Info Reference Manual Page 156 SECTION 4 BINLOAD VPI VPIN BINLOAD SR-Info/VP-Info Reference Manual Page 157 SECTION 4 BINSPACE= Reserve space in memory to BINLOAD binary files to be run with the CALL command. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � BINSPACE= � � � � VP-Info Professional only VPI.SET file only � � � � the number of 1K blocks of RAM to be reserved � � for loading BIN files with the BINLOAD command � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 VP-Info Professional only: Assembly-language programs may be copied from disk into a special area of memory called BINSPACE, which must be set aside with the BINSPACE= command in your VPI.SET or VPIN.SET file. The number of 1K blocks, to a maximum of 32, must be specified. The BINSPACE is allocated above SR-Info/VP-Info's 64K data space and high memory, and reduces the amount of DOS memory available to execute commands with the RUN command. Once loaded into the BINSPACE with BINLOAD, the program may be executed with the CALL command (see the CALL, BINLOAD, and BINUNLOAD commands). Examples: 1>BINSPACE=16 BINSPACE= VPI VPIN BINSPACE= SR-Info/VP-Info Reference Manual Page 158 SECTION 4 BINUNLOAD Remove a binary (assembly-language) program from memory. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � BINUNLOAD � � � � a binary file to removed from memory by � � VP-Info Professional (not available under � � SR-Info); default extension BIN � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 VP-Info Professional only: Assembly-language programs, which are loaded into a special area of memory called BINSPACE by the BINLOAD command, may be removed from memory by the BINUNLOAD command when no longer needed. This allows room for another binary program to take its place. A maximum of eight binary files, with default extension BIN, may be loaded into memory at one time. Care should be taken not to create "holes in memory" by loading and unloading BIN files indiscriminately. For best performance, users are urged to load frequently called binary files first and not unload them; then transient or occasional binary programs can be loaded, called and immediately unloaded with the BINUNLOAD command. (See BINLOAD and CALL commands.) Examples: 1>BINUNLOAD test BINUNLOAD VPI VPIN BINUNLOAD SR-Info/VP-Info Reference Manual Page 159 SECTION 4 BOX Draw a box on the screen. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � BOX ,,, [DOUBLE] � � � � , the position of the upper-left corner of the box � � , the position of the lower-right corner of the box � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � DOUBLE use double line graphics, the default is single-line � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command BOX draws a box on the screen using the character graphics of the IBM monochrome screen. If line1=line2, a horizontal line is drawn. If col1=col2, a vertical line is drawn. line1, line2, col1, col2 can all be numbers or numeric expressions; any fractional part will be disregarded This command is useful for making menus pretty, and for partitioning the screen into different viewing areas. Note that commas are required between the numeric expressions used for the corner specifications, but a comma is NOT permitted before the DOUBLE keyword. The WINDOW command can also draw a box, but in addition limits relative screen output to the boundary of the window and can optionally set window and box colors. See the WINDOW command. Examples: 1>ERASE 1>BOX 2,10,12,40 1>ERASE 1>BOX 3,0,8,20 DOUBLE 1>ERASE 1>BOX 10,0,10,70 BOX SRI VPI VPIN BOX SR-Info/VP-Info Reference Manual Page 160 SECTION 4 BREAK Exit to the bottom of a DO WHILE or REPEAT loop. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � BREAK � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The BREAK command is used only in programs, in a DO WHILE or a REPEAT loop to exit at the bottom of the loop. If there are nested loops, the exit is at the bottom of the innermost loop. See DO WHILE and REPEAT. Contrast the command BREAK with the command LOOP which executes the condition at the top of the DO WHILE loop (see the LOOP command). Caution: BREAK can be used only within a DO WHILE or REPEAT loop; use anywhere else is an error with unpredictable results. Example: DO WHILE T IF custn<>mcust BREAK ENDIF ENDDO This program carries out and until CUSTN becomes different from MCUST; then it jumps over and leaves the loop. BREAK SRI VPI VPIN BREAK SR-Info/VP-Info Reference Manual Page 161 SECTION 4 BROWSE Edit fields in many records. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � BROWSE [FIELDS ]/[OFF]/[TEXT ] [APPEND] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options (all versions): � � � � FIELDS specify the fields to be displayed � � APPEND add a blank record and start BROWSE in that record � � OFF rather than generate a BROWSE input screen, uses an � � exiting screen and its Get Table � � TEXT erases the screen, displays the text file, and � � then does BROWSE OFF � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The BROWSE command displays the records (from the current record on) horizontally, one at a line; it displays as many fields as will fit on a line. A column represents a field. If the selected file is indexed, the records are displayed in the indexed order. When the APPEND keyword is used, a blank record is appended to the data file and BROWSE begins in that record. The user may alternate between normal BROWSE and APPEND modes with the Ctrl- and editing keys. All the full-screen editing keys can be used. Note that they have the same meaning as in EDIT, but sometimes they look different. For instance, the next record command ( or Ctrl-C) gives a new screen in EDIT; in BROWSE, it simply moves the cursor down one line. Editing keys: or Ctrl-S moves the cursor back one character or Ctrl-D moves the cursor forward one character Ctrl- moves to the beginning of the field Ctrl- moves to the end of the field 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 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 field BROWSE SRI VPI VPIN BROWSE SR-Info/VP-Info Reference Manual Page 162 SECTION 4 or Ctrl-E moves the cursor to the previous field or Ctrl-X moves the cursor to the next field Ctrl- Enters APPEND mode; adds a blank record and places the cursor in that new record Ctrl-Q quits and does not update the current record or Ctrl-W quits and updates the current record or Ctrl-R moves to the previous record; when in APPEND mode, exist to normal BROWSE mode or Ctrl-C moves to the next record Ctrl-L redraws the BROWSE screen with the next screenful of fields, referred to as the next "page"; if the file has no more fields, this key is ignored Ctrl-K redraws the BROWSE screen with the previous screenful of fields, referred to as the prior "page"; if the screen is already at the first field, this key is ignored Alt-E skips one screenful of record toward the beginning of the file and redisplays the BROWSE screen Alt-X skips one screenful of record toward the end of the file and redisplays the BROWSE screen BROWSE should be used to edit columns of data in a data file; that is, to edit a few fields of a number of records. Use the command EDIT to edit many fields of a single records at the same time. The option FIELDS selects the fields to be displayed on the screen. SET MENU ON causes a small display at the top of the BROWSE screen, giving the use of major editing key. Examples: 1>USE customer 1>BROWSE Displays the following: BROWSE SRI VPI VPIN BROWSE SR-Info/VP-Info Reference Manual Page 163 SECTION 4 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 #1 CUSTOMER.DBF SR-Info BROWSE Page 1 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� �REC: prev next delete ^U SCROLL: left ^K right ^L � �FILE: top ^ bottom ^ DELETE: char to end of field ^Y � �APPEND MODE: begin ^ exit EXIT: with save no save ^Q � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� CUSTNU FIRSTNAME LASTNAME ADDRESS 1 BROS50 Stan Brown 786 Alexander Rd. 2 BURS50 Sid Bursten 876 Main St. 3 GRAG50 George Gratzer 876 Arlington Avenue 4 MELB50 Bernie Melman 9876 Ocean View Parkway 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 To edit the home and work telephone numbers of the customers, issue the command: 1>USE customer 1>BROWSE FIELDS name,hphone,wphone The display: 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 #1 CUSTOMER.DBF SR-Info BROWSE Page 1 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� �REC: prev next delete ^U SCROLL: left ^K right ^L � �FILE: top ^ bottom ^ DELETE: char to end of field ^Y � �APPEND MODE: begin ^ exit EXIT: with save no save ^Q � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� LASTNAME HPHONE WPHONE 1 Brown 9238423472 3984747238 2 Bursten 7658956 6575777 3 Gratzer 7866457 7657655 4 Melman 8765678 6765777 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 SR-Info/VP-Info offers two options that allow users to format their BROWSE screens to their specific requirements. BROWSE SRI VPI VPIN BROWSE SR-Info/VP-Info Reference Manual Page 164 SECTION 4 BROWSE OFF suppresses the standard BROWSE screen and uses an existing screen and its associated Get Table to accept the input. It is available only in a program. Example in a program: 1>USE employee 1>CLS 1>TEXT add_empl 1>BROWSE OFF BROWSE TEXT can be used in both conversational mode and programs. The following combines all the steps in the above example: Example: 1>USE employee 1>BROWSE TEXT add_empl The input screen can be constructed with either @ GET and TEXT command. See @ and TEXT commands. BROWSE SRI VPI VPIN BROWSE SR-Info/VP-Info Reference Manual Page 165 SECTION 4 CALL Execute a binary (assembly-language) program 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CALL [] � � � � a binary file to be executed under � � VP-Info Professional (not available under � � SR-Info); default extension BIN � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � a character memory variable used to transfer data � � to and from a BIN program; maximum 254 characters � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 VP-Info Professional only: Assembly-language programs, which have been copied from disk into a special area of memory called BINSPACE, can be executed internally by VP-Info Professional. Running a binary file requires three steps: 1. Allocate memory in the VPI.SET or VPIN.SET file using the BINSPACE=n where is the number of 1K blocks to allocate to the BINSPACE in memory. The limit for is 32. Example: BINSPACE=32 allocates 32K. 2. BINLOAD the program. A program need only be loaded once (unless it is removed with the BINUNLOAD command). Additional requests to BINLOAD the program will reload it in the same memory space. Up to eight binary programs may be loaded at once. Example: BINLOAD test. (BIN program may be removed from memory with the BINUNLOAD command.) 3. CALL the binary program, with an optional argument of up to 254 bytes in a memory variable. The binary program may modify or replace the contents of this variable, but may not create or lengthen the contents; when execution is completed, the variable will have a new value. See BINLOAD and BINUNLOAD commands. Example: The binary program, listed below, merely overwrites the first three characters of a passed string with the string "VPI". dummy='1234567890' CALL test dummy CALL VPI VPIN CALL SR-Info/VP-Info Reference Manual Page 166 SECTION 4 ? dummy The current value of dummy would then be printed: "VPI4567890". Rules for BIN programs: 1. BIN programs are created in assembly language and assembled into an OBJ file with Microsoft's MASM program or equivalent, linked into a EXE file with LINK or equivalent, and converted into a BIN file with the DOS utility EXE2BIN. 2. The following is an example of an assembly-language module that accepts an input string in a memory-variable passed to the module on the CALL command line, modifies it, and passes it back in the same memory variable. 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� ; TESTBIN.ASM -- A sample program to illustrate the ; VP-Info BINLOAD and CALL facilities ; ; By Bernie Melman, Sub Rosa Publishing Inc. ; ; This routine replaces the first three characters ; in a passed string with the characters VPI ; ; Assemble with MASM version 5.0 ; LINK to produce an EXE file (ignore the "No stack" warning) ; EXE2BIN to generate BIN file ; _prog segment byte assume cs:_prog dtest proc far mov [bx+0], byte ptr 'V' mov [bx+1], byte ptr 'P' mov [bx+2], byte ptr 'I' mov ax,0 ;try changing bp to see if VP-Info ; can recover regs ok mov bp,ax ;do it ret dtest endp _prog ends end 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 3. No argument is required, but if one is used, it must contain a string which the program can evaluate in location BX. VP-Info places a NUL (zero byte) after the string as a terminator; if the program processes characters until a zero is encountered in a byte, the entire string has been processed. Any part of the string following the NUL is ignored by VP-Info. CALL VPI VPIN CALL SR-Info/VP-Info Reference Manual Page 167 SECTION 4 4. The maximum length of a VP-Info string is 254 bytes; therefore, no more than 254 characters can be communicated to or from a binary program. 5. The BIN program cannot change the memory allocation of the argument variable. Therefore, it cannot successfully enlarge the argument string. It can shorten the result by terminating the result with a NUL (zero byte). 6. Sufficient space to load binary files must be provided with the BINSPACE= command in the VPI.SET or VPIN.SET file; and no more than eight binary files may be loaded at any one time. BIN files can be removed from memory with the BINUNLOAD command. CALL VPI VPIN CALL SR-Info/VP-Info Reference Manual Page 168 SECTION 4 CANCEL Leave SR-Info/VP-Info program. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CANCEL � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command CANCEL aborts the SR-Info/VP-Info program and enters the interactive mode; the SR-Info/VP-Info prompt appears. See also QUIT. Example: A SR-Info/VP-Info program segment: CASE ans='8' QUIT CASE ans='9' CANCEL If the user chooses to go into SR-Info/VP-Info (option 9), show the SR-Info/VP-Info prompt. Option 8 exits to the operating system. CANCEL SRI VPI VPIN CANCEL SR-Info/VP-Info Reference Manual Page 169 SECTION 4 CASE The switch in the DO CASE program structure. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CASE � � � � if this condition is satisfied, the following program � � segment should be executed � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 CASE is the keyword in the DO CASE program structure. SR-Info/VP-Info evaluates the condition; if the condition is true, the following program segment is executed. The program segment is terminated by the next CASE, by OTHERWISE, or by ENDCASE. After the execution of the program segment, the program execution continues with the program line after the ENDCASE command. If the condition is false, SR-Info/VP-Info looks for the next CASE command. If no condition is true, SR-Info/VP-Info executes the program segment following the OTHERWISE command (if any). Note that when more than one is true in a DO CASE structure, only the program segment for the first is executed. See the command DO CASE. CASE SRI VPI VPIN CASE SR-Info/VP-Info Reference Manual Page 170 SECTION 4 CHAIN Leave the current SR-Info/VP-Info program and start running a new SR-Info/VP-Info program. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CHAIN � � � � the name of the SR-Info/VP-Info program to be run � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command CHAIN is used for executing a SR-Info/VP-Info program from within another SR-Info/VP-Info program or in the interactive mode from the SR-Info/VP-Info prompt. The program name should not have an extension. If there is a compiled program by this name (normal extension CPL; runtime extension RPL), it will be run. If there is none, SR-Info/VP-Info will run the uncompiled program (extension PRG). CHAIN does a CLEAR first, except that all global memory variables are preserved and passed to the ; to use them, the must have a GLOBAL command declaring the variables. (See the commands CLEAR and GLOBAL.) The CHAIN command does not return to the calling program; the program in memory is replaced by the program it chains to. CHAIN is the most efficient way for one program to call another. The DO command calls a subroutine from the disk. DO can often be replaced by PERFORM or by CHAIN. (See the commands DO and PERFORM. When you chain from one program to another, SR-Info/VP-Info executes a CLEAR command before the start of the program, closing all the data files, index files, sequential files, and releasing all (but the global) variables. When you DO one program from another, the subroutine you do inherits the existing environment -- memory variables, data files, index files, etc. -- and returns to the DOing program when completed or when a RETURN command is executed. CHAIN allows the program name to be a macro. CHAIN SRI VPI VPIN CHAIN SR-Info/VP-Info Reference Manual Page 171 SECTION 4 Example: DO CASE CASE ans='1' CHAIN prog1 CASE ans='2' CHAIN prog2 CASE ans='3' CHAIN prog3 ENDCASE This program segment chains to three different programs, depending on the value of ANS. CHAIN SRI VPI VPIN CHAIN SR-Info/VP-Info Reference Manual Page 172 SECTION 4 CLEAR Close all data files and index files, and clear memory variables. Optionally clear current Get Table or keyboard buffer. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CLEAR [GETS/KEYBOARD] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � GETS clear the Get Table from memory � � KEYBOARD delete all characters from the keyboard buffer � � buffer � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The CLEAR command with no options closes all open data files and index files, and releases all memory variables, including the matrix variables. (Sequential files, DOS files, system variables, and in particular, function keys, are not effected). Example: 1>a=2 1>name='David Barberr' 1>avco='clear' 1>LIST MEMORY Name Type Width Contents A N 8 2 NAME C 13 David Barberr AVCO C 5 clear ** Total ** 3 Variables used 26 Bytes used 1>CLEAR 1>LIST MEMORY Name Type Width Contents ** Total ** 0 Variables used 0 Bytes used CLEAR GETS removes the current Get Table from memory. (See READ and ON FIELD commands.) CLEAR KEYBOARD eliminates any characters held in the keyboard buffer. Normally, characters typed at the keyboard are stored in a special buffer until SR-Info/VP-Info in ready to process them, but occasionally the programmer will want to be sure nothing is in the buffer before executing certain commands. For example, CLEAR KEYBOARD before executing the MENU() function to ensure that a key pressed earlier in the program, or even in a previous program, does not inadvertently trigger a menu selection. CLEAR SRI VPI VPIN CLEAR SR-Info/VP-Info Reference Manual Page 173 SECTION 4 Caution to dBASE programmers: The CLEAR command in dBASE III and later versions erases the screen, but its function on SR-Info/VP-Info is radically different. To clear the screen, use the CLS command. CLEAR SRI VPI VPIN CLEAR SR-Info/VP-Info Reference Manual Page 174 SECTION 4 CLOSE Close the selected file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CLOSE [ALL] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � ALL close all data files in use � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The CLOSE command closes the selected data file, updates all information to the disk, and releases the data record buffer space (see Appendix A.1) used by this file. Any index files attached to the data file are also closed, and any limits, relations and filters associated with the data file are cleared. With the option ALL, all data files in use are closed. Examples: 1>CLOSE 1>CLOSE#3 1>CLOSE ALL CLOSE SRI VPI VPIN CLOSE SR-Info/VP-Info Reference Manual Page 175 SECTION 4 CLS Erase screen. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CLS [,] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � , erase from line1 to line2 � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command erases the screen, and is a synonym for ERASE. If, optionally, two numeric expressions, line1 and line2, are given, it erases line1 and line2, and all lines between, if any. These expressions should have values between 0 and 24. CLS is the same as the following three commands: ERASE CLS 0,24 ERASE 0,24 Examples: 1>CLS 1>CLS 2,4 1>CLS 12,12 CLS SRI VPI VPIN CLS SR-Info/VP-Info Reference Manual Page 176 SECTION 4 COLOR Set the color attributes of a box on the screen. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � COLOR ,,,,[,] � � � � numeric expression between 0 and 255, the attribute � � , the position of the upper-left corner of the box � � , the position of the lower-right corner of the box � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � the ASCII number of the character used to fill the � � colored area; every character position enclosed � � in the area described by the row and column values � � is changed to the fill character � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 Every character displayed on the screen has an attribute byte that determines how the character is displayed. For monochrome monitors, the character may be bold, underlined, reverse, and so on. For color monitors, both the background and the character has color. These attribute bytes are set for a rectangular area by this command. The area is given by four numeric expressions -- line1, col1, line2, col2 -- as in the BOX and WINDOW commands. The values must be separated by commas. For color monitors, compute ATTRIB by adding up (up to) four numbers: background+foreground+blink+brightness from the following tables: background 0 - black 16 - blue 32 - green 48 - cyan 64 - red 80 - magenta 96 - brown 112 - white foreground 0 - black 1 - blue 2 - green 3 - cyan 4 - red 5 - magenta 6 - brown COLOR SRI VPI VPIN COLOR SR-Info/VP-Info Reference Manual Page 177 SECTION 4 7 - white blink 0 - no blink 128 - blink brightness 0 - normal 8 - intense For monochrome monitors the five important numbers are: standard white on black: 7 underline: 1 reverse video: 112 to get bold: add 8 to make it blink: add 128 See also SET COLOR TO and :COLOR=, which set the attribute bytes of the characters displayed. SET COLOR TO 0 turns the command off: the attribute bytes remain unchanged at the displaced locations. If a part of the screen already has attributes set by the COLOR command and SET COLOR TO 0, the newly displayed characters will keep the attributes set by the COLOR command. When filling an area with a fill character, as is often done in designing sign-on screens for example, the pattern characters 176 to 178 and the solid reverse character 219 are especially useful. Examples: 1. 1>COLOR 20,2,0,12,79 sets background blue and foreground red in lines 2 to 12. 2. 1>back=80 1>foregrnd=1 1>bright=8 1>line=2 1>col=0 1>x=18 1>y=50 1>COLOR back+foregrnd+bright,line,col,line+x,col+y 3. 1>COLOR 17,2,10,4,12 COLOR SRI VPI VPIN COLOR SR-Info/VP-Info Reference Manual Page 178 SECTION 4 underlines the text in a small box three lines deep and 3 characters wide on a monochrome monitor. 4. The following program illustrates the use of the COLOR command on a color monitor: DIM NUM matrix[10] REPEAT 10 TIMES VARYING i matrix[i]=MOD(i,7)*16+7 ENDREPEAT ERASE REPEAT 10 TIMES VARYING i COLOR matrix[i], 12-i, i*5, 12+i, 10+i*5 DELAY .5 ENDREPEAT ERASE COLOR 23, 0, 0, 24, 79 REPEAT 10 TIMES VARYING i BOX 1+i, 7+i*3, 23-i, 73-i*3 DELAY .15 ENDREPEAT REPEAT 10 TIMES VARYING i COLOR matrix[i], 1+i, 7+i*3, 23-i, 73-i*3 DELAY .5 ENDREPEAT 5. All output to an area of the screen may be made invisible by making the background and the foreground color the same. For example, SET COLOR TO 0 COLOR 0,10,0,13,79 turns rows 10 to 13 to black on black. Editing fields for entering passwords may be so protected. 6. A set of overlapping frames can be created with pattern characters used as fill: COLOR 7,10,10,16,70,176 ;a shadow pattern COLOR 7,09,09,15,69,219 ;a solid pattern COLOR 7,10,10,14,69,32 ;fill with blanks to create area for text COLOR SRI VPI VPIN COLOR SR-Info/VP-Info Reference Manual Page 179 SECTION 4 COMPILE Compile a SR-Info/VP-Info program. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � COMPILE [LINK] � � � � the name of the program file � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � LINK If SET DO OFF, causes COMPILE to work as if SET DO ON � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The COMPILE command may be given in interactive mode, or in a program: 1>COMPILE prog where PROG is a file with PRG extension, the source program to be compiled. cannot be a macro, and should not have any extension specified. If you wish to compile many programs in one step, create a program (call it, say, PROJ.PRG) as follows: COMPILE prog1 COMPILE prog2 COMPILE prog3 Then 1>DO proj will compile PROG1, PROG2, PROG3. Such a program should not use any memory variables, since a CLEAR is executed before every COMPILE command. SET ECHO ON to have all program lines displayed as they are compiled. See also Section 1. COMPILE SRI VPI VPIN COMPILE SR-Info/VP-Info Reference Manual Page 180 SECTION 4 CONTINUE Continue to LOCATE from the current record. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CONTINUE � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 CONTINUE will carry on locating from the current record using the condition of the last LOCATE command. (See the LOCATE command.) Note that the standard strings stored in function key F8 combines a CONTINUE and an EDIT command. Once a LOCATE has been executed (function key F8), each additional matching record can be edited by pressing F8. Example: 1>LOCATE FOR name<'S' 1>EDIT 1>CONTINUE CONTINUE SRI VPI VPIN CONTINUE SR-Info/VP-Info Reference Manual Page 181 SECTION 4 COPY Copy selected records of the selected file into a new file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � COPY [] TO [FIELDS [FOR ] [SDF/ � � SDF DELIMITED [WITH ]] � � � � is the name of the file the records are copied to � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � select records by scope � � (default scope: ALL) � � FIELDS copy only selected fields � � FOR select records by condition � � SDF copy into sequential file � � SDF DELIMITED separate fields by commas � � SDF DELIMITED [WITH ] separate fields by specified character � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command COPY is used for moving records from the selected file to a new file, ; if a file by the name already exists, it will be overwritten. If the SDF option is not used, the result will be a data file with the default extension DBF and the same structure as the source file, unless the FIELDS keyword is used with a fields list. When the SDF option is used, the result is a text file, with the default extension TXT. When the DELIMITED keyword is not used, each record (or its selected fields) becomes one line in a sequential file; the fields are all merged. With the SDF DELIMITED option, the fields are separated by commas, and strings are enclosed in single quotes ('). A different string delimiter can be specified with the WITH clause: example WITH |. The specified delimiter character is not enclosed in quotes. For a discussion of the SDF option, see the command APPEND FROM. Examples: COPY SRI VPI VPIN COPY SR-Info/VP-Info Reference Manual Page 182 SECTION 4 1>USE employee 1>COPY TO empl1 6 COPY(S) 1>USE empl1 1>DELETE 5 1 DELETE(S) 1>COPY TO empl3 5 COPY(S) note: deleted records are not copied 1>RECALL ALL 1>COPY TO empl4 FOR salary <25000 .AND. year_emp>1980 1 COPY(S) 1>COPY TO empl4 FOR salary <25000 SDF DELIMITED WITH | 1 COPY(S) The result of the last command is a sequential file EMPL4.TXT with one line as follows: |Marek|,|Mark|,|231R|,|Broomsdale|,|MD|,|02110|,|566-7012|,|y|, |11500|,|1984|,|Maintenance| 1>COPY TO empl5 FOR salary <25000 FIELDS name,fname SDF DELIMITED WITH | 1 COPY(S) The result of the last command is a sequential file EMPL5.TXT with one line as follows: |Marek|,|Mark| COPY SRI VPI VPIN COPY SR-Info/VP-Info Reference Manual Page 183 SECTION 4 COPY STRUCTURE Create a new file with the structure of the selected file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � COPY STRUCTURE TO [FIELDS ] � � � � the name of the new file � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � FIELDS copy only these fields � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command COPY STRUCTURE creates a new data file with the same fields as the selected file, but with no records. The default extension is DBF. If the FIELDS option is used, the new structure will contain only the fields listed. Example: 1>USE employee 1>COPY STRUCTURE TO emp1 1>COPY STRUCTURE TO emp2 FIELDS name,fname,salary,married 1>USE empl2 1>LIST STRUCTURE Data file: EMPL2.DBF Number of records: 0 File number: 1 Field Name Type Width Dec 1 NAME C 15 2 FNAME C 10 3 SALARY N 9 2 4 MARRIED L 1 ** Record Length ** 36 COPY STRUCTURE SRI VPI VPIN COPY STRUCTURE SR-Info/VP-Info Reference Manual Page 184 SECTION 4 COUNT Count selected records. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � COUNT [] [TO ] [FOR ] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � select by scope (default scope: ALL) � � TO store result in memory variable � � FOR select by condition � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command counts the number of records that meet the selection criteria. Selection is by scope and/or by condition. The result may be stored in a numeric memory variable; if the variable does not exist, this command creates it. cannot be a numeric matrix variable. The result of the command COUNT is displayed if SET TALK ON, as in the examples below. Examples: 1>USE employee 1>COUNT 6 COUNT(S) 1>GO TOP 1>COUNT NEXT 3 FOR name < 'O' 2 COUNT(S) 1>GO TOP 1>COUNT FOR salary < 50000 TO raise 1>? raise 5.00 COUNT SRI VPI VPIN COUNT SR-Info/VP-Info Reference Manual Page 185 SECTION 4 CREATE Create a new data file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CREATE � � � � the data file to create � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command CREATE is used to make a new data file, ; cannot be a macro. (Do not use COMP for the first four letters of a data or index file; SR-Info/VP-Info is unable to open such a file.) File creation is a special form of full-screen editing. Each field in the data file is represented by four editing fields. Editing keys: or Ctrl-S moves the cursor back one character or Ctrl-D moves the cursor forward one character Ctrl- moves to the beginning of the editing field Ctrl- moves to the end of the editing field 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 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 editing field or Ctrl-E moves the cursor to the previous editing field or Ctrl-X moves the cursor to the next editing field Ctrl-Q quits and does not create the file or Ctrl-W quits and creates the file Ctrl-K moves back to the top of the previous page Ctrl-L moves to the top of the next page Ctrl-N inserts a line for a new field Ctrl-T deletes the line describing a field SR-Info/VP-Info supports three separate type of data files as follows: CREATE SRI VPI VPIN CREATE SR-Info/VP-Info Reference Manual Page 186 SECTION 4 Type 1 - Compatible with VP-Info and MAX Type I files. (MAX is an earlier versions of SR-Info and VP-Info Professional, also created by Sub Rosa Inc.) Type I files can have up to 256 fields in SR-Info and up to 500 fields in VP-Info Professional. Type 2 - Compatible with dBASE II data files, and are limited to 32 fields. Type 3 - Compatible with dBASE III, dBASE III+ and dBASE IV data files. Type III files can have up to 256 fields in SR-Info and up to 500 fields in VP-Info Professional, although dBASE III and dBASE III+ cannot read a data file with more than 128 fields, and dBASE IV cannot read a data file with more than 255 fields. When all the fields are specified using the full-screen input display of the CREATE command, the user is asked to specify which type of file to create; the default is Type 3. If the data file already exists, you will be given the opportunity to delete it. On a network with SET NETWORK ON in VP-Info Professional Network Edition, attempting to delete a data file while another user is accessing a file with the same name will cause a LOCK error. Example: 1>CREATE custfile shows the following screen after all the fields have been entered: CREATE SRI VPI VPIN CREATE SR-Info/VP-Info Reference Manual Page 187 SECTION 4 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 Sunday, August 12, 1990 SR-Info CUSTFILE.DBF Name Type Width Dec Name Type Width Dec CUSTNUM C 6 0 BIRTHDAY C 6 0 FIRSTNAME C 15 0 SS_NUM C 9 0 LASTNAME C 20 0 EMPL_NUM C 6 0 ADDRESS C 25 0 CITY C 15 0 STATE C 2 0 ZIP C 9 0 HPHONE C 10 0 WPHONE C 10 0 SPOUSEFNAM C 15 0 SPOUSENAME C 20 0 DEPENDENTS N 2 0 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� � UP/DOWN COLUMN MOVE ROW SAVE STRUCTURE C..Strings � � previous. left... ^K insert... ^N update... N..Numbers � � next..... right.. ^L delete... ^T nochange. ^Q L..Yes/No � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 There are up to 12 fields described in each column, with four editing windows per field. All the standard full-screen editing keys are available in CREATE, including Ctrl-K and Ctrl-L to move from column to column. As in BROWSE, and are used to move from line to line, while and are used to move between editing windows on the same line. Error checking is done by SR-Info/VP-Info as you enter the specifications for the new fields when you leave a line. Here are some of the messages you may see: The first character of a field name must be a letter. Invalid character in the Name field. Name fields must be unique. Types: C-character N-numeric L-logical D-date F-float M-memo. Field Length must be greater than 0. Length of character field can not exceed 254. Length of numeric field can not exceed 20. Decimals cannot exceed 6. Decimals too large for length. CREATE SRI VPI VPIN CREATE SR-Info/VP-Info Reference Manual Page 188 SECTION 4 Caution for VP-Info Professional users: Be sure you have set FIELDS= in the VPI.SET or VPIN.SET file to a number large enough to accommodate all the fields in all the data files you will ever have open at one time, plus the largest number of fields in any of these files. Default is 320 fields. See FIELDS=. CREATE SRI VPI VPIN CREATE SR-Info/VP-Info Reference Manual Page 189 SECTION 4 CURSOR Move the cursor to a given screen position. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � CURSOR , � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 CURSOR moves the current cursor position to a given point on the screen. Combined with the ?? command, it gives the user all the absolute positioning control of the @ SAY command without its restrictions. CURSOR is usually employed when the MENU( function is used, to place the selection bar correctly. CURSOR SRI VPI VPIN CURSOR SR-Info/VP-Info Reference Manual Page 190 SECTION 4 DEBUG Print expression or expression list for debugging purposes. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DEBUG � � � � the expressions to be displayed � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command displays the expressions exactly as does the ? command. However, if SET DEBUG OFF, the expressions are not displayed. This may save the programmer the trouble of having to place the DEBUG commands in the program when debugging, and having to take them out for the regular running of the program. See SET DEBUG. Examples (in a program): DEBUG number DEBUG 'current amount: ', amount, ' current balance: ', balance DEBUG SRI VPI VPIN DEBUG SR-Info/VP-Info Reference Manual Page 191 SECTION 4 DELAY Suspend execution for a specified number of seconds. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DELAY � � � � the number of seconds execution is to be delayed � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command suspends program execution for a specified number of seconds. The delay can be any length from .06 seconds upward. For programmers, this command can replace complex loops which often have the deficiency of varying in length depending on what type of computer the program is run on. Example: 1>DELAY .5 1>number=3 1>DELAY number DELAY SRI VPI VPIN DELAY SR-Info/VP-Info Reference Manual Page 192 SECTION 4 DELETE Delete selected records from the selected data file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DELETE [] [FOR ] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � select by scope (default scope: current record) � � FOR select by condition � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The DELETE command is used to set the DELETED flag for records in the selected data file. These records can be recovered by the RECALL command or with Ctrl-U in the BROWSE and EDIT commands, provided SET DELETE is OFF. Deleted records are not "seen" by certain SR-Info/VP-Info commands irrespective of SET DELETE status, including: COPY, POST, UPDATE, SUM, AVERAGE, COUNT. To remove all the records with the deleted flag set, use the PACK command. (See the commands: SET DELETE, RECALL, PACK.) Examples: 1>USE employee 1>COPY TO empl1 6 COPY(S) 1>USE#3 empl1 1>DELETE RECORD 2 1 DELETE(S) 1>DELETE#3 RECORD 5 1 DELETE(S) 1>SKIP 1>DELETE NEXT 3 FOR salary < 25000 1 DELETE(S) 1>PACK#3 5 TOTAL PACKED 1>PACK 4 TOTAL PACKED DELETE SRI VPI VPIN DELETE SR-Info/VP-Info Reference Manual Page 193 SECTION 4 DELETE FILE Remove files from disk. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DELETE FILE � � � � the name of the file to be deleted � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The DELETE FILE command deletes a file from the disk. This command should be used with care because, once deleted, the file cannot be recovered. If no extension is given, the extension DBF is assumed. Wildcards are not permitted. On a network with SET NETWORK ON in VP-Info Professional Network Edition, attempting to delete a file while another user is accessing it will cause a LOCK error. Examples: 1>DIR c*.dbf CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-90 5:11p COMMS2.DBF 6342 1-07-90 1:00p CUSTJUNK.DBF 7062 9-17-89 3:57p CUSTOMER.DBF 734 11-29-89 10:43p CUST2.DBF 734 3-19-90 7:03p 21940 bytes in 6 files. 5246976 bytes remaining. 1>DELETE FILE cust2 1>DIR c*.dbf CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-90 5:11p COMMS2.DBF 6342 1-07-90 1:00p CUSTJUNK.DBF 7062 9-17-89 3:57p CUSTOMER.DBF 734 11-29-89 10:43p 21206 bytes in 5 files. 5251072 bytes remaining. 734 characters were copied. DELETE FILE SRI VPI VPIN DELETE FILE SR-Info/VP-Info Reference Manual Page 194 SECTION 4 DIM Define a memory variable as a matrix. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DIM CHAR [] [x1,x2,x3],[y1,y2,y3],... � � DIM NUM [x1,x2,x3],[y1,y2,y3],... � � DIM LOG [x1,x2,x3],[y1,y2,y3],... � � � � , the names of the memory variables that � � are defined as matrices � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � the width of the character variables � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 Matrices of up to 3 dimensions can be defined for each of the three data types (CHARACTER, NUMERIC, LOGICAL). The width of the entries of CHAR matrices is fixed; it is 10 if not specified by the user. Note that in the syntax description of DIM, [x1,x2,x3] does not indicate an option. [ and ] must be present in a DIM command. x1, x2, x3 are integer numbers greater than zero, not variables, up to three in number. Examples: One dimensional matrices (also called vectors): DIM CHAR a[12] DIM CHAR 20 a[12] DIM CHAR a[12],b[12] DIM NUM a[21] DIM LOG a[20] Two dimensional matrices (also called tables): DIM CHAR 25 first[10,20] DIM NUM second[5,20] Three dimensional matrixes: DIM CHAR 10 a[10,10,10] DIM NUM b[5,5,50] A mixed definition: DIM CHAR 12 a[50],b[2,2,12] Note that the width of both A and B is 12. DIM SRI VPI VPIN DIM SR-Info/VP-Info Reference Manual Page 195 SECTION 4 Matrix variables can be used just like all other memory variables except that only = and STORE can assign values to them. Commands and functions that create memory variables (such as the command COUNT) or store values in existing memory variables (such as the command READ or the function READ() cannot directly use matrix variables. Matrix variables cannot be used in a TEXT structure or TEXT file. Matrix variables are stored in high memory (see Section A). The size of a matrix is at most 64K. Use the STATUS command to find out how much high memory is available. Numeric variables take 8 bytes and logical variables take 2 bytes of memory for each entry. Notes: The numbering is from 1. Matrices can be redimensioned in a program. No part of a DIM command can be a macro. Examples: Memory use (in bytes) 1>DIM CHAR 25 name[40] 1,000 1>DIM CHAR fill[10,7] 700 1>DIM NUM b[2,3],total[10,20,5] 48 and 8000 1>DIM LOG abc[5000] 10,000 1>? name[14] GEORGE 1>c=300 1>? abc[c] F 1>total[4,15,3]=total[3,15,3]*563.123 1>DIM NUM money[10] 1>USE employee 1>SUM salary TO temp 1>money[1]=temp The effect of SET WIDTH TO on displaying matrix variables: 1>DIM NUM num[20] 1>? num 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1>SET WIDTH TO 30 1>? num 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 DIM SRI VPI VPIN DIM SR-Info/VP-Info Reference Manual Page 196 SECTION 4 DIR Directory listing. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DIR [][] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � DOS directory name, with optional drive � � letter and colon � � a file name, with optional DOS windcards; � � extension is required if present � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command is similar to the DIR command of the DOS operating system: it displays the list of files on the current disk, together with file size and date and time created or last modified. Total size of all matching files is also given along with the bytes remaining on the disk. If a file name is given in full, the directory will show only that one file. A partial listing of the directory can be specified by giving a with wild card characters. The wild card character ? may be replaced by any single character; the wild card character * allows any string. Examples: 1>DIR SEN_NAME.NDX 1024 10-24-89 1:07a SEN_NUM.NDX 1024 10-24-89 1:07a SEN_REIN.PRG 757 8-31-89 11:30p SEN_SYST.DBF 53 9-06-89 9:02a SEN_ZIP.NDX 1024 10-24-89 1:07a SUBDUE.ARC 342658 11-29-89 8:25p SUBDUE.PRG 2027 11-29-89 7:21p SUBDUE2.PRG 1168 11-29-89 2:29a 349735 bytes in 8 files. 5251072 bytes remaining. 1>dir \*. LIB 8-04-89 2:42p MAX 8-04-89 1:27p RELTEST 8-06-89 10:27a SILVERAD 8-07-89 2:32p SUPER 8-27-89 8:30p TMP 8-04-89 1:28p V14 8-23-89 9:22p VAWORK 8-04-89 12:09p MANUAL 10-30-89 10:53a GEN 11-08-89 12:00a 0 bytes in 10 files. 5251072 bytes remaining. DIR SRI VPI VPIN DIR SR-Info/VP-Info Reference Manual Page 197 SECTION 4 1>DIR c*.dbf CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-90 5:11p COMMS2.DBF 6342 1-07-90 1:00p CUSTJUNK.DBF 7062 9-17-89 3:57p CUSTOMER.DBF 734 11-29-89 10:43p 21206 bytes in 5 files. 5251072 bytes remaining. DIR SRI VPI VPIN DIR SR-Info/VP-Info Reference Manual Page 198 SECTION 4 DIRF Directory listing, following redirection commands of the current FILES structure. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DIRF [] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � a file name, with optional DOS windcards; � � extension is required if present � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 SR-Info/VP-Info provides for a FILES structure (see FILES) which lets you specify default drive letters and/or directories for the various files used by the programs. Usually file types are grouped into individual directories according to "skeletons" constructed with wildcards. For example: FILES *.dbf,\data\ *.cpl,\cpl\ *.ndx,\indexes\ ENDFILES The DIRF command is similar to the DIR command, except that the file specification is compared to the existing FILES structure and, if a match is made, the redirection in the structure is applied to the file specification, so that the directory displayed is of the redirected directory, not the current directory. It displays a list of all matching files in that directory, together with file size and date and time created or last modified. Total size of all matching files is also given along with the bytes remaining on the current disk. If a file name is given in full, the directory will show only that one file. The wild card character ? may be replaced by any single character; the wild card character * allows any string. Examples: 1>DIRF *.dbf CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-90 5:11p COMMS2.DBF 6342 1-07-90 1:00p CUSTJUNK.DBF 7062 9-17-89 3:57p CUSTOMER.DBF 734 11-29-89 10:43p 21206 bytes in 5 files. 5251072 bytes remaining. FIRF SRI VPI VPIN DIRF SR-Info/VP-Info Reference Manual Page 199 SECTION 4 DISPLAY Display information, memory variables, system variables, file structure. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DISPLAY [] [FOR ] [] [OFF] � � DISPLAY FILES [LIKE ] [ON ] � � DISPLAY MEMORY � � DISPLAY STRUCTURE � � DISPLAY SYSTEM � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options (for displaying data file records): � � � � select by scope (default: the current record) � � FOR select by condition � � OFF do not display the record number � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options (for listing directories): � � � � LIKE the file specification, with optional wildcards � � ON a drive designation, with optional colon � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 These commands are exactly the same as the LIST commands except for the following differences: the default scope of the DISPLAY command is the current record rather than the whole file; the listing is stopped at the bottom of the screen or current window (about every 20 lines when displaying data file contents). See the commands: LIST, LIST FILES, LIST MEMORY, LIST STRUCTURE, and LIST SYSTEM. DISPLAY SRI VPI VPIN DISPLAY SR-Info/VP-Info Reference Manual Page 200 SECTION 4 DO In a program, execute a subroutine and, on completion, return to the next command in the calling program; in Conversational SR-Info/VP-Info, equivalent to CHAIN. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DO � � � � the name of the program called � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 In Conversational SR-Info/VP-Info, DO is the same as CHAIN: it begins the execution of the compiled program with the name with extension CPL; otherwise, the uncompiled SR-Info/VP-Info program will be compiled "on the fly" and executed, and the compiled file immediately deleted from the disk. Note that an uncompiled program with a GLOBAL statement cannot be compiled on the fly if it needs to import variable values, since compile step includes a CLEAR command. In a program, the command DO causes the program to be compiled as a subroutine of the current program. No matter how many subroutines are called, all will be compiled into the same CPL file as the calling program. The subroutines become overlays; they are called into memory when needed. When the called program executes a RETURN command, the execution resumes in the current program with the line following the DO command. The called program can itself DO other subroutines. There can be subroutines up to 10 levels. When a subroutine is compiled, all information about data files and memory variables is coded in the compiled form: the environment is compiled with the subroutine. Contrast this with the CHAIN command that starts with a clean slate. Any time a subroutine is invoked with a DO, the called program becomes an overlay. If a subroutine is called 5 times, it is compiled 5 times. This, of course, would make for very bulky programs. The solution of this problem is very simple. If the subroutine TEST is not sensitive to the environment (it does not use any fields or memory variables, or all data files and memory variable names are the same throughout the calling program), DO it as follows: ... PERFORM STEST ... PERFORM STEST DO SRI VPI VPIN DO SR-Info/VP-Info Reference Manual Page 201 SECTION 4 ... * PROCEDURE STEST DO TEST ENDPROCEDURE This way, TEST becomes a single overlay; it is invoked with PERFORM STEST. Note: If the same subroutine is called from two places in the same program, but the two places have different environments, the subroutine cannot be called from a single procedure, and has to be compiled twice. For example, assume that TEST carries out some computation on some fields of the data file HISTORY1 and some memory variables, and then carries out the same computations on some fields of the data file HISTORY2 and some memory variables; HISTORY1 is file 2, while HISTORY2 is file 3. Create two procedures: PROCEDURE TEST1 SELECT 2 DO TEST ENDPROCEDURE * PROCEDURE TEST2 SELECT 3 DO TEST ENDPROCEDURE Now if you need to invoke TEST with the first environment (HISTORY1), then PERFORM TEST1; otherwise, PERFORM TEST2. All procedures called by a subroutine must be contained in the PRG file of the subroutine. A procedure of the calling program cannot have the same name as a procedure of the subroutine. It is good programming practice not to have the same name for procedures and subroutines. Procedures are internally compiled, while subroutines become overlays. Therefore, procedures are faster in execution. However, there is a limit of 32 procedures in total for one CPL file. See CHAIN and PERFORM. The name of the PRG file used with the DO command cannot be a macro. Example in Conversational SR-Info/VP-Info: DO INVOICE DO SRI VPI VPIN DO SR-Info/VP-Info Reference Manual Page 202 SECTION 4 This will execute INVOICE.CPL if present; otherwise it will compile and execute INVOICE.PRG, and then delete the CPL file. DO SRI VPI VPIN DO SR-Info/VP-Info Reference Manual Page 203 SECTION 4 DO CASE Switch the program flow to a number of cases. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DO CASE � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command DO CASE provides for the processing of a number of options without the use of nested IF commands. It is used in conjunction with the CASE, OTHERWISE, and ENDCASE commands. The DO CASE program structure is as follows: DO CASE CASE CASE ... CASE OTHERWISE ENDCASE where , , ,..., are conditions, , ,..., and are program segments, that is, any number of SR-Info/VP-Info program lines. Execution is as follows: After the DO CASE is encountered, SR-Info/VP-Info looks for the first CASE command and evaluates the condition; if the condition is true, the following program segment is executed, terminated by the next CASE, by OTHERWISE, or by ENDCASE. After the execution of the program segment, the program execution continues with the program line after the ENDCASE command. If the condition is false, SR-Info/VP-Info looks for the next CASE command. If no condition is true, SR-Info/VP-Info executes the program segment following the OTHERWISE command (if any). The OTHERWISE command is optional. Note that if more than one condition holds, only the segment after the first true condition is executed. DO case commands can be nested up to 10 levels. Example: DO CASE SRI VPI VPIN DO CASE SR-Info/VP-Info Reference Manual Page 204 SECTION 4 ans2='P' @ 22,10 SAY 'E-edit A-add O-order L-look Q-quit ' GET ans2 READ @ 22,10 DO CASE CASE UPPER(ans2)='Q' picked=f ok=f LOOP CASE UPPER(ans2)='E' @ y,3 GET style @ y,10 GET color @ y,14 GET descript @ y,35 GET q1 @ y,39 GET q2 @ y,43 GET q3 @ y,47 GET q4 @ y,51 GET q5 @ y,55 GET q6 @ y,59 GET q7 @ y,63 GET q8 READ IF q1+q2+q3+q4+q5+q6+q7+q8=0 DELETE ENDIF mpick=t CASE UPPER(ans2)='O' REPLACE type WITH 'O' ... OTHERWISE IF type='P' REPLACE type WITH 'O' ENDIF picked=f ENDCASE When editing with the internal SR-Info/VP-Info programming editor (see WRITE command), Alt-F reformats the file with all structures properly indented, making it easy to see unbalanced structures. DO CASE SRI VPI VPIN DO CASE SR-Info/VP-Info Reference Manual Page 205 SECTION 4 DO WHILE The standard program loop command. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � DO WHILE � � � � the condition controlling the loop � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The command DO WHILE starts the program loop. The structure of the loop is as follows: DO WHILE ENDDO Execution is as follows: After the DO WHILE is encountered, is evaluated. If is true, the SR-Info/VP-Info program segment (terminated by the ENDDO) is executed; then is evaluated again. If is false, execution continues with the command following ENDDO. There can be a DO WHILE command within a DO WHILE command; this is called nesting. Many level of nesting is permitted; however, too many levels of nesting will give a compile-time error message: Stack overflow. There are two commands that facilitate moving to the top and the bottom of the loop: LOOP moves the execution to the top of the loop, and BREAK exits the loop. There is one more looping command in SR-Info/VP-Info: REPEAT. (See the commands BREAK, LOOP, REPEAT.) Examples: 1. Typical DO WHILE to process all the records of a file: USE employee ERASE DO WHILE .NOT. EOF ? name, fname, tel_no SKIP ENDDO 2. Typical DO WHILE for counting how many records to list: count=0 USE records DO WHILE count<100 DO WHILE SRI VPI VPIN DO WHILE SR-Info/VP-Info Reference Manual Page 206 SECTION 4 ? invoice_no,amount*qty SKIP count=count+1 ENDDO When editing with the internal SR-Info/VP-Info programming editor (see WRITE command), Alt-F reformats the file with all structures properly indented, making it easy to see unbalanced structures. DO WHILE SRI VPI VPIN DO WHILE SR-Info/VP-Info Reference Manual Page 207 SECTION 4 EDIT Edit records in a data file. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � EDIT [] [FIELDS / OFF / TEXT ] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options � � � � begin EDIT on record number � � FIELDS the fields to be edited � � TEXT erases the screen, displays the text file, � � and then does EDIT using the text file � � layout and embedded format pictures � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options VP-Info Professional only � � � � OFF rather than generate an EDIT input screen, � � uses an exiting screen and its Get Table � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The EDIT command without either the OFF or TEXT option allows the user to view and modify records in the selected file. Once the command is given, the screen shows the current record (or the record optionally specified with ) in full-screen editing mode. If the FIELDS keyword and a fields list is specified, only those fields will be available during EDIT; otherwise, SR-Info/VP-Info builds an input screen using all fields in the current data file. To exit from EDIT, use (or Ctrl-W) once you have filled in the fields of the last record desired. To switch from EDIT to APPEND mode, press Ctrl-, while switches back from APPEND into EDIT mode. Note that APPEND is actually a special mode of EDIT; the only difference is that EDIT begins by displaying the current record, while APPEND adds a new blank record to the data file and displays that. All the editing fields are the same for both EDIT and APPEND. EDIT updates all index files in use. The command SET MENU ON displays the most important editing keys at the top of the screen, except if OFF or TEXT keyword is used, or if the current window is less than 80 characters wide or 10 rows deep. Editing keys: or Ctrl-S moves the cursor back one character or Ctrl-D moves the cursor forward one character Ctrl- moves to the beginning of the field Ctrl- moves to the end of the field EDIT SRI VPI VPIN EDIT SR-Info/VP-Info Reference Manual Page 208 SECTION 4 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 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 field or Ctrl-E moves the cursor to the previous field or Ctrl-X moves the cursor to the next field Ctrl-Q quits and does not update the current record or Ctrl-W quits and updates the current record or Ctrl-R edits the previous record; if in APPEND mode, exits to EDIT mode or Ctrl-C edits the next record Ctrl- Enters APPEND mode; adds a blank record and places the cursor in that new record Ctrl-K moves back to the top of the previous page (not with OFF or TEXT keywords) Ctrl-L moves to the top of the next page (not with OFF or TEXT keywords) Examples: 1>USE employee 1>GO 2 1>EDIT 1>EDIT 2 You then see: EDIT SRI VPI VPIN EDIT SR-Info/VP-Info Reference Manual Page 209 SECTION 4 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 #1 EMPLOYEE.DBF EDIT Record 2 Page 1 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� �REC: prev next delete ^U PAGE: prev ^K next ^L � �FILE: top ^ bottom ^ DELETE: char to end of field ^Y � �APPEND MODE: begin ^ exit EXIT: with save no save ^Q � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� NAME........... Steiner FNAME.......... Tom ADDR........... 114 North Pitt St. CITY........... Lakewood STATE.......... MD ZIP............ 02111 TEL_NO......... 596-0017 MARRIED........ y SALARY......... 35780.00 YEAR_EMP....... 1984 DEPT........... Engineering 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 To edit only a few fields: 1>USE employee 1>SET MENU ON 1>EDIT FIELDS name, fname, tel_no This displays: 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 #1 EMPLOYEE.DBF EDIT Record 7 Page 1 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� �REC: prev next delete ^U PAGE: prev ^K next ^L � �FILE: top ^ bottom ^ DELETE: char to end of field ^Y � �APPEND MODE: begin ^ exit EXIT: with save no save ^Q � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� NAME........... Marek FNAME.......... Joe TEL_NO......... 566-7012 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 The following examples show EDIT using the TEXT and OFF keywords combined with an external text file (output from both is identical; OFF, available only in VP-Info Professional, allows the added flexibility of using an internal TEXT structure and/or an ON FIELD structure): EDIT SRI VPI VPIN EDIT SR-Info/VP-Info Reference Manual Page 210 SECTION 4 1>USE employee 1>EDIT TEXT employee 1>USE employee 1>TEXT Employee 1>EDIT OFF These both display: 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 EDIT Record 23 NAME........... ARTHUR NEUMANN ADD_1.......... 4274 MATHERS BLVD. E. UPSON DOWNS ZIP............ 59768 PHONE.......... 243-5548 (614) WPHONE......... 643-5657 (614) EXPERIENCE..... ACCT STUDENT, WORKED FOR CPA SCARECROW & MOSCOWITZ, BOSTON COMMENTS KNOWS INCOME-TAX LAW, WITH SPECIALTIES IN DEPRECIATION AND TAX SHELTERS; SUGGEST ASSIGN TO CENTRAL OFFICE 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 See the TEXT command for a full discussion of the TEXT command. The TEXT used for the above input screen: 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 .. 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 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 EDIT SRI VPI VPIN EDIT SR-Info/VP-Info Reference Manual Page 211 SECTION 4 The following demonstration program illustrates use of EDIT off in VP-Info Professional: EDIT SRI VPI VPIN EDIT SR-Info/VP-Info Reference Manual Page 212 SECTION 4 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 ********************************************************************** * EDIToff.prg demonstration program for the EDIT OFF command * *** VP-Info Professional only *** * Note the technique used to "wrap" the file...when skipping * past EOF, program "wraps to top of file, and vice versa, * using new SOUND command to beep (silent if NOEFFECTS in VPI.SET). * (C) 1990 Sub Rosa Publishing Inc. (Author: Sidney L. Bursten) ********************************************************************** USE customer ON escape ;what to do when is pressed WINDOW ;cancel small window CURSOR 23,0 ;put cursor in bottom left corner of screen CANCEL ;exit program ENDON WINDOW ERASE TEXT 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳朕 �REC: prev next DELETE RECORD ^U � �FILE: top ^ bottom ^ DELETE: char to end of field ^Y � �APPEND MODE: begin ^ exit EXIT: with save no save ^Q � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳潰 ENDTEXT WINDOW 8,10,17,69 double TEXT .. custnum,!!!-!-99 .. hphone,999-9999 (999) .. wphone,999-9999 (999) .. state,!! Enter customer data: Number...... @custnum Name........ %firstname %lastname Address..... @address City, State. %city %state Zip Code.... @zip Phones (H/W) %hphone %wphone ENDTEXT DO WHILE t EDIT off ;edit using Get Table created with TEXT above DO CASE CASE :key=335 ;exit loop when key pressed BREAK CASE eof ;skipped past end of file; start again at top SOUND 11 GOTO top CASE #<1 ;backed up past beginning of file; start again at bottom SOUND 11 GOTO bottom EDIT SRI VPI VPIN EDIT SR-Info/VP-Info Reference Manual Page 213 SECTION 4 IF eof ;if no undeleted records left in file, get out BREAK ENDIF ENDCASE ENDDO WINDOW ;cancel small window CURSOR 23,0 ;put cursor in bottom left corner of screen 陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳 EDIT SRI VPI VPIN EDIT SR-Info/VP-Info Reference Manual Page 214 SECTION 4 EJECT Start a new page on the printer. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � EJECT � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The EJECT command sends a form feed (eject page, top of form) signal to the printer. This also resets the line and column counters to 0 for the @ commands. EJECT will attempt to advance the printer whether printing is on or off. If your printer is on but off-line, your program may appear to hang; either put the printer on-line, or turn off the printer to release SR-Info/VP-Info to continue processing. When spooling (see SPOOL), the form-feed is placed into the spool file, and has no effect on the printer until the file is spooled or copied to the printer. (See the commands @, SET FORMAT TO PRINT, SET PRINT ON, SET EJECT ON/OFF, SET LENGTH TO, and the functions ROW( and COL(. Examples: 1>EJECT In a program, EJECT and SPOOL may be used together to reset the line counter to zero before printing begins: SPOOL junk EJECT SPOOL EJECT SRI VPI VPIN EJECT SR-Info/VP-Info Reference Manual Page 215 SECTION 4 ELSE The optional part of an IF program structure. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � ELSE � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command introduces the optional part of the program structure IF/ENDIF. See the command IF. Example: IF count>5 ok=t ELSE IF count<2 ok=f ENDIF ? 'ok' ENDIF ELSE SRI VPI VPIN ELSE SR-Info/VP-Info Reference Manual Page 216 SECTION 4 END commands Terminate a command structure. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � ENDCASE � � ENDDO � � ENDIF � � ENDFILES � � ENDON � � ENDPROCEDURE � � ENDREPEAT � � ENDTEXT � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 All SR-Info/VP-Info structures are terminated with a matching END command as shown above. When editing with the internal SR-Info/VP-Info programming editor (see WRITE command), Alt-F reformats the file with all structures properly indented, making it easy to see unbalanced structures. See DO CASE, DO WHILE, IF, FILES, ON ERROR, ON ESCAPE, ON FIELD, PROCEDURE, REPEAT, and TEXT. END Commands SRI VPI VPIN END Commands SR-Info/VP-Info Reference Manual Page 217 SECTION 4 ERASE Erase screen. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � ERASE [line1,line2] � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: � � � � line1, line2 erase from line1 to line2 � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command erases the screen, and is a synonym for CLS. If, optionally, two numeric expressions, line1 and line2, are given, it erases line1 and line2, and all lines between, if any. These expressions should have values between 0 and 24. ERASE is the same as the following three commands: CLS ERASE 0,24 CLS 0,24 Examples: 1>ERASE 1>ERASE 2,4 1>ERASE 2,2 ERASE SRI VPI VPIN ERASE SR-Info/VP-Info Reference Manual Page 218 SECTION 4 FIELD Initiates a program segment module in an ON FIELD structure 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � FIELD / � � � � fieldname name of a field in a Get Table � � fieldnum number of a field in a Get Table � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 Each field in a Get Table may have a program segment in a program's ON FIELD structure which will be executed when the cursor leaves that field, or optionally when READ or the current record is exited. All fields in a Get Table are numbered from 1 to 64 in the order in which they are placed on the screen. When they are painted by @ GET commands, the order is the same as the order of the @ GET commands in the program; if painted by TEXT, the order is left-to- right on each line, and then top-to-bottom. When editing with the internal SR-Info/VP-Info programming editor (see WRITE command), Alt-F reformats the file with all structures properly indented, making it easy to see unbalanced structures. (See command ON FIELD.) Examples: FIELD 3 FIELD cust FIELD name#3 FIELD SRI VPI VPIN FIELD SR-Info/VP-Info Reference Manual Page 219 SECTION 4 FIELDS= Set the maximum number of fields available at any one time. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � FIELDS= � � � � VP-Info Professional only VPI.SET file only � � � � maximum number of fields allowed in all data files � � open at any one time (including SR-Info/VP-Info's � � internal work file); range 128 to 1000 � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 This command sets the maximum number of fields that can be open at any one time in all open files, taking the place of SET FIELDS TO in earlier versions of the language (now ignored if encountered by the VPI-Info compiler). Reserving memory space for a single field requires 16 bytes. Therefore, increasing the number of fields requested reduces the memory space available for your program. The limits for FIELDS= are 128 and 1000, with a default of 320. Caution: be sure you have SET FIELDS to a number large enough to accommodate all the fields in all the data files you will ever have open at one time, plus the largest number of fields in any of these files. Example: FIELDS=500 FIELDS= VPI VPIN FIELDS= SR-Info/VP-Info Reference Manual Page 220 SECTION 4 FILES Lets you specify drive letters, directories, and/or default file modes for various files used by SR-Info/VP-Info. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � FILES � � FILES [,[] [,]] � � � � specification any file name or "skeleton" (using the * and ? � � wildcards � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � file direction any legal DOS path, consisting of drive letter � � and colon and/or directory path � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: (VP-Info Professional Network Edition only): � � � � mode any one of the optional file-opening modes used � � in network operation -- LOCK or L, WRITE or W, � � READ or R, or SHARE or S. If no mode is set, � � or if Network Edition is not in use, the � � default mode is LOCK � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 There is always a FILES Table in memory, set up by the active FILES ... ENDFILES structure. (This table is empty if there is no active FILES ... ENDFILES structure.) The FILES command allows on-the-fly additions and changes to the FILES Table from either Conversational SR-Info/VP-Info or programs. Examples of Form 1 (Only in programs): FILES Initiates a FILES ... ENDFILES structure. (See FILES ... ENDFILES.) (Only in Conversational SR-Info/VP-Info) 1>FILES Empties the current FILES Table in memory. (Caution: Do not confuse this interactive command with the FILES command as used in programs, which always initiates a FILES ... ENDFILES structure.) Examples of Form 2 (In either programs or Conversational SR-Info/VP-Info): FILES *.dbf,c:\data FILES SRI VPI VPIN FILES SR-Info/VP-Info Reference Manual Page 221 SECTION 4 Given this command, either in a program or in Conversational SR-Info/VP-Info, SR-Info/VP-Info searches the FILES Table in memory for a matching file specification. If the file specification *.DBF is found, the new path will replace the existing path; otherwise, this specification and redirection is added to the top of the FILES Table. FILES *.frm If no is specified, file redirection is turned off for files matching this entry. Macros are allowed with the FILES command itself, either in programs or in Conversational SR-Info/VP-Info, although macros are not permitted in the FILES ... ENDFILES structure. For VP-Info Professional Network Edition only There is a special form of the FILES command which has significance only in VP-Info Professional Network Edition with SET NETWORK ON. This form adds a which sets the default file mode for all matching files. For example, FILES *.ndx,ndx,READ sets a file mode of READ for all files with an NDX extension, all of which are found in the NDX subdirectory of the current directory. If only and are given, the file mode is given to all files matching that specification wherever they are on the disk. (Note: two commas are required: FILES *.dbf,,WRITE.) FILES SRI VPI VPIN FILES SR-Info/VP-Info Reference Manual Page 222 SECTION 4 FILES ... ENDFILES Lets you specify drive letters, directories, and/or default file modes for various files used by SR-Info/VP-Info. 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � FILES � � [,[] [,]] � � ENDFILES � � � � specification any file name or "skeleton" (using the * and ? � � wildcards); must not be indented � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Options: � � � � file direction any legal DOS path, consisting of drive letter � � and colon and/or directory path � 把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳超 � Option: (VP-Info Professional Network Edition only): � � � � mode any one of the optional file-opening modes used � � in network operation -- LOCK or L, WRITE or W, � � READ or R, or SHARE or S. If no mode is set, � � or if Network Edition is not in use, the � � default mode is LOCK � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 (Programs and CNF file only) There is always a FILES Table in memory, set up by the active FILES ... ENDFILES structure. (This table is empty if there is no active FILES ... ENDFILES structure.) A FILES ... ENDFILES structure may be created in a program at any time, and may have any number of specification lines between the FILES and ENDFILES lines. All existing entries are immediately cleared and a new FILES Table constructed. Examples: *.dbf,c:\data Causes SR-Info/VP-Info to add C:\DATA\ to the front of all file names Given this command, either in a SR-Info/VP-Info program or in Conversational SR-Info/VP-Info, SR-Info/VP-Info searches the FILES Table in memory for a matching file specification. If the file specification *.DBF is found, the new path will replace the existing path; otherwise, this specification and redirection is added to the top of the FILES Table. FILES *.frm If no is specified, file redirection is turned off for files matching this entry. FILES ... ENDFILES SRI VPI VPIN FILES ... ENDFILES SR-Info/VP-Info Reference Manual Page 223 SECTION 4 A FILES ... ENDFILES structure is cleared by an empty structure as follows: FILES ENDFILES No macros are permitted in the FILES ... ENDFILES structure, although macros are allowed with the FILES command itself, either in programs or in Conversational SR-Info/VP-Info. Caution: There is no way to add a comment inside a FILES ... ENDFILES structure, and no line should be indented. The contents of FILES ... ENDFILES structures are not affected by the reformatting facility Alt-F of the WRITE command. For VP-Info Professional Network Edition only There is a special form of FILES ... ENDFILES entry which has significance only in VP-Info Professional Network Edition with SET NETWORK ON. This form adds a which sets the default file mode for all matching files. For example, *.ndx,ndx,READ sets a file mode of READ for all files with an NDX extension, all of which are found in the NDX subdirectory of the current directory. If only and are given, the file mode is given to all files matching that specification wherever they are on the disk. (Note: two commas are required: *.dbf,,WRITE.) FILES ... ENDFILES SRI VPI VPIN FILES ... ENDFILES SR-Info/VP-Info Reference Manual Page 224 SECTION 4 FILES= Set the maximum number of files which can be open at one time (requires DOS 3.3 and above and VP-Info Professional) 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � FILES= � � � � VP-Info Professional only VPI.SET file only � � � � maximum number of files that can be open at any one � � time; range 21 to 65 � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 VP-Info Professional is not limited to the 20-file maximum of SR-Info and earlier versions of VP-Info, provided the operating system allows more than 20 open files (DOS 3.3 and above) and that a FILES= statement is present in the CONFIG.SYS file specifying at least files. As a practical matter, should be in the range 25 to 60; the default and minimum is 20. Loading more files reduces the maximum size of programs and reduces speed of such memory-intensive commands as INDEX. This command may be placed only in the VPI.SET file, which is executed by VP-Info Professional only when first loaded. See VPI.SET in the Required Files chapter. Example: 1>FILES=50 FILES= VPI VPIN FILES= SR-Info/VP-Info Reference Manual Page 225 SECTION 4 FILES LIST Display the current contents of the FILES ... ENDFILES structure 浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様融 � FILES LIST � 藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様夕 The current FILES ... ENDFILES structure may be displayed with this command. See FILES and FILES ... ENDFILES. Example: 1>FILES LIST File Spec Drive and/or Path *.CPL CPL2\ *.NDX NDX2\ *.DBF DBF\ *.DBK DBK\ FILES LIST SRI VPI VPIN FILES LIST