home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
srinf14b.zip
/
SRIMAN.ZIP
/
PART3
< prev
next >
Wrap
Text File
|
1990-05-14
|
281KB
|
9,542 lines
SR-Info/VP-Info Reference Manual Page 226 SECTION 4
FIND
Find a record by its index in the selected data file.
╔════════════════════════════════════════════════════════════════════╗
║ FIND <string> ║
╚════════════════════════════════════════════════════════════════════╝
FIND is one of a family of commands that finds a record in an
indexed data file by matching a given string with key values in the
index file:
FIND positions the file on the first record in the index matching
the FIND string (no-find positions the file at the top of
file)
LAST positions the file on the last record in the index matching
the FIND string (VP-Info Professional only) (no-find
positions the file at the top of file)
NEAREST positions the file on the first record in the index equal
to or greater than the FIND string (VP-Info Professional
only)
SEEK is identical to FIND, except that it searches for the match
to the value of a character expression instead of a string
constant (VP-Info Professional only) (no-find positions the
file at the top of file)
All forms allow a search to be made on a character expression
when the expression is preceded by the macro symbol "&". When the
variable var='TAYLOR', all of the following command lines are
equivalent:
FIND TAYLOR
FIND &var
SEEK var (VP-Info Professional only)
In Conversational SR-Info/VP-Info, just type FIND and the key.
Examples:
1>FIND TAYLOR
1>FIND TOM
If <string> evaluates the same for two records, the second record
will never be found with FIND.
If SET DELETE ON, deleted records will not be found. (See the
command SET.)
Numbers must always be treated as strings, even if the key
expression is a numeric field. If NUM is a numeric field of width 2,
FIND 1 will not find 1, but FIND &STR(1,2) or FIND &' 1' will work.
FIND SRI VPI VPIN FIND
SR-Info/VP-Info Reference Manual Page 227 SECTION 4
For the users' convenience, Conversational SR-Info/VP-Info
converts all command lines to upper case before execution. So, to
find the inventory numbers that start with AB, type either of the
following two commands:
1>FIND AB
1>FIND ab
It follows that
1>FIND Taylor
is understood by SR-Info/VP-Info as FIND TAYLOR. If you have to find
Taylor, use one of the following forms:
1>FIND &'Taylor'
1>SEEK 'Taylor' (VP-Info Professional only)
or if name='Taylor' use one of the following forms:
1>FIND &name
1>SEEK name (VP-Info Professional only)
In a SR-Info program, put the key in a memory variable <memvar>
and then use FIND &<memvar> to find the record.
Example:
name='Taylor'
FIND &name
If FIND is successful, the value of the current record pointer
(as shown by the # and RECNO( functions) is set to the current record
number, and the system variable :NEAR is set to the same number.
If the record is not found, the current record pointer will be
set to 0 and the value of :NEAR will be set to the number of the first
record in the index with a key greater than the FIND string; if the
index contains no key greater than the FIND string, :NEAR is set to
the bottom of file, and EOF is set to T (true).
The command for "if not found" is:
IF #=0 or
IF RECNO()=0
In Conversational SR-Info/VP-Info or in programs with SET TALK
ON, SR-Info/VP-Info sends the message "NO FIND" when a search is
unsuccessful.
Notes:
* FIND only works on the active index of the selected data file.
FIND SRI VPI VPIN FIND
SR-Info/VP-Info Reference Manual Page 228 SECTION 4
If that index was created with a selection condition, some
records may be excluded from the index. (See INDEX.)
* With SET EXACT ON (see the SET command) only exact matches are
found. The FIND string must be the same length as the index
key, and match exactly; if SET EXACT OFF, the find string
may be shorter.
* An index may be made insensitive to capitalization by using the
uppercase functions !( or UPPER( in index creation. This
makes use of the FIND command much easier in Conversational
SR-Info/VP-Info. (See INDEX command.)
* The macro symbol (&) has a wider definition when used with
FIND, LAST, NEAREST and SEEK than with other SR-Info/VP-Info
command. With this group of commands only, it alerts
SR-Info/VP-Info that the string expression following is to
be evaluated and used as the FIND string. (Macros in all
other commands are limited to fields and variables;
dimensioned variables, functions and concatenation are not
allowed.)
FIND SRI VPI VPIN FIND
SR-Info/VP-Info Reference Manual Page 229 SECTION 4
FLUSH
Update the selected data file on the disk.
╔════════════════════════════════════════════════════════════════════╗
║ FLUSH ║
╚════════════════════════════════════════════════════════════════════╝
The current record of the selected data file is updated on the
disk. This may prevent accidental loss of data due to power failure.
This command updates only the selected data file; it does not
update other data files in use, nor does it safeguard index files,
text files, or DOS files. After a power failure it may be necessary
to reindex the selected file.
Example:
1>FLUSH
FLUSH SRI VPI VPIN FLUSH
SR-Info/VP-Info Reference Manual Page 230 SECTION 4
Declare global variables.
╔════════════════════════════════════════════════════════════════════╗
║ GLOBAL <memvar list> ║
║ ║
║ <memvar list> the list of memory variables to be declared global ║
╚════════════════════════════════════════════════════════════════════╝
When a program is chained to another program, all the variables
that were defined as global by the GLOBAL command will be passed to
the new program.
The GLOBAL command should be the first command of any program.
It should definitely precede any command that involves a memory
variable.
There can be only one GLOBAL command in a program. No part of
the GLOBAL command can be a macro. A matrix variable cannot occur in
a GLOBAL command.
This is how the command works. In PROG1, you find at the
beginning
GLOBAL a,b,c,d
This places in the memory variable table (in the internal
SR-Info/VP-Info data space, see Appendix A) the variable names: A, B,
C, D, in that order. The variables at this stage have no type or
data. When in PROG1, A is encountered, that will attach type and a
pointer to a value to A.
Now PROG1 is chained to PROG2. For PROG2 to receive the values
associated in PROG1 with A, B, C, and D, start with the command:
GLOBAL a,b,c,d
Note, however, that the variable names do not have to match (although
type must).
GLOBAL x,y,c,d
will create the variable X with the contents of A, Y with the contents
of B, C and D retain their names and types.
If you start PROG2 with
GLOBAL a,b,c
then A, B, and C are inherited. If you specify in PROG2 more global
variables, for instance,
GLOBAL SRI VPI VPIN GLOBAL
SR-Info/VP-Info Reference Manual Page 231 SECTION 4
GLOBAL a,b,c,d,e
then A, B, C, and D inherit their values and types from PROG1; E
becomes the fifth entry in the memory variable table, with no type or
value.
Example:
PROG1 is chained to PROG2 with the command:
CHAIN PROG2
PROG1 wants to pass to PROG2 the values of the following
variables: TRANSACT, PROCESS, CUSTRANGE, TYPE. To accomplish this,
start both PROG1 and PROG2 with the command:
GLOBAL transact,process,custrange,type
Note that when the execution of PROG2 starts, only these four
memory variables exist.
Now suppose that PROG2 is chained to PROG3, and wants to pass to
PROG3 the variables TRANSACT, PROCESS, CUSTRANGE, TYPE, and TRDATE.
Then the first command of PROG1 should be:
GLOBAL transact,process,custrange,type
of PROG2:
GLOBAL transact,process,custrange,type,trdate
and of PROG3:
GLOBAL transact,process,custrange,type,trdate
Now if PROG3 chains to PROG1, the variables TRANSACT, PROCESS,
CUSTRANGE, TYPE are still passed on, but not TRDATE.
GLOBAL SRI VPI VPIN GLOBAL
SR-Info/VP-Info Reference Manual Page 232 SECTION 4
GO
GOTO
Set current record pointer to new value.
╔════════════════════════════════════════════════════════════════════╗
║ <num const> ║
║ GO <num exp> ║
║ GOTO <num exp> ║
║ GO RECORD <num exp> ║
║ GOTO RECORD <num exp> ║
║ GO TOP ║
║ GOTO TOP ║
║ GO BOTTOM ║
║ GOTO BOTTOM ║
║ ║
║ <num exp>/<num const> the number to be assigned to # ║
╚════════════════════════════════════════════════════════════════════╝
The commands GO and GOTO are identical. They assign a new value
to #, the current record pointer (see Section 3.4). The data file is
repositioned to the record with the new record number.
The forms:
GO <num exp>
GOTO <num exp>
GO RECORD <num exp>
GOTO RECORD <num exp>
evaluate the numeric expression <num exp>, throw away any fractional
part, and assign the value to the current record pointer, #. So, any
one of the following commands:
1>2
1>GO 2
1>GOTO 2
1>GO (2+2)/2
accomplishes the same: the record pointer (#) is set to 2. Note that
1>(2+2)/2
is not allowed.
If the selected file is indexed, the index is adjusted
accordingly.
GO TOP, GOTO TOP and GO BOTTOM, GOTO BOTTOM are used to position
the current record pointer to the top and bottom of the current data
file. If there is no index in use, the TOP is Record 1, and BOTTOM is
the last record. If an index is in use, then the TOP and BOTTOM are
GO/GOTO SRI VPI VPIN GO/GOTO
SR-Info/VP-Info Reference Manual Page 233 SECTION 4
the first and last records according to the index.
Examples:
1>USE employee
1>GOTO 2
1>DISPLAY name
2 Steiner
1>5
1>DISPLAY name
5 Poyner
1>GOTO 1
1>DISPLAY name
1 Marek
1>GO BOTTOM
1>DISPLAY name
6 Wilson
1>GO TOP
1>DISPLAY name
1 Marek
GO/GOTO SRI VPI VPIN GO/GOTO
SR-Info/VP-Info Reference Manual Page 234 SECTION 4
HELP
Request for information on SR-Info/VP-Info commands and related
topics.
╔════════════════════════════════════════════════════════════════════╗
║ HELP [<string>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <string> the topic for which help is wanted ║
╚════════════════════════════════════════════════════════════════════╝
The HELP command provides information on the syntax (format
rules) and use of the commands of SR-Info/VP-Info, and some related
topics; it is available only in Conversational SR-Info/VP-Info.
The command
1>HELP
displays all the topics for which HELP is available. Type HELP and
the topic description.
The text is contained in the file SRI.HLP, VPI.HLP or VPIN.HLP,
which must be in the same directory as your version's MSG file, either
in the current directory or on the DOS path. If the file is not
found, SR-Info/VP-Info will so advise the user.
Examples:
1.
1>HELP
displays the following screen:
HELP SRI VPI VPIN HELP
SR-Info/VP-Info Reference Manual Page 235 SECTION 4
──────────────────────────────────────────────────────────────────────────────
GENERAL HELP
VP-Info Help
Use the arrow keys to move the lightbar and select a topic from the list
below, then press the <ENTER> key. You may also move the lightbar to the
bottom of the screen and type the name of a specific command or function.
1. Commands List
2. Functions List
3. Color Attribute Table
4. Command and Field Redirection
5. Date Input Formats
6. Date Output Formats
7. Editing Keys
8. Format Strings
9. Get Tables
10. REPORT Command
11. TEXT
12. Variables
────────────────────────────────────────────────────────────────────────────────
Selection Bar . Select with ┘, Exit with <Esc>, or Enter command....
Enter topic ░░░░░░░░░░░░░░░
──────────────────────────────────────────────────────────────────────────────
A selection bar can be moved with up and down arrows to any of
the 12 topics listed, or moved beyond the topic listing (up or down)
to the topic-entry window. Fill in any command or function name and
press <ENTER> for one or more screens of explanation, like this for
REPLACE:
HELP SRI VPI VPIN HELP
SR-Info/VP-Info Reference Manual Page 236 SECTION 4
──────────────────────────────────────────────────────────────────────────────
ROPEN(
Sequential file-opening function: opens a file for reading. Once you've
opened a file with ROPEN(, you can use other file-handling functions to
find and read data from the file; e.g., GET(, IN(, READ(, SEEK(, and
SSEEK(. To close the file, use the function CLOSE(.
Form: ROPEN(<filename>[,<file number]>)
Type: LOGICAL (DOS file handling)
In: <filename> - a string or string expression: the file to open; if no
extension is given, VP-Info assumes TXT.
<file number> - (optional) a number from 1 to 4: assigns a file number
to the DOS file being opened. Other file-handling functions can refer to
this file by number (default 1).
Out: The file is opened for reading. The function itself returns true (T) if
the action is successful, false (F) if not.
────────────────────────────────────────────────────────────────────────────────
Previous Screen - <PgUp>, Exit with <Esc>, or Enter command............
Enter topic ░░░░░░░░░░░░░░░
──────────────────────────────────────────────────────────────────────────────
2.
1>HELP ROPEN(
displays the screen on ROPEN(, exactly as shown above. Press <Pg Dn>
to get to the additional screens if available, <Pg Up> to get to
previous screen, or <Esc> to get to the command prompt.
HELP SRI VPI VPIN HELP
SR-Info/VP-Info Reference Manual Page 237 SECTION 4
IF
Conditional execution of SR-Info/VP-Info program segment.
╔════════════════════════════════════════════════════════════════════╗
║ IF <cond> ║
║ ║
║ <cond> the condition to be evaluated; if true, segment is ║
║ executed ║
╚════════════════════════════════════════════════════════════════════╝
The IF command allows conditional execution of a program segment.
The general form of this command is:
IF <cond>
<program segment>
[ELSE
<ELSE program segment>]
ENDIF
This works as follows: When the IF command is found, the
condition <cond> is evaluated. If <cond> is true, the <program
segment> (a number of program lines) is executed. The end of the
<program segment> is at the ELSE or at the ENDIF (whichever comes
first).
If <cond> is false, SR-Info/VP-Info looks for ELSE. If ELSE is
found, the <ELSE program segment> is executed.
The execution continues with the program line following the
ENDIF.
Note that ELSE is optional.
There can be an IF command within an IF 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.
Care should be taken to nest the IF commands properly in a DO
WHILE, DO CASE, or REPEAT program structure. 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.
IF may not take a macro. Since a line with a macro is not
compiled until runtime, SR-Info/VP-Info will be unable to handle
nesting properly if a macro is used, resulting in the error message
"ENDIF implies IF" or "ELSE implies IF." For an alternative, see
example 4 below.
IF SRI VPI VPIN IF
SR-Info/VP-Info Reference Manual Page 238 SECTION 4
Examples:
1.
IF count>5
STORE T TO ok
ELSE
IF count<2
STORE F TO ok
ENDIF
? 'ok'
ENDIF
Indenting the program lines helps to show the level of nesting of
the structures. In WRITE, Alt-F indents the lines and capitalizes the
command verbs.
2. Rewrite:
do while count<5
if name='DAVID'
name=name+fname
enddo
endif
as follows:
DO WHILE count<5
IF name='DAVID'
name=name+fname
ENDIF
ENDDO
3. Consider the following simple program:
IF num=1
name='DAVID'
ELSE
IF num=2
name='GEORGE'
ELSE
IF num=3
name='TOM'
ELSE
name='UNKNOWN'
ENDIF
ENDIF
ENDIF
IF SRI VPI VPIN IF
SR-Info/VP-Info Reference Manual Page 239 SECTION 4
This series of nested IF commands (often called "cascading IFs")
is equivalent to the following DO CASE structure:
DO CASE
CASE num=1
name='DAVID'
CASE num=2
name='GEORGE'
CASE num=3
name='TOM'
OTHERWISE
name='UNKNOWN'
ENDCASE
The DO CASE form is much easier to understand.
4. If <cond> must be a macro, use the following technique
instead:
cond2=' ' ;make sure cond2 exists
cond2=&condition ;assign macro to pre-existing variable
IF cond2 ;now IF does not have a macro
...
IF SRI VPI VPIN IF
SR-Info/VP-Info Reference Manual Page 240 SECTION 4
INDEX
Create an index file.
╔════════════════════════════════════════════════════════════════════╗
║ INDEX ON <str exp> TO <file> [FOR <cond>] ║
║ ║
║ <str exp> the expression providing the key ║
║ <file> the name of the index file ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ FOR <cond> a selction; only records for which <cond> is true are ║
║ included in the index. ║
╚════════════════════════════════════════════════════════════════════╝
The INDEX command creates an index file. Index files are used:
A. To organize records into an apparent order according to some
key for listing, reporting, browsing, editing, etc.
B. To locate records quickly using the FIND, POST and UPDATE
commands (and in VP-Info Professional by NEAREST, LAST and
SEEK). Each key must have a separate index file.
C. To make the file act as though it had only records matching
a given selection condition and had an apparent order
according to some key.
The expression <str exp> must evaluate to a string of length at
most 60; otherwise, an error message is sent. In addition, the
condition itself must be no more than 100 characters long.
(Do not use COMP for the first four letters of an index file;
SR-Info/VP-Info is unable to open such a file.)
Once an index file exists, the data file can be opened for use
with the index file; see the USE <data file> INDEX <index file>
command. The commands: APPEND, BROWSE, CHANGE, EDIT, REPLACE, READ
automatically update the index files in use. There can be many index
files in use, all are updated by these commands, but only one index
file works with FIND.
If SET TALK ON, INDEX will output progress reports showing the
completion of each 100 records, and the total number of records
indexed. Large files create temporary files which are then merged to
create the ultimate index.
Index expressions should be of type string, but a numeric field
(not a numeric expression) can also be used. If you wish to index on
a numeric expression, use the key STR(<num exp>) or PIC(<num exp>,
INDEX ON SRI VPI VPIN INDEX ON
SR-Info/VP-Info Reference Manual Page 241 SECTION 4
<format)) to convert the values to strings. See the functions STR(
and PIC(.
It is often helpful to use the upper-case functions, !( or
UPPER(, for string expression that mix upper-case letters and lower-
case letters, such as names, addresses, and so on. This way, the data
is arranged in alphabetical order instead of the ASCII code order
which is often confusing. See the functions CHR( and RANK(.
On a network with SET NETWORK ON in VP-Info Professional Network
Edition, attempting to create an index while another user is accessing
a file with the same name will cause a LOCK error.
See also the REINDEX command.
Examples:
1.
1>USE employee
1>FIND B
27. File is not indexed.
1>INDEX ON name TO employee
6 RECORDS IN TOTAL INDEXED
1>LIST name
2 Balzer
1 Marek
5 Poyner
4 Rayme
3 Steiner
6 Wilson
1>FIND R
1>DISP name
4 Rayme
Note that once the data file is indexed, you can use FIND.
2.
A data file has a numeric field AMOUNT containing numbers from 1
to 5,000; to index the file in decreasing order use the key:
STR(10000-amount,6)
3.
A mailing list has 50,000 records, including about 250 from Utah.
An efficient way to select and print a listing of all those in Utah
is:
USE maillist
INDEX ON SRI VPI VPIN INDEX ON
SR-Info/VP-Info Reference Manual Page 242 SECTION 4
INDEX ON zip TO utah FOR state='UT'
INDEX ON SRI VPI VPIN INDEX ON
SR-Info/VP-Info Reference Manual Page 242.1 SECTION 4
INDEX FROM
Create an index file, using the index key of an existing Info, dBASE
or Clipper index file.
╔════════════════════════════════════════════════════════════════════╗
║ INDEX FROM <filename> [TO <file>] [FOR <cond>] ║
║ ║
║ <filename> the name of an existing Info, dBASE or Clipper index ║
║ file ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <file> the name of the Info index file to be created with ║
║ the same key expression as <filename>; default is ║
║ same as original <filename> ║
║ FOR <cond> a selection; only records for which <cond> is true are ║
║ included in the index ║
╚════════════════════════════════════════════════════════════════════╝
The INDEX FROM command creates an index file using the index
expression of an existing index, even if the existing index is corrupt
or even from any version of dBASE (II, III, or IV) or Clipper. If no
new name is given with the TO clause, the original file is
overwritten.
Index files are discussed more fully in the Index TO command
below.
When making an index from one created in dBASE or Clipper, be
aware that some expressions from these languages are not permitted in
Info; if an invalid expression is encountered, an error message is
sent. In addition, the <cond> used with the optional FOR clause must
be no more than 100 characters long.
For users with existing applications which must be retained in
dBASE or Clipper, you may use the FILES ... ENDFILES structure to
point to data and index files in your dBASE or Clipper directory. To
avoid confusion between dBASE and Info index files, which both use the
default extension NDX, you will probably want to specify an extension
such as KEY in Info. See example 2 below for a program that uses a
FILES ... ENDFILES structure and the DIR( function to search for index
files in a dBASE directory to be used as templates for Info index
files using the same data files.
(Note: You may not use COMP for the first four letters of a data
or index file; Info is unable to open such a file with the USE
command.)
Once an index file exists, the data file can be opened for use
with the index file; see the USE <data file> INDEX <index file>
INDEX ON SRI VPI VPIN INDEX ON
SR-Info/VP-Info Reference Manual Page 242.2 SECTION 4
command. The commands: APPEND, BROWSE, CHANGE, EDIT, REPLACE, READ
automatically update the index files in use. There can be many index
files in use, all are updated by these commands, but only one index
file works with FIND.
If SET TALK ON and in Conversational Info, INDEX FROM will output
progress reports showing the completion of each 100 records, and the
total number of records indexed. Large files create temporary files
which are then merged to create the ultimate index.
On a network with SET NETWORK ON in VP-Info Professional Network
Edition, attempting to create an index while another user is accessing
a file with the same name will cause a LOCK error.
See also the INDEX ON and REINDEX commands.
Examples:
1.
1>USE employee
1>INDEX FROM emplnum TO emplnum
6 RECORDS IN TOTAL INDEXED
1>INDEX FROM emplnum
6 RECORDS IN TOTAL INDEXED
1>INDEX FROM emplnum TO empmarry FOR married
4 RECORDS IN TOTAL INDEXED
2.
An application written in dBASE keeps its data and index files in
C:\DATA. The following FILES ... ENDFILES structure is in the CNF
files executed when Info was started:
FILES
*.dbf,c:\data\
*.ndx,c:\data\
*.key,c:\info\key\
*.frm,c:\info\
ENDFILES
This allows the following program to work properly, assuming that
C:\DATA has no more than 60 data files and all index files share the
first four letters with the data file on which they are created (an
excellent practice):
INDEX ON SRI VPI VPIN INDEX ON
SR-Info/VP-Info Reference Manual Page 242.3 SECTION 4
─────────────────────────────────────────────────────────────────────────
**********************************************************************
* dBASEndx.prg demonstration program for the INDEX FROM command
* to allow automatic maintenance of INFO indexes with
* the same keys as the indexes dBASE itself maintains
* Note the use of DIRF command to display directory of files
* according to FILES table set by FILES ... ENDFILES structure
* Note also that all variables have an off prefix (qz_) as a
* safeguard against confusing INFO if a data file has a field
* name identical to a variable name (FNAME is frequent, QZ_FNAME
* is improbable)
* (C) 1990 Sub Rosa Publishing Inc. (Author: Sidney L. Bursten)
**********************************************************************
SET talk on ;so you can see the indexing in progress
WINDOW
ERASE
*name any data file in next line, so INFO compiler knows one will be opened
USE E:TRANS COMPILE
CLS
DIRF *.dbf ;get directory using FILES...ENDFILES structure
SCREEN 1,2 ;save directory as screen display
DO WHILE t
SCREEN 2,1 ;restore saved screen
? ' In entering file names, do not use period or extension'
ACCEPT 'Enter name of data file (RETURN only exits) ... ' to qz_fname
IF qz_fname=' '
@ 24,0 ;erase last line of screen
CANCEL ;end program
ENDIF
USE &qz_fname
CLS
qz_mask=TRIM(left(qz_fname,4))+'*.ndx' ;build search mask for DIRF
DIRF &qz_mask ;get directory using FILES...ENDFILES structure
SCREEN 1,3 ;store this screen, too
DO WHILE t
SCREEN 3,1 ;restore directory screen after every execution
? ' In entering file names, do not use period or extension'
ACCEPT 'Enter name of index file (RETURN only exits) ... ' to
qz_iname
IF qz_iname=' '
BREAK ;get back into outer loop for next data file
ENDIF
qz_iname=trim(qz_iname)
* add extension to output name so file goes into current directory
qz_kname=qz_iname+'.key'
INDEX FROM &qz_iname TO &qz_kname ;original file unchanged
WAIT ;pause to display results
ENDDO
ENDDO
─────────────────────────────────────────────────────────────────────────
INDEX ON SRI VPI VPIN INDEX ON
SR-Info/VP-Info Reference Manual Page 242.4 SECTION 4
When run, the program displays the appropriate files, inputs a file
name, and acts accordingly:
─────────────────────────────────────────────────────────────────────────
APPTEST.DBF 734 9-06-90 10:07p AVTEST.DBF 522 5-18-88 2:23p
BIGKEY.DBF 8798 6-12-88 8:59a BUG809.DBF 7347 8-09-90 9:46a
CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-91 5:11p
COMMS2.DBF 6342 1-07-91 1:00p CUSTJUNK.DBF 7062 9-17-90 3:57p
CUSTOMER.DBF 734 11-29-90 10:43p DB4.DBF 406 9-10-90 1:38p
EXPORT.DBF 635959 11-08-90 2:53p F1.DBF 1249 1-07-91 6:56p
F2.DBF 1187 1-07-91 6:56p F3.DBF 505 1-07-91 6:56p
FUNC.DBF 2832 1-07-91 7:38p FUNC2.DBF 258 1-07-91 7:33p
JOE.DBF 792 9-09-90 11:36a JUNK.DBF 43254 1-14-91 8:21p
JUNK2.DBF 5286 1-14-91 11:08a JUNK8.DBF 121 9-18-90 7:52a
JUNK9.DBF 1073 9-18-90 7:51a LONG.DBF 1137 7-17-90 11:26a
MATRIX.DBF 4130 9-04-90 1:50p MTEST.DBF 522 7-28-88 10:27a
NEWTEST.DBF 682 7-27-88 12:01p NEWTEXT.DBF 522 7-27-88 10:48a
PAINT2.DBF 4130 8-06-90 11:09a PAINT3.DBF 4130 8-06-90 11:10a
PAINTMEM.DBF 4130 8-06-90 11:09a POS1.DBF 12830 5-28-88 9:58a
PTEST.DBF 570 7-28-88 10:26a SEN.DBF 1 9-06-90 9:36a
SHARETST.DBF 6271 9-08-90 6:18p SID.DBF 18432 9-02-90 6:28p
SID2.DBF 66 6-03-88 11:38a TEST.DBF 3312 1-14-91 8:18p
TEST2.DBF 372 2-10-91 5:33p TESTTEST.DBF 2094 3-17-90 12:40p
THREE.DBF 189 6-12-88 9:21a TRANSACT.DBF 2 5-02-88 2:48p
VAITEST.DBF 552 7-28-88 12:32p HELP.DBF 234 4-08-91 4:47p
795837 bytes in 42 files.
1724416 bytes remaining.
? ' In entering file names, do not period or use extension'
Enter name of data file (RETURN only exits) ... customer
─────────────────────────────────────────────────────────────────────────
CUSTNAME.NDX 1028 11-30-90 5:36p CUSTNUM.NDX 1024 4-17-91 11:10a
CUST1.NDX 1028 3-19-91 6:51p CUST2.NDX 1028 3-19-91 6:51p
4108 bytes in 4 files.
1724416 bytes remaining.
? ' In entering file names, do not period or use extension'
Enter name of index file (RETURN only exits) ... cust2
4 RECORDS READ
4 RECORDS INDEXED
WAITING
─────────────────────────────────────────────────────────────────────────
INDEX ON SRI VPI VPIN INDEX ON
SR-Info/VP-Info Reference Manual Page 243 SECTION 4
INPUT
Input request for data of any type.
╔════════════════════════════════════════════════════════════════════╗
║ INPUT ['<string>'] TO <memvar> ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ '<string>' prompt message ║
╚════════════════════════════════════════════════════════════════════╝
The command INPUT is used to enter string, numeric, or logical
data into a memory variable, <memvar>. It works the same way as the
command ACCEPT (see ACCEPT), except that string input needs quotation
marks.
The type of the <memvar> is determined as follows:
If the data typed in is in quotation marks, it is a string;
<memvar> is of character type.
If the data is a number, <memvar> is of numeric type.
If the data is Y, y, N, n, T, t, F, or f, <memvar> is of logical
type.
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.
ACCEPT is the preferred way to enter strings, since ACCEPT does
not require quotation marks as delimiters.
<memvar> cannot be a matrix variable.
Examples:
1>INPUT 'Your name: ' TO name
Your name: 'Cathy'
1>INPUT 'Your age: ' TO age
Your age: 32
1>INPUT 'Are you telling the truth? ' TO truth
Are you telling the truth? n
1>LIST MEMO
Name Type Width Contents
NAME C 5 Cathy
AGE N 8 32
TRUTH L 2 .F.
INPUT SRI VPI VPIN INPUT
SR-Info/VP-Info Reference Manual Page 244 SECTION 4
** Total ** 3 variables, 15 bytes
The following illustrates use of a variable instead of a string
as the prompt:
1>prompt='"This is a prompt: "'
1>INPUT &prompt TO hello
This is a prompt: 4
1>LIST MEMORY
Name Type Width Contents
PROMPT C 20 "This is a prompt: "
HELLO N 8 4
** Total ** 2 variables... 28 bytes
INPUT SRI VPI VPIN INPUT
SR-Info/VP-Info Reference Manual Page 245 SECTION 4
LAST
Find the last record matching a given FIND string by its index in the
selected data file.
╔════════════════════════════════════════════════════════════════════╗
║ LAST <string> ║
║ VP-Info Professional only ║
║ ║
║ <string> the characters to match in the current master index ║
╚════════════════════════════════════════════════════════════════════╝
LAST is one of a family of commands that finds a record in an
indexed data file by matching a given string with key values in the
index file:
LAST positions the file on the last record in the index matching
the FIND string (VP-Info Professional only) (no-find
positions the file at the top of file)
FIND positions the file on the first record in the index matching
the LAST string (no-find positions the file at the top of
file)
NEAREST positions the file on the first record in the index equal
to or greater than the FIND string (VP-Info Professional
only)
SEEK is identical to FIND, except that it searches for the match
to the value of a character expression instead of a string
constant (VP-Info Professional only) (no-find positions the
file at the top of file)
All forms allow a search to be made on a character expression
when the expression if preceded by the macro symbol "&". When the
variable var='TAYLOR', both of the following command lines are
equivalent:
LAST TAYLOR
LAST &var
In Conversational SR-Info/VP-Info, just type LAST and the key.
Examples:
1>LAST TAYLOR
1>LAST TOM
If SET DELETE ON, deleted records will not be found. (See the
command SET.)
Numbers must always be treated as strings, even if the key
expression is a numeric field. If NUM is a numeric field of width 2,
LAST VPI VPIN LAST
SR-Info/VP-Info Reference Manual Page 246 SECTION 4
LAST 1 will not find 1, but LAST &STR(1,2) or LAST &' 1' will be
successful.
For the users' convenience, Conversational SR-Info/VP-Info
converts all command lines to upper case before execution. So, to
find the inventory numbers that start with AB, type either of the
following two commands:
1>LAST AB
1>LAST ab
It follows that
1>LAST Taylor
is understood by SR-Info/VP-Info as LAST TAYLOR. If you have to find
Taylor, either use the string directly with the macro symbol:
1>LAST &'Taylor'
or if name='Taylor' use the following:
1>LAST &name
In a SR-Info program, FIND the key in the file, use the LIMIT
command to limit the scope of all positioning commands to those
records matching the FIND string, and GOTO BOTTOM.
When LAST is successful, the value of the current record pointer
(as shown by the # and RECNO( functions) is set to the current record
number, and the system variable :NEAR is set to the same number.
If the record is not found, the current record pointer will be
set to 0 and the value of :NEAR will be set to the number of the first
record in the index with a key greater than the FIND string; if the
index contains no key greater than the FIND string, :NEAR is set to
the bottom of file, and EOF is set to T (true).
For a fuller discussion, see the FIND command.
LAST VPI VPIN LAST
SR-Info/VP-Info Reference Manual Page 247 SECTION 4
LIMIT
Limit the records available within the current master index to those
matching all or part of the current record's index key.
╔════════════════════════════════════════════════════════════════════╗
║ LIMIT <num exp> ║
║ LIMIT <key exp> ║
║ LIMIT ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <num exp> the number of characters in the key expression of ║
║ the current master index ║
║ <key exp> the string expression to match in the current master ║
║ index ║
╚════════════════════════════════════════════════════════════════════╝
When the current file has an index, SR-Info/VP-Info can be made
to treat the file as though it includes only those records matching
the current record's key expression, or some leftmost part of it.
When a LIMIT is in effect, no SR-Info/VP-Info command can access a
record outside that limit.
You can most quickly implement this command by using the
<num exp> option. The effect is to have SR-Info/VP-Info set the LIMIT
to the leftmost <num exp> characters of the key expression of the
master index.
If <num exp> exceeds the length of the key, the effect is
identical to setting the LIMIT to the entire index expression.
(Maximum index-key length is 60 characters.)
When LIMIT is used with no option, or when <num exp> is zero, the
limit is deactivated.
Using LIMIT with <key exp> requires precision in its use to avoid
problems that may become extremely serious. Note that the <key exp>
expression must be the same as the master index key in use at the
moment, or some LEFT( portion of it. Do not attempt to use an
expression that does not meet this requirement.
Cautions:
A. FIND should not be used on a file with an active limit. If
you choose to do so, be certain that the FIND will be
successful. An unsuccessful FIND places the record pointer
on record 0 which is by definition not in the index. This
causes an error, suspends operation of a program, and turns
off the LIMIT.
LIMIT SRI VPI VPIN LIMIT
SR-Info/VP-Info Reference Manual Page 248 SECTION 4
B. Do not use REPLACE ALL on a field included in an active
limit expression, since upon completion, no records will be
included in the limit; the result is the same as above.
C. Do not use APPEND, APPEND BLANK or BROWSE APPEND, or enter
"append mode" in EDIT, while a limit is active unless you
are sure to make all new records equal to the current LIMIT
key before leaving the new records. Doing so causes the
record pointer to move outside the LIMIT; the result is the
same as above.
D. LIMIT should be used with extreme care, and left in effect
for the minimum number of commands possible. For instance,
if used with BROWSE, LIMIT should be invoked immediately
before the BROWSE command and canceled immediately
afterward.
E. LIMIT is automatically canceled when the index or the file
with which it is active is closed, or the master index is
changed with SET INDEX TO n.
F. LIMIT cannot be used with a string constant instead of a
<key exp>. The <key exp> can be implemented with a macro.
LIMIT SRI VPI VPIN LIMIT
SR-Info/VP-Info Reference Manual Page 249 SECTION 4
LIST
List expressions from selected records.
╔════════════════════════════════════════════════════════════════════╗
║ LIST [<scope>] [FOR <cond>] [<exp list>] [OFF] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select by scope (default scope: ALL) ║
║ FOR <cond> select by condition ║
║ <exp list> items to list ║
║ OFF do not print the record numbers ║
╚════════════════════════════════════════════════════════════════════╝
This command lists the whole selected data file (including the
records flagged as DELETED, unless the command SET DELETE ON is
given). If the data file is indexed, the listing is by the indexed
order.
The records to be listed can be selected by scope and/or by a
condition. To list only selected fields of the records, use an
expression list.
Examples:
1>USE employee
1>LIST
1 Marek Joe 231 River Drive Broomsdale
2 Balzer Joan 2407 E 38th Street Broomsdale
3 Steiner Tom 114 North Pitt St. Lakewood
4 Rayme Pamela 42368 Wedgewood Dr. Broomsdale
5 Poyner Roger 2757 Regency Road Florington
6 Wilson Robert 16255 Ventura Street Broomsdale
1>GO TOP
1>LIST NEXT 3 fname,name
1 Joe Marek
2 Joan Balzer
3 Tom Steiner
LIST SRI VPI VPIN LIST
SR-Info/VP-Info Reference Manual Page 250 SECTION 4
LIST FILES
List files from the directory.
╔════════════════════════════════════════════════════════════════════╗
║ LIST FILES [LIKE <file format>] [ON <drive letter>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ LIKE <file format> limit to those files matching the file format ║
║ specification (default .DBF) ║
║ ON <drive letter> show only files on named disk (colon optional)║
╚════════════════════════════════════════════════════════════════════╝
This command lists the data files, with the default extension
DBF, from the current or other specified disk drive. LIST FILES is
provided only for compatibility with earlier versions of VP-Info; DIR
should be used instead.
If the LIKE clause is used, the type of file required can be
specified; the wild cards * and ? (see the DIR command) can be used
just as in the operating system command DIR.
If the ON <drive letter> clause is used, only the files from the
drive specified are listed.
See the SR-Info/VP-Info command DIR.
Examples:
1>LIST FILES
CCUST.DBF 1024 10-24-89 1:07a COMMS.DBF 1024 10-24-89 1:07a
COMMS.DBF 757 8-31-89 11:30p CUSTJUNK.DBF 653 9-06-89 9:02a
CUSTOMER.DBF 1024 10-24-89 1:07a RUST2.DBF 342058 11-29-89 8:25p
SUBDUE.DBF 2027 11-29-89 7:21p SUBDUE2.DBF 1168 11-29-89 2:29a
WAY_BUSI.DBF 506022 10-24-89 2:24a WAY_PHON.DBF 45525 10-24-89 1:29a
WAY_DBFS.DBF 1291 10-24-89 3:15a WAY_RES.DBF 406175 10-24-89 1:05a
1024349 bytes in 12 files.
5251072 bytes remaining.
LIST FILES SRI VPI VPIN LIST FILES
SR-Info/VP-Info Reference Manual Page 251 SECTION 4
1>LIST FILES ON A
THREE.DBF 189 6-12-88 9:21a TRANSACT.DBF 2 5-02-88 2:48p
VAITEST.DBF 552 7-28-88 12:32p
795603 bytes in 41 files.
51072 bytes remaining.
1>LIST FILE LIKE c*.*
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.
LIST FILES SRI VPI VPIN LIST FILES
SR-Info/VP-Info Reference Manual Page 252 SECTION 4
LIST MEMORY
List the memory variables.
╔════════════════════════════════════════════════════════════════════╗
║ LIST MEMORY ║
╚════════════════════════════════════════════════════════════════════╝
The command LIST MEMORY displays a listing of all non-matrix
memory variables and their contents, and a separate listing of the
matrix variables and their dimensions.
Examples:
1>LIST MEMO
Name Type Width Contents
** Total ** 0 Variables used 0 Bytes used
1>name='David'
1>number=12.78
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
NUMBER N 8 12.78
** Total ** 2 Variables used 13 Bytes used
1>DIM NUM a[12]
1>DIM CHAR table[2,12]
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
NUMBER N 8 12.78
Matrix Name Type Width Dimensions
A N 8 [12]
TABLE C 10 [2,12]
** Total ** 4 Variables used 33 Bytes used
Note that matrix variables are stored in high memory (see
Appendix A). The number of "bytes used" message does not take this
into account. To see the usage of high memory, use the STATUS
command. See also DIM.
LIST MEMORY SRI VPI VPIN LIST MEMORY
SR-Info/VP-Info Reference Manual Page 253 SECTION 4
LIST STRUCTURE
List the structure of the selected file.
╔════════════════════════════════════════════════════════════════════╗
║ LIST STRUCTURE ║
╚════════════════════════════════════════════════════════════════════╝
The command LIST STRUCTURE displays the structure of the selected
data file.
Examples:
1>USE employee
1>LIST STRU
Data file: EMPLOYEE.DBF
Number of records: 6
File number: 1
Field Name Type Width Dec
1 NAME C 15
2 FNAME C 10
3 ADDR C 20
4 CITY C 20
5 STATE C 2
6 ZIP C 5
7 TEL_NO C 8
8 MARRIED L 1
9 SALARY N 9 2
10 YEAR_EMP N 4
11 DEPT C 15
** Record Length ** 110
1>USE#5 order
1>LIST#5 STRU
Data file: ORDER.DBF
Number of records: 3
File number: #5
Field Name Type Width Dec
1 ORDER:NO C 6
2 CUST:NO C 6
3 INVEN:NO C 6
4 STYLE:NO C 4
5 COLOR C 2
6 CATEGORY C 2
7 DESCR C 30
8 SLSMAN:NO C 3
9 PRICE N 9 2
10 QTY N 9 2
11 COST N 9 2
12 AMOUNT N 9 2
** Record Length ** 96
LIST STRUCTURE SRI VPI VPIN LIST STRUCTURE
SR-Info/VP-Info Reference Manual Page 254 SECTION 4
LIST STRUCTURE SRI VPI VPIN LIST STRUCTURE
SR-Info/VP-Info Reference Manual Page 255 SECTION 4
LIST SYSTEM
List the function key definitions and system variables.
╔════════════════════════════════════════════════════════════════════╗
║ LIST SYSTEM ║
╚════════════════════════════════════════════════════════════════════╝
The command LIST SYSTEM displays the current contents of the 10
function keys and system variables (see Sections 1.2 and 2.6).
Example:
1>LIST SYST
Name Type Width Contents
:F1 C 5 HELP
:F2 C 10 LIST STRU;
:F3 C 6 WRITE
:F4 C 10 LIST MEMO;
:F5 C 7 BROWSE;
:F6 C 5 STAT;
:F7 C 12 ^wCONT;EDIT;
:F8 C 11 LOCATE FOR
:F9 C 5 FIND
:F10 C 5 EDIT;
:TIME C 8 22:53:43
:DATE C 24 Thursday, March 19, 1991
:VERSION C 4 510
:SERIAL C 10 5108796982
:COMPANY C 34 Sub Rosa Publishing Inc.
:PICTURE C 10 9999999.99
:TITLE C 1
:UNDOC C 1
:KEY N 8 13
:AVAIL N 8 0
:FIELD N 8 0
:ERROR N 8 0
:MESSAGE C 1
:RETRY N 8 25
:USER N 8 1
:DIR C 11 C:\VPI
:NEAR N 8 0
:COLOR N 8 48
** Total ** 28 variables... 244 bytes
To set the system variables to suit your needs, use the SRI.CNF
file or the VPI.CNF file as appropriate, see Section 1.
LIST SYSTEM SRI VPI VPIN LIST SYSTEM
SR-Info/VP-Info Reference Manual Page 256 SECTION 4
LOCATE
Search for a record that satisfies the condition.
╔════════════════════════════════════════════════════════════════════╗
║ LOCATE [<scope>] FOR <cond> ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <scope> search only within the scope (default scope: ALL) ║
╚════════════════════════════════════════════════════════════════════╝
The command LOCATE searches for records by a condition. This
command works quicker if there is no index file.
If a match is found with SET TALK ON,
Record n
informs the user of the record number (n).
The LOCATE command line cannot be more than 128 characters. The
keyword FOR cannot be in a macro.
The CONTINUE command continues the search after the current
record using the condition of the last LOCATE.
Normally, the selected file should not be indexed. The command
LOCATE executes about three time slower in an indexed file. If an
index file is in use, the search will take place in the indexed order.
The preferred way to locate a record in an indexed file is with
the FIND command.
With the default scope ALL, LOCATE starts at the top of file and
scans either until the first record matching the condition is found,
or the end of file is reached; an unsuccessful LOCATE sets the EOF
flag to T (true).
You can use an alternate scope, NEXT or WHILE, to have LOCATE
begin with the record after the current record. Unlike all other uses
of scope in SR-Info/VP-Info, however, LOCATE does not require anything
other than the keyword to make the scope act in this way. Example:
LOCATE NEXT FOR cust>'M' ;looks for a matching record anywhere in
the file, starting with the next record.
LOCATE WHILE FOR cust>'M' ;works exactly the same
Examples:
LOCATE FOR SRI VPI VPIN LOCATE FOR
SR-Info/VP-Info Reference Manual Page 257 SECTION 4
1>USE employee
1>LIST name, salary
1 Marek
2 Balzer
3 Steiner
4 Rayme
5 Poyner
6 Wilson
1>GO TOP
1>LOCATE FOR salary > 20000
Record 1
1>? name, salary
Marek 25800.00
1>CONT
Record 3
1>? name, salary
Steiner 35780.00
1>CONT
Record 4
1>? name, salary
Rayme 79110.00
1>CONT
Record 6
1>? name, salary
Wilson 33870.00
1>CONT
1>? EOF
T
LOCATE FOR SRI VPI VPIN LOCATE FOR
SR-Info/VP-Info Reference Manual Page 258 SECTION 4
LOCK
Lock the current record.
╔════════════════════════════════════════════════════════════════════╗
║ LOCK ║
║ VP-Info Professional Network Edition only ║
╚════════════════════════════════════════════════════════════════════╝
In VP-Info Professional Network Edition, this command locks the
current record to all other users so that you can safely make changes
to a record key while the file is open in SHARE mode.
If SET NETWORK OFF, LOCK is ignored.
In SR-Info and VP-Info Professional, LOCK has no effect, but is
accepted for program compatibility across versions.
See the SET NETWORK command on how to get into the multi-user
mode. See also UNLOCK.
Example:
mcust=cust
FIND &mcust
LOCK
LOCK VPIN LOCK
SR-Info/VP-Info Reference Manual Page 259 SECTION 4
LOCK INDEXES
Lock the current record.
╔════════════════════════════════════════════════════════════════════╗
║ LOCK INDEXES ║
║ VP-Info Professional Network Edition only ║
╚════════════════════════════════════════════════════════════════════╝
In VP-Info Professional Network Edition this command locks all
indexes attached to the current data file so that you can safely make
changes to a record's key while the file is open in SHARE mode.
Like the LOCK command (which locks records in a data file), and
SET LOCK ON (which automatically locks each record as it is used),
LOCK INDEX should be used only when files are opened in SHARE mode on
a network.
LOCK INDEXES allows only one person to change the index files,
though any number of others can access the indexes if they open the
data file in either SHARE or READ mode. UNLOCK INDEXES will unlock
the all the index file.
See the SET NETWORK command on how to get into the multi-user
mode. See also UNLOCK INDEXES.
In SR-Info and VP-Info Professional, LOCK INDEXES has no effect,
but is accepted for program compatibility across versions.
Example:
mcust=cust
FIND &mcust
LOCK INDEXES
LOCK INDEXES VPIN LOCK INDEXES
SR-Info/VP-Info Reference Manual Page 260 SECTION 4
LOOP
Jump to the top of the DO WHILE loop.
╔════════════════════════════════════════════════════════════════════╗
║ LOOP ║
╚════════════════════════════════════════════════════════════════════╝
When the LOOP command is found in a DO WHILE <cond> loop, program
execution jumps to the top of loop (evaluates the condition). See
also DO WHILE and BREAK.
Example:
USE cust
USE#2 trans INDEX trans1
DO WHILE T
ACCEPT 'Enter the customer number ' TO mcust
IF TRIM(mcust)=' '
BREAK
ENDIF
FIND#2 &mcust
IF RECNO(2)=0
LOOP
ENDIF
SELECT 2
DO WHILE custn=mcust .AND. .NOT. EOF
? date,descript,amount
SKIP
ENDDO
SELECT 1
ENDDO
LOOP SRI VPI VPIN LOOP
SR-Info/VP-Info Reference Manual Page 261 SECTION 4
MAX
Scan selected records for the highest values of one or more numeric
expressions.
╔════════════════════════════════════════════════════════════════════╗
║ MAX [<scope>] <num exp list> [TO <memvar list>] [FOR <cond>] ║
║ ║
║ <num exp list> the numeric expressions to sum ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select by scope (default scope: ALL) ║
║ <memvar list> store the results in these memory variables ║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
The command MAX evaluates numeric expressions for selected
records of the selected data file, determining the highest value
encountered for each expression. Up to 10 expressions can be scanned
with one command.
Optionally, the results can be stored in numeric memory
variables; the expression list and the numeric memory variable list
must have the same number of entries. <memvar list> cannot contain
numeric matrix variables.
Records flagged as DELETED are not scanned. See also MIN, SUM,
COUNT and AVERAGE.
Example:
The highest hourly wages, the highest annual earnings, and the
highest number of hours worked in the year:
1>USE employee
1>MAX hourly,ydt_earned,ytd_hours
6 RECORDS CHECKED
32.57, 51579.65, 2632.65
1>SET TALK OFF
1>MAX hourly,ydt_earned,ytd_hours TO maxrate,maxearned,maxhours
1>? maxrate,maxearned,maxhours
32.57 51579.65 2632.65
MAX SRI VPI VPIN MAX
SR-Info/VP-Info Reference Manual Page 262 SECTION 4
MEMORY=
Request a specific memory configuration for VP-Info Professional.
╔════════════════════════════════════════════════════════════════════╗
║ MEMORY=<blocks> ║
║ VP-Info Professional only VPI.SET file only ║
║ ║
║ <blocks> number of 1K blocks of memory to reserve for high memory ║
╚════════════════════════════════════════════════════════════════════╝
The command MEMORY= in the VPI.SET file allocates a specific
amount of high memory for use of VP-Info Professional rather than the
default of 128K.
The number of blocks can be as little as 32, although VP-Info
Professional can be expected to be sluggish in performance at that
level, and there will be little space available for matrixes and
background screens.
High memory is used for a wide variety of tasks in
SR-Info/VP-Info, including storage of index blocks, print spooling,
background screen storage, matrixes, table storage, program swap area,
etc. Requesting 32 to 127 blocks decreases the space available for
these tasks, but increases the space available for storing binary
files to be executed with the CALL command (see BINSPACE= command) and
for running programs in DOS (see RUN command).
If large amounts of memory are required for matrixes, you may
need to request more than 128 blocks. Requesting more memory than
available will not cause an error; VP-Info Professional always takes
all the memory there is or the amount requested, whichever is less.
See Appendix A for more about organization of memory.
Example:
MEMORY=96
MEMORY= VPI VPIN MEMORY=
SR-Info/VP-Info Reference Manual Page 263 SECTION 4
MIN
Scan selected records for the lowest values of one or more numeric
expressions.
╔════════════════════════════════════════════════════════════════════╗
║ MIN [<scope>] <num exp list> [TO <memvar list>] [FOR <cond>] ║
║ ║
║ <num exp list> the numeric expressions to sum ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select by scope (default scope: ALL) ║
║ <memvar list> store the results in these memory variables ║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
The command MIN evaluates numeric expressions for selected
records of the selected data file, determining the lowest value
encountered for each expression. Up to 10 expressions can be scanned
with one command.
Optionally, the results can be stored in numeric memory
variables; the expression list and the numeric memory variable list
must have the same number of entries. <memvar list> cannot contain
numeric matrix variables.
Records flagged as DELETED are not scanned. See also MAX, SUM,
COUNT and AVERAGE.
Example:
The lowest hourly wages, the lowest annual earnings, and the
lowest number of hours worked in the year:
1>USE employee
1>MIN hourly,ydt_earned,ytd_hours
6 RECORDS CHECKED
5.57, 1579.65, 232.65
1>SET TALK OFF
1>MIN hourly,ydt_earned,ytd_hours TO maxrate,maxearned,maxhours
1>? maxrate,maxearned,maxhours
5.57, 1579.65, 232.65
MIN SRI VPI VPIN MIN
SR-Info/VP-Info Reference Manual Page 264 SECTION 4
MODIFY
Modify the structure of a data file.
╔════════════════════════════════════════════════════════════════════╗
║ MODIFY [STRUCTURE] ║
╚════════════════════════════════════════════════════════════════════╝
The command MODIFY (or MODIFY STRUCTURE) modifies the structure
of the selected file. The display is the same as in CREATE, the keys
retain their meaning. Each field is represented by four editing
fields.
All records in the file will be automatically appended. If any
types or names are changed, the contents of the affected fields will
be lost.
Restrictions:
A. Do not use MODIFY in a program
B. Do not use MODIFY merely to change the name of a field.
Fields may be renamed instantaneously with the RENAME FIELD
command.
Editing keys:
<Left> or Ctrl-S moves the cursor back one character
<Right> or Ctrl-D moves the cursor forward one character
Ctrl-<Left> moves to the beginning of the editing field
Ctrl-<Right> moves to the end of the editing field
<Ins> 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 <Ins> or Ctrl-V again, puts
you back into overtype mode
<BACKSPACE> deletes the character to the left of the
cursor
<Del> or Ctrl-G deletes the character on the cursor
Ctrl-Y deletes the rest of the editing field
<Up> or Ctrl-E moves the cursor to the previous editing field
<Dn> or Ctrl-X moves the cursor to the next editing field
Ctrl-Q quits and does not modify the file
<End> or Ctrl-W quits and modifies the file
Ctrl-K moves back to the top of the previous page
Ctrl-L moves to the top of the next page
MODIFY SRI VPI VPIN MODIFY
SR-Info/VP-Info Reference Manual Page 265 SECTION 4
Ctrl-N inserts a new line
Ctrl-T deletes the line
To be safe, make a back up copy of the file to be modified before
the MODIFY command is given. After the MODIFY, the new fields will be
blank, the deleted fields disappear. All deleted records will also be
lost.
If <Esc> or Ctrl-Q is pressed at any time in MODIFY before the
appending of records is completed, MODIFY will be aborted and the data
file closed. No changes already made will be saved.
Changing the characteristics of a field (say the width) effects
the field the same way as in APPEND FROM.
On a network with SET NETWORK ON in VP-Info Professional Network
Edition, attempting to MODIFY an index while another user is accessing
a file with the same name will cause a LOCK error. Always open a file
in LOCK mode before modifying it.
Example:
Change the FNAME field in EMPLOYEE.DBF from 10 characters to 15
characters.
1>USE employee
1>COPY employee to temp making a backup copy
1>MODIFY
──────────────────────────────────────────────────────────────────────────────
Thursday, March 22, 1990
VP-Info Modify EMPLOYEE.DBF
Name Type Width Dec Name Type Width Dec
NAME C 15 0
FNAME C 10 0
ADDR C 20 0
CITY C 20 0
STATE C 2 0
ZIP C 6 0
TEL_NO C 10 0
MARRIED L 1 0
SALARY N 9 2
YEAR_EMP N 4 0
DEPT C 15 0
┌─────────────────────────────────────────────────────────────────────────────┐
│ UP/DOWN COLUMN MOVE ROW SAVE STRUCTURE C..Strings │
│ previous. <PgUp> left... ^K insert... ^N update... <End> N..Numbers │
│ next..... <PgDn> right.. ^L delete... ^T nochange. ^Q L..Yes/No │
└─────────────────────────────────────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────
MODIFY SRI VPI VPIN MODIFY
SR-Info/VP-Info Reference Manual Page 266 SECTION 4
Now change 10 to 15:
──────────────────────────────────────────────────────────────────────────────
Thursday, March 22, 1990
VP-Info Modify EMPLOYEE.DBF
Name Type Width Dec Name Type Width Dec
NAME C 15 0
FNAME C 15 0
ADDR C 20 0
CITY C 20 0
STATE C 2 0
ZIP C 6 0
TEL_NO C 10 0
MARRIED L 1 0
SALARY N 9 2
YEAR_EMP N 4 0
DEPT C 15 0
┌─────────────────────────────────────────────────────────────────────────────┐
│ UP/DOWN COLUMN MOVE ROW SAVE STRUCTURE C..Strings │
│ previous. <PgUp> left... ^K insert... ^N update... <End> N..Numbers │
│ next..... <PgDn> right.. ^L delete... ^T nochange. ^Q L..Yes/No │
└─────────────────────────────────────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────
MODIFY SRI VPI VPIN MODIFY
SR-Info/VP-Info Reference Manual Page 267 SECTION 4
MODIFY SRI VPI VPIN MODIFY
SR-Info/VP-Info Reference Manual Page 268 SECTION 4
NEAREST
Find the first record whose index key is equal to or greater than a
given FIND string by its index in the selected data file.
╔════════════════════════════════════════════════════════════════════╗
║ NEAREST <string> ║
║ VP-Info Professional only ║
║ ║
║ <string> the characters to match in the current master index ║
╚════════════════════════════════════════════════════════════════════╝
NEAREST is one of a family of commands that finds a record in an
indexed data file by matching a given string with key values in the
index file:
NEAREST positions the file on the first record in the index equal
to or greater than the FIND string (VP-Info Professional
only). If no key in the index is equal to or greater than
the FIND string, the current record pointer and :NEAR are
set to the bottom of file, and EOF is set to T (true)
FIND positions the file on the first record in the index matching
the LAST string (no-find positions the file at the top of
file)
LAST positions the file on the last record in the index matching
the FIND string (VP-Info Professional only) (no-find
positions the file at the top of file)
SEEK is identical to FIND, except that it searches for the match
to the value of a character expression instead of a string
constant (VP-Info Professional only) (no-find positions the
file at the top of file)
All forms allow a search to be made on a character expression
when the expression if preceded by the macro symbol "&". When the
variable var='TAYLOR', both of the following command lines are
equivalent:
NEAREST TAYLOR
NEAREST &var
In Conversational SR-Info/VP-Info, just type NEAREST and the key.
Examples:
1>NEAREST TAYLOR
1>NEAREST TOM
If SET DELETE ON, deleted records will not be found. (See the
command SET.)
Numbers must always be treated as strings, even if the key
expression is a numeric field. If NUM is a numeric field of width 2,
NEAREST VPI VPIN NEAREST
SR-Info/VP-Info Reference Manual Page 269 SECTION 4
NEAREST 1 will not find 1, but NEAREST &STR(1,2) or NEAREST &' 1' will
be successful.
For the users' convenience, Conversational SR-Info/VP-Info
converts all command lines to upper case before execution. So, to
find the inventory numbers that start with AB, type either of the
following two commands:
1>NEAREST AB
1>NEAREST ab
It follows that
1>NEAREST Taylor
is understood by SR-Info/VP-Info as NEAREST TAYLOR. If you have to
find Taylor, either use the string directly with the macro symbol:
1>NEAREST &'Taylor'
or if name='Taylor' use the following:
1>NEAREST &name
By definition, NEAREST is always successful (unless the file is
empty). If an exact match is found, both the current record pointer
(as shown by the # and RECNO( functions) and the system variable :NEAR
are set to the first matching record.
If an exact match is not found, the current record pointer and
the value of :NEAR will be set to the number of the first record in
the index with a key greater than the FIND string; if the index
contains no key greater than the FIND string, the current record
pointer and :NEAR are set to the bottom of file, and EOF is set to T
(true).
To position the record pointer to the record equal to or
immediately less than the FIND string, do the following:
NEAREST &findstring
IF keyexpr<findstring
SKIP -1
ENDIF
Note to SR-Info programmers: In a SR-Info program, you can
approximate the actions of NEAREST when FIND fails by shortening the
FIND string one character at a time until either the FIND is
successful or the FIND string disappears. For example, if the FIND
string is stored in VAR:
NEAREST VPI VPIN NEAREST
SR-Info/VP-Info Reference Manual Page 270 SECTION 4
finder2=finder
DO WHILE len(finder2)>0
FIND &finder2
IF #>0
BREAK
ENDIF
finder2=LEFT(finder2,LEN(finder2)-1)
ENDDO
IF #=0
GOTO TOP
ENDIF
For a fuller discussion, see the FIND command.
NEAREST VPI VPIN NEAREST
SR-Info/VP-Info Reference Manual Page 271 SECTION 4
NOEFFECTS
Suppress special effects.
╔════════════════════════════════════════════════════════════════════╗
║ NOEFFECTS ║
║ ║
║ VP-Info Professional only VPI.SET file only ║
║ ║
╚════════════════════════════════════════════════════════════════════╝
This command in the VPI.SET file suppresses the special screen
and sound effects used for the sign-on screen, as well as for the
SCREEN, SOUND, and RING commands.
Examples:
NOEFFECTS
NOEFFECTS VPI VPIN NOEFFECTS
SR-Info/VP-Info Reference Manual Page 272 SECTION 4
NOTE
Add notes to SR-Info/VP-Info programs.
╔════════════════════════════════════════════════════════════════════╗
║ NOTE [<string>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <string> any text line: the comment ║
╚════════════════════════════════════════════════════════════════════╝
This is the same as the command * (see *). Any SR-Info/VP-Info
command line that starts with NOTE is ignored by SR-Info/VP-Info.
Notes can also be added with semicolon(;) to any SR-Info/VP-Info
command line
Since notes are not compiled, they have no effect on the
execution of programs. Comments should be used liberally to help you
(and possibly others) understand your programs later. If programs are
very large, however, some comments may have to be shortened or
eliminated to allow the compiler and/or WRITE to load them properly.
Examples:
NOTE This is the start of the main menu display
IF cust=mcust ;the start of the processing for the current customer
NOTE SRI VPI VPIN NOTE
SR-Info/VP-Info Reference Manual Page 273 SECTION 4
NOUPDATE
Do not write changes made to the current record back to the disk.
╔════════════════════════════════════════════════════════════════════╗
║ NOUPDATE ║
╚════════════════════════════════════════════════════════════════════╝
Whenever a change is made to the current record in an open data
file, leaving the record or closing the file causes the changes to be
written to the disk. This automatic action can be overridden by the
NOUPDATE command, which tells SR-Info/VP-Info to ignore the changes.
This is essentially what happens when Ctrl-Q is pressed during
EDIT and BROWSE.
Example in a program:
Suppose full-screen editing is in effect with the READ command,
and you want to ignore any changes made to the record if the user
presses Ctrl-Q or an erroneous key like Ctrl-T and Ctrl-U. Using the
:KEY system variable that stores the key number of the key pressed to
terminate the last process:
DO WHILE t
READ
IF :key=17 .OR. :key=20 .OR. :key=21 ;key numbers of ^Q, ^T and ^U
NOUPDATE
LOOP
ENDIF
DO CASE
CASE :key=... ;check a key
... ;action based on :key value
ENDCASE
ENDDO
NOUPDATE SRI VPI VPIN NOUPDATE
SR-Info/VP-Info Reference Manual Page 274 SECTION 4
ON ERROR
Tell SR-Info/VP-Info what to do if an error is encountered during
program execution.
╔════════════════════════════════════════════════════════════════════╗
║ ON ERROR ║
╚════════════════════════════════════════════════════════════════════╝
The command ON ERROR starts the ON ERROR/ENDON structure. There
can be any program segment between ON ERROR and ENDON, except that no
data files should be opened or closed, and no new variables created or
released. This program segment is executed whenever the program
encounters an error.
The ON ERROR is in effect in the program from the point where it
is located. It remains in effect until another ON ERROR structure is
found, or until execution leaves the current module, either on a
RETURN or DO command.
ON ERROR has no effect within a subroutine called by the DO
command; if the subroutine needs the same ON ERROR structure, repeat
the structure in the subroutine.
Since the ON ERROR structure has no effect after returning to a
calling program from a subroutine, you should consider putting this
structure (possibly together with the ON ESCAPE structure) into a
procedure that is performed at the beginning of the program, and after
every DO command.
ON ERROR should normally include a RETURN, CHAIN, CANCEL, or QUIT
command to allow execution to leave the current program. Do not
RETURN from a main return, or CHAIN from a subroutine.
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.
Example:
ON ERROR
? 'Aborting program execution because Error',:error,'encountered'
? :message ; :error contains the latest error number, and
? ; :message contains its meaning
RING
CANCEL
ENDON
ON ERROR SRI VPI VPIN ON ERROR
SR-Info/VP-Info Reference Manual Page 275 SECTION 4
ON ESCAPE
Tell SR-Info/VP-Info what to do if the user presses <Esc>.
╔════════════════════════════════════════════════════════════════════╗
║ ON ESCAPE ║
╚════════════════════════════════════════════════════════════════════╝
The command ON ESCAPE starts the ON ESCAPE/ENDON structure.
There can be any program segment between ON ESCAPE and ENDON, except
that no data files should be opened or closed, and no new variables
created or released. This program segment is executed whenever the
user presses <Esc>.
The ON ESCAPE is in effect in the program from the point where it
is located. It remains in effect until another ON ESCAPE structure is
found, or until execution leaves the current module, either on a
RETURN or DO command.
ON ESCAPE has no effect within a subroutine called by the DO
command; if the subroutine needs the same ON ESCAPE structure, repeat
the structure in the subroutine.
Since the ON ESCAPE structure has no effect after returning to a
calling program from a subroutine, you should consider putting this
structure (possibly together with the ON ERROR structure) into a
procedure that is performed at the beginning of the program, and after
every DO command.
ON ESCAPE should normally include a RETURN, CHAIN, CANCEL, or
QUIT command to allow execution to leave the current program.
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.
Example:
ON ESCAPE
? 'Aborting program execution because <Esc> key pressed.'
RING
CANCEL
ENDON
ON ESCAPE SRI VPI VPIN ON ESCAPE
SR-Info/VP-Info Reference Manual Page 276 SECTION 4
ON FIELD
Control the processing of data input during execution of the full-
screen editing commands: READ, EDIT, APPEND, and BROWSE.
╔════════════════════════════════════════════════════════════════════╗
║ ON FIELD ║
╚════════════════════════════════════════════════════════════════════╝
The command ON FIELD starts the ON FIELD/ENDON structure. There
can be any program segment between ON FIELD and ENDON, except that no
data files should be opened or closed, and no new variables created or
released.
Inside the ON FIELD structure is a number of FIELD statements,
each telling SR-Info/VP-Info what to do when the user leaves a
specific field, enters a new record, or leaves the record. There can
be one FIELD statement for each input field in a Get Table, in
addition to the two FIELD statements controlling entry and exit from
READ (or the current record in EDIT and BROWSE).
(Note that the term editing field does not refer in this case
only to fields, but to the on-screen area where you're expected to
enter or edit data; an editing field may be a "window into" a data-
file field, a memory variable, or a system variable. An element in a
matrix cannot be accessed with the full-screen editing commands, so
cannot be tied to an editing field.)
ON FIELD is used primarily for the following three functions:
A. To verify data input. If the value entered does not meet a
condition, the cursor can be directed back to the current
field with the :FIELD=FIELD(fieldname) command.
B. To do data lookups from the selected or other files. For
example, suppose the first field in the screen is mcust;
when a customer number is entered FIND &mcust is executed
and the proper record found in the current file. If an
invoice number is entered, data can be retrieved from the
proper invoice with a FIND into another indexed file.
C. To change the order in which the cursor goes to the next
field. For example, a TEXT can have three columns of input
figures; SR-Info/VP-Info normally goes left to right on each
line, and then top to bottom, but appropriate use of the
:FIELD system variable can direct the cursor to do one
column at a time.
The form of the ON FIELD structure:
ON FIELD SRI VPI VPIN ON FIELD
SR-Info/VP-Info Reference Manual Page 277 SECTION 4
ON FIELD
FIELD 0
<initiating command sequence> ;The FIELD 0 code is executed when
READ is entered or whenever a new
record is entered in BROWSE OFF,
EDIT OFF, etc.
Field 1
<command sequence 1> ;The FIELD 1 code is executed when
the cursor leaves the first
editing field (and again when the
current record is exited provided
SET EXECUTE ON).
Field 2
<command sequence 2> ;The FIELD 2 code is executed when
the cursor leaves the second
editing field (and again when the
current record is exited provided
SET EXECUTE ON).
Field <n>
<command sequence <n>> ;The FIELD <n> code is executed
when the cursor leaves the nth
(final) editing field (and again
when the current record is exited
provided SET EXECUTE ON).
Field 65
<command sequence 65> ;The FIELD 1 code is executed when
the cursor leaves READ or when
the current record is exited in
BROWSE OFF, EDIT OFF, etc.
ENDON
Fields 1 through 64 may be referenced either by number of by the
name of the field or variable being edited. Names are usually more
understandable and always more flexible, since a field can later be
added or omitted without having to renumber the entire ON FIELD
structure.
You can force SR-Info/VP-Info to execute the entire set of FIELD
commands from 1 through 64 by SET EXECUTION ON. The default is OFF.
Do not use ON if there is a possibility of creating an endless loop
which doesn't allow a graceful exit.
The Get Table is usually canceled as soon as execution leaves the
current program, even when just executing a subroutine with the DO
command. You can SET GET ON to maintain the Get Table, provided it is
not cleared in the sub-program. (A Get Table is cleared either with
the CLEAR GETS command, or by creating a GET with TEXT or an @ GET
command after a READ command.) The default is SET GET OFF.
ON FIELD SRI VPI VPIN ON FIELD
SR-Info/VP-Info Reference Manual Page 278 SECTION 4
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.
Example:
date1=date(1)
CLS
TEXT
.. date1,99/99/99
Enter game date (must be a Wednesday)
@date1
ENDTEXT
ON FIELD
FIELD date1
IF DATE(FULL,date1)<>"W"
:field=FIELD(date1) ;use FIELD( to get correct number
ENDIF
ENDON
DO WHILE t
READ
<command modules>
ENDDO
Note the placement of the three elements: the TEXT with its input
macro and the ON FIELD come before the READ or other full-screen
editing command, and are usually outside the DO WHILE loop unless the
screen is rewritten elsewhere inside the loop.
ON FIELD SRI VPI VPIN ON FIELD
SR-Info/VP-Info Reference Manual Page 279 SECTION 4
OTHERWISE
Introduce the optional clause in a DO CASE program structure.
╔════════════════════════════════════════════════════════════════════╗
║ OTHERWISE ║
╚════════════════════════════════════════════════════════════════════╝
In a DO CASE program structure, if no condition is true,
SR-Info/VP-Info executes the program segment following the OTHERWISE
command, if any. Only one OTHERWISE command is permitted within any
DO CASE structure; it is equivalent to CASE t (true).
See under DO CASE.
OTHERWISE SRI VPI VPIN OTHERWISE
SR-Info/VP-Info Reference Manual Page 280 SECTION 4
OVERWRITE TO
Copy the fields from a record in one data file directly into the
current record of another data file.
╔════════════════════════════════════════════════════════════════════╗
║ OVERWRITE TO [<filenum>] ║
║ VP-Info Professional only ║
║ ║
║ <filenum> any number of the data file containing the record to ║
║ be overwritten ║
╚════════════════════════════════════════════════════════════════════╝
The OVERWRITE TO command is primarily used to implement
transaction processing and to avoid lengthy record locks while records
are being edited in a network environment. Its companion command is
APPEND TO.
The technique in both cases is essentially the same, utilizing a
main, indexed file and a small, unindexed personal file for each
operator.
The operator edits only in the personal file, adding records as
required and verifying that everything is correct before moving the
data back into the main file. If the records already exist in the
main file, OVERWRITE TO is used to put the corrected records back
where they came from; if new records were appended to the personal
file, APPEND TO is used to add them to the end of the main file.
The two files do not need to have the same structures. Any
fields which do not exist in both files will be unaffected; any that
are smaller in one than the other create risks of losing some data due
to string truncation or numeric overflow.
Executing OVERWRITE TO is much faster than a long series of
REPLACE commands.
Example in a program with SET NETWORK ON (VP-Info Professional
Network Edition only):
USE customer INDEX custnum,custname SHARE
USE#2 personal
SET FUNCTION OFF
DO WHILE t
SET SAVE OFF
EDIT TEXT customer ;use formatted EDIT
OVERWRITE TO VPI VPIN OVERWRITE TO
SR-Info/VP-Info Reference Manual Page 281 SECTION 4
IF usedby<>0
WINDOW 20,30,22,75 DOUBLE ;pop up a window for message
recnum=RECNO(1)
TEXT
.. recnum,'999,999'
.. usedby,999
Record &recnum is in use by user &usedby
Press any key to skip to next record...
ENDTEXT
junk=INKEY() ;wait to keystroke
SKIP
LOOP
ENDIF
IF :key=324 ;F10 means edit this record
REPLACE usedby with :USER ;mark record as in use by you
OVERWRITE TO 2 ;then move into personal file
SELECT 2 ;select personal file
SET SAVE ON ;allow changes to be saved
CLS ;clear the screen
TEXT custedit ;with "CHANGES PERMITTED" message
READ
WINDOW 20,30,22,75 DOUBLE ;pop up a window for confirmation
ans='No '
recnum=RECNO(1)
TEXT
.. recnum,'999,999'
..,ans,!xx
Changes may have been made to record #recnum
Save all changes (Yes/No) @ans
ENDTEXT
IF ans='Y'
OVERWRITE to 1
ENDIF
REPLACE usedby with 0 ;free the record for other users
ENDIF
ENDDO
OVERWRITE TO VPI VPIN OVERWRITE TO
SR-Info/VP-Info Reference Manual Page 282 SECTION 4
PACK
Remove deleted records from the selected file.
╔════════════════════════════════════════════════════════════════════╗
║ PACK [TRUNCATE] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ TRUNCATE reduce the DOS size of the file ║
╚════════════════════════════════════════════════════════════════════╝
This command removes records that have been marked for deletion
by the DELETE command or the Ctrl-U of the EDIT and BROWSE commands.
All the index files in use are automatically reindexed after
PACK. (See INDEX and REINDEX.)
Make sure you have a back up copy of the file before packing it.
If PACK is interrupted, the file may be corrupt or contain duplicate
records.
PACK does not release disk space unless the TRUNCATE option is
used. If a file frequently gets large, has many records deleted and
then grows again, it may be more efficient to PACK without TRUNCATE,
so that DOS is not constantly adding disk clusters and recovering them
again.
On a network with SET NETWORK ON in VP-Info Professional Network
Edition, attempting to PACK or create an index while another user is
accessing the data file or an index file with the same name as any of
the current indexes will cause a LOCK error. Always LOCK the data
file before attempting to PACK.
Examples:
1>USE employee
1>GO 2
1>DELETE
1 DELETE(S)
1>LIST name
1 Marek
2 *Balzer
3 Steiner
4 Rayme
5 Poyner
6 Wilson
1>PACK
5 TOTAL PACKED
1>LIST name
PACK SRI VPI VPIN PACK
SR-Info/VP-Info Reference Manual Page 283 SECTION 4
1 Marek
2 Steiner
3 Rayme
4 Poyner
5 Wilson
PACK SRI VPI VPIN PACK
SR-Info/VP-Info Reference Manual Page 284 SECTION 4
PERFORM
Execute a procedure.
╔════════════════════════════════════════════════════════════════════╗
║ PERFORM <procedure> ║
║ ║
║ <procedure> the name of the procedure ║
╚════════════════════════════════════════════════════════════════════╝
The command PERFORM is used to execute a procedure, <procedure>,
defined in the current program; <procedure> cannot be a macro. The
procedure is defined with the PROCEDURE command (see PROCEDURE).
The procedure is compiled where it is first called with PERFORM.
If the procedure makes references to fields, the structure and order
of the files in use must be the same any time the procedure is used.
The same comment also applies to memory variables. Normally,
procedures perform tasks that are independent of the environment
(files in use and memory variables) or they are always invoked in the
same environment.
If you need the same procedure in different environments, write
the procedure as a separate program, and invoke it as a subroutine
with the DO command. See the command DO.
Performing procedures is a very fast way of executing the same
program segment from many places in the program. The procedures
themselves must be at the end of the program.
Example:
PERFORM header
DO WHILE .NOT. EOF
...
line=line+1
IF line>55
PERF header
ENDIF
ENDDO
CHAIN menu
PERFORM SRI VPI VPIN PERFORM
SR-Info/VP-Info Reference Manual Page 285 SECTION 4
PROCEDURE header
TEXT
&:DATE &:COMPANY Page &page
Sales Journal
Date Invoice # Description Units Dollars
ENDTEXT
line=6
ENDPROCEDURE
PERFORM SRI VPI VPIN PERFORM
SR-Info/VP-Info Reference Manual Page 286 SECTION 4
POST
Post the FROM (transaction) file to the POSTING file (selected file
with index).
╔════════════════════════════════════════════════════════════════════╗
║ POST ON <str exp> FROM <file> [FIELDS <mixed field list>] [<scope>]║
║ [FOR <cond>] ║
║ ║
║ <str exp> the expression that is the key for finding the records ║
║ in the FROM file ║
║ <file> the FROM file ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ FIELDS <mixed field list> the fields to be totalled in the ║
║ FROM file and added to the fields ║
║ in the POSTING file (the selected file); ║
║ <field> WITH <num exp> can add an expression ║
║ <scope> selection restricted by scope ║
║ (default scope: ALL) ║
║ FOR <cond> selection restricted by <cond> ║
╚════════════════════════════════════════════════════════════════════╝
The selected file, called the POSTING file, must be indexed by
<str exp>, an expression formed from fields of the FROM file, called
the FROM file, and constants and memory variables.
This procedure takes all the appropriate records (that is, the
first record satisfying the <cond> and within the scope) of the FROM
file, one at a time. It picks the first appropriate record, and
evaluates <str exp> in the FROM file. Next it finds the matching
record in the POSTING file. If the find is not successful, an error
message POST ERROR" is sent.
If the find is successful, the procedure posts. Posting consists
of one of two actions, depending on whether a field name is listed
alone in the mixed field list, or if a field name has a WITH clause
attached.
A. If the field is named alone, the value of that field in the
FROM file is added to the value already in the POSTING
file.; that is, it adds the fields in the <field list> of
the current record of the FROM file to the fields of the
same name in the current record of the POSTING file.
B. In a mixed field list, the clause <field> WITH <num exp>
allows adding any numeric expression <field> to the field in
the POSTING file. <num exp> is formed using the fields of
the FROM file, and optionally fields from other files
(including the POSTING file), variables, and constants.
POST SRI VPI VPIN POST
SR-Info/VP-Info Reference Manual Page 287 SECTION 4
If a find is unsuccessful and SET ADD ON, a record will be
appended to the POSTING file, the non-numeric fields of the POSTING
file record will be replaced by the matching fields in the FROM file
record, and, finally, the procedure posts as above.
The procedure continues with the next appropriate record of the
FROM file.
If there is no FIELDS clause, POST simply checks whether there is
a record in the POSTING file for each value of <str exp> in the FROM
file. This is valuable to check whether every record in the FROM file
has a matching record in the POSTING file without changing any fields.
If SET PRINT OFF (the default), the error messages appear on the
screen; otherwise, they are echoed to (printed on) the printer (or to
the alternate text file, if SET ALTERNATE ON).
Deleted records are not posted, irrespective of SET DELETED.
Important programming note: The POST 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 POST 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 POST command. If it is not actually needed after the POST
is executed (e.g., the program exits after the POST), open it with the
COMPILE keyword. Example:
USE#4 invoices COMPILE
See also the related commands: TOTAL and UPDATE.
Example:
Use the data files SALESMEN and ORDER (see Appendix), to record
the amount of merchandise sold.
1>SET TALK ON
1>USE salesmen
1>INDEX ON slsman:no TO salesmen
2 RECORDS IN TOTAL INDEXED
1>POST ON slsman:no FROM order FIELDS amount FROM order
2 ** POST ERROR ** 4
5 POST(S)
1>LIST
1 1 Smith John 4386.00
2 5 Willson Tom 14679.50
POST SRI VPI VPIN POST
SR-Info/VP-Info Reference Manual Page 288 SECTION 4
The error message POST ERROR indicates that in the ORDER file
there is a record (number 2) with a salesman code ("4") not found in
the SALESMEN file.
Note that the amount for Smith is 2709.00 (the amount that was in
the SALESMEN file) +1677.00 (the amount in ORDER record 5).
The amount for Willson is 12089.00 (the amount that was in the
SALESMEN file) +597.50 (the amount in order 1) +559.00 (the amount in
order 3) +1434.00 (the amount in order 4).
Of course, the most typical example of the use of the command
POST is posting to a general ledger (the POSTING file) from a journal
(the transaction file).
POST SRI VPI VPIN POST
SR-Info/VP-Info Reference Manual Page 289 SECTION 4
PROCEDURE
Procedure (subroutine) definition.
╔════════════════════════════════════════════════════════════════════╗
║ PROCEDURE <procedure> ║
║ ║
║ <procedure> the name of the procedure ║
╚════════════════════════════════════════════════════════════════════╝
The PROCEDURE command indicates the start of a procedure
definition, the ENDPROCEDURE command indicates the end of the
procedure:
PROCEDURE <procedure>
<program segment>
ENDPROCEDURE
Procedures should be used for all SR-Info/VP-Info program
segments that are used more than once in a program. However, if the
procedure makes references to fields, the structure and order of the
files in use must be the same any time the procedure is used. The
same comment also applies to memory variables. Normally, procedures
perform tasks that are independent of the environment (files in use
and memory variables) or they are always invoked in the same
environment.
If the whole program will not fit in memory, then replace the
procedures by subroutines invoked by the DO command. (See CHAIN,
PERFORM, PROCEDURE.
The procedure name, <procedure>, follows the same rules as
variable names (see Section 2); <procedure> cannot be a macro.
Procedures must be placed at the end of the program. A procedure can
perform other procedures.
A procedure is compiled at the first PERFORM invoking it. (See
Example 1 in Appendix A)
Hint: If the same procedure must be used in more than one
subroutine, add a digit (1, 2, 3, etc.) to the name in the various
subroutines. Example: if a procedure called BELL is needed in main
program ENTER and subroutines ENTER1 and ENTER2, call it BELL, BELL1
and BELL2 in the three program modules respectively.
Examples:
1. A simple label printing procedure.
INPUT 'Enter the number of labels to print ' TO nlabel
PROCEDURE SRI VPI VPIN PROCEDURE
SR-Info/VP-Info Reference Manual Page 290 SECTION 4
REPEAT nlabel TIMES
PERFORM label
SKIP
ENDREPEAT
PROCEDURE SRI VPI VPIN PROCEDURE
SR-Info/VP-Info Reference Manual Page 291 SECTION 4
PROCEDURE label ; prints 5 lines of data and 4 blank lines
? name ; on standard labels one across
? add:1
? add:2
? add:3
? postal
?
?
?
?
ENDPROCEDURE ; end of label printing
2. A procedure to clear screen, make border, set standard
heading, and create reverse video black for menu choices. This
procedure would be called before any menu display in the program.
PROCEDURE MENUSCREEN
ERASE
WINDOW 2,1,23,77 DOUBLE
COLOR 112, 6, 4, 22, 74
@ 3,0 SAY CEN(:COMPANY, 80)
@ 5,0 SAY CEN('Enter your choice below:',80)
ENDPROCEDURE menuscreen
PROCEDURE SRI VPI VPIN PROCEDURE
SR-Info/VP-Info Reference Manual Page 292 SECTION 4
QUIT
Leave SR-Info/VP-Info.
╔════════════════════════════════════════════════════════════════════╗
║ QUIT [<errorlevel>] ║
║ ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ <errorlevel> a value passed to DOS, which allows batch files ║
║ to control their execution with the ║
║ IF ERRORLEVEL command ║
╚════════════════════════════════════════════════════════════════════╝
The command QUIT exits from SR-Info/VP-Info. It closes all the
files and gives you the prompt of the operating system.
If SR-Info/VP-Info is running unattended in a batch file, a
program can pass an "errorlevel" to DOS indicating if some condition
was encountered during execution. For instance, if there is an error
reading a data file, you can QUIT to DOS with an errorlevel of 1,
which the batch file can detect so that the tape backup is not run.
The command in this case wound be QUIT 1. Consult your DOS reference
manual for the IF ERRORLEVEL batch program command.
Example:
DO CASE
CASE ans='0'
QUIT
CASE ans='2'
CHAIN prog1
...
OTHERWISE
QUIT 1 ;tells DOS an error encountered by SR-Info/VP-Info
ENDCASE
QUIT SRI VPI VPIN QUIT
SR-Info/VP-Info Reference Manual Page 293 SECTION 4
READ
Enter full-screen editing and data entry specified by the @ GET and
TEXT commands.
╔════════════════════════════════════════════════════════════════════╗
║ READ ║
╚════════════════════════════════════════════════════════════════════╝
The READ command activates the input aspect of the @ GET commands
(including the @ and % macros in a TEXT). The @ GET command displays
the variable at the specified location and format. The READ command
puts the screen in full-screen editing mode with the current values of
all fields and memory variables shown, and the new values of all the
variables in the @ GET (and the @ and % macros in TEXT) commands can
be entered.
If the READ changes any key of a record in an index file in use,
then the index files are updated.
The READ command clears all the pending GET commands.
Example:
@ SAY 20,0 'Enter your choice: ' GET ans
READ
is the same as:
ACCEPT 'Enter your choice: ' TO ans
except that @ SAY does not create ANS, ACCEPT does; @ SAY directs the
query to a specific location on the screen.
READ SRI VPI VPIN READ
SR-Info/VP-Info Reference Manual Page 294 SECTION 4
RECALL
Undelete selected deleted records in the selected file.
╔════════════════════════════════════════════════════════════════════╗
║ RECALL [<scope>] [FOR <cond>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select by scope (default scope: current record) ║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
Records are flagged as DELETED either with Ctrl-U in BROWSE, or
EDIT, or with the DELETE command (see the commands BROWSE, DELETE, and
EDIT). The command RECALL reverses the DELETED flag.
The command PACK physically removes all records flagged for
deletion. After a PACK, the records can no longer be recalled.
Note that if SET DELETE ON, then RECALL will work only on a
deleted record only if it is also the current record. Normally SET
DELETE OFF before using RECALL.
Examples:
1>USE employee
1>GO 2
1>DELETE
1 DELETE(S)
1>LIST name
1 Marek
2 *Steiner
3 Rayme
4 Poyner
5 Poyner
6 Wilson
1>GO 2
1>RECALL
1 RECALL(S) ;record 2 was recalled
1>RECALL ;the default is the current record
0 RECALL(S)
1>DELETE RECORD 2
1 DELETE(S)
1>DELETE RECORD 4
1 DELETE(S)
1>DELETE RECORD 6
1 DELETE(S)
1>RECALL ALL
3 RECALL(S) Note: Records 2, 4, 6 are recalled
RECALL SRI VPI VPIN RECALL
SR-Info/VP-Info Reference Manual Page 295 SECTION 4
1>GO TOP
1>DELETE
1 DELETE(S)
1>DELETE RECORD 3
1 DELETE(S)
1>DELETE RECORD 5
1 DELETE(S)
1>LIST name
1 *Marek
2 Steiner
3 *Rayme
4 Poyner
5 *Poyner
6 Wilson
1>GO TOP
1>RECALL NEXT 4
2 RECALL(S) Note: Records 1 and 3 are recalled
RECALL SRI VPI VPIN RECALL
SR-Info/VP-Info Reference Manual Page 296 SECTION 4
REINDEX
Reindex all index files in use.
╔════════════════════════════════════════════════════════════════════╗
║ REINDEX [FOR <cond>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
This command takes all the index files currently in use for the
selected data file, and rebuilds each index file.
In Conversational SR-Info/VP-Info, and in programs with SET TALK
ON, REINDEX will output the key, the progress of the indexing
procedure, showing the completion of each 100 records, and the total
number of records indexed.
A FOR clause can be used to limit the records in the index(es) to
those for which <cond> is true. See INDEX.
On a network with SET NETWORK ON in VP-Info Professional Network
Edition, attempting to REINDEX while another user is accessing an
index file with the same name as one of the current file's indexes
will cause a LOCK error.
Examples:
The commands:
1>USE employee
1>INDEX on name+fname TO employee
accomplish the same as the following:
1>USE employee INDEX employee
1>REINDEX
Note that for REINDEX, you do not have to specify the key
(name+fname) or the name of the index file (EMPLOYEE.NDX).
In a program:
USE employee INDEX employee,empl1,empl2
REINDEX
will rebuild three index files: EMPLOYEE.NDX,EMPL1.NDX,EMPL2.NDX.
REINDEX SRI VPI VPIN REINDEX
SR-Info/VP-Info Reference Manual Page 297 SECTION 4
The following uses a FOR clause to limit the index to current
employee only, based on date of termination being blank:
USE employee INDEX employee,empl1,empl2
REINDEX FOR terminated=' '
REINDEX SRI VPI VPIN REINDEX
SR-Info/VP-Info Reference Manual Page 298 SECTION 4
RELEASE
Erase memory variables.
╔════════════════════════════════════════════════════════════════════╗
║ RELEASE [<memvar list>/EXCEPT <memvar list>/ALL] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <memvar list> the memory variables to be released, ║
║ separated by commas ║
║ EXCEPT <memvar list> the memory variables not to be released, ║
║ separated by commas ║
║ ALL release ALL ║
╚════════════════════════════════════════════════════════════════════╝
The command RELEASE erases memory variables; it releases memory
space for new memory variables. You can make a list of the memory
variables you want removed, use the parameter ALL to remove them all,
or use the parameter EXCEPT <memvar list> to remove all except those
on the list.
This command should be used in programs only with the utmost
care. Compiled programs set pointers to memory variables. If the
memory variables are released, the release must be absolute, not
dependent on some conditions.
Since 128 memory variables can be used at any one time, and any
number of them may be matrix variables, it is best not to RELEASE
during a program. When programs are chained, SR-Info/VP-Info will do
a CLEAR, which includes a RELEASE ALL.
RELEASE does not affect the values of the function keys and the
system variables.
Examples:
1. In Conversational SR-Info/VP-Info:
1>LIST MEMO
Name Type Width Contents
** Total ** 0 variables, 0 bytes
1>name='David'
1>age='11'
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
AGE C 2 11
RELEASE SRI VPI VPIN RELEASE
SR-Info/VP-Info Reference Manual Page 299 SECTION 4
** Total ** 2 variables, 7 bytes
1>RELEASE age
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
** Total ** 1 variables, 5 bytes
1>RELEASE ;RELEASE by itself does nothing
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
** Total ** 1 variables, 5 bytes
1>age=11
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
AGE N 8 11
** Total ** 2 variables, 13 bytes
1>RELEASE ALL
1>LIST MEMO
Name Type Width Contents
** Total ** 0 variables, 0 bytes
2. In programming, from a program you might DO a number of
subroutines; each uses a number of memory variables, most of which are
unique to it, but which in total exceed the 128 memory variable limit.
In this case, decide which variables needed to be retained, and use
the RELEASE EXCEPT after each subroutine as follows:
@ 20,30 SAY ' Enter your choice: ' GET choice PICTURE'!'
DO CASE choice ;menu choices
CASE choice='A'
DO proga
RELEASE EXCEPT choice,cust,due,amount
CASE choice='B'
DO progb
RELEASE EXCEPT choice,cust,due,amount
CASE choice='C'
DO progc
RELEASE EXCEPT choice,cust,due,amount
ENDCASE
ENDDO ;menu choices
RELEASE SRI VPI VPIN RELEASE
SR-Info/VP-Info Reference Manual Page 300 SECTION 4
REMARK
Display message on screen or printer.
╔════════════════════════════════════════════════════════════════════╗
║ REMARK ['<text line>'] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ '<text line>' the text line to be displayed ║
╚════════════════════════════════════════════════════════════════════╝
Same as the command ?. <text line> may be an expression list.
REMARK SRI VPI VPIN REMARK
SR-Info/VP-Info Reference Manual Page 301 SECTION 4
RENAME
Rename a file.
╔════════════════════════════════════════════════════════════════════╗
║ RENAME <file> TO <new file> ║
║ ║
║ <file> the file name to be changed (default extension DBF) ║
║ <new file> the new name for the file (default extension DBF) ║
╚════════════════════════════════════════════════════════════════════╝
This command is similar to the RENAME command of the operating
system: a file is renamed. No wild card characters are allowed.
If the file name has no extension, the extension DBF is assumed.
(Do not rename a data or index file to a name starting with the
letters COMP; SR-Info/VP-Info is unable to open such a file.)
Examples:
1>RENAME employee TO empl
Renames EMPLOYEE.DBF to EMPL.DBF.
1>RENAME employee.dbf TO employee.xyz
RENAME SRI VPI VPIN RENAME
SR-Info/VP-Info Reference Manual Page 302 SECTION 4
RENAME FIELD
Rename a field in a data file.
╔════════════════════════════════════════════════════════════════════╗
║ RENAME FIELD <field> TO <new fieldname> ║
║ ║
║ <field> the field name to be changed ║
║ <new fieldname> the new name for the field ║
╚════════════════════════════════════════════════════════════════════╝
This command allows you to change the name of a field in a data
file without doing a MODIFY, which potentially endangers the file and
removes all deleted records, often necessitating a REINDEX.
Examples:
1>RENAME FIELD employee TO empl
Renames the field EMPLOYEE to EMPL in the current data file.
1>RENAME#3 FIELD cust TO customer
Caution: All programs, report forms and index files that
reference the old field name must be revised before they will
work properly after a field is renamed.
RENAME FIELD SRI VPI VPIN RENAME FIELD
SR-Info/VP-Info Reference Manual Page 303 SECTION 4
REPEAT
Repeat program segment a specified number of times.
╔════════════════════════════════════════════════════════════════════╗
║ REPEAT <num exp> TIMES [VARYING <num var>] ║
║ ║
║ <num exp> a numeric expression; repeat the loop this many times ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ VARYING <num var> loop counter ║
╚════════════════════════════════════════════════════════════════════╝
The REPEAT command introduces the program structure:
REPEAT <num exp> TIMES [VARYING <num var>]
<program segment>
ENDREPEAT
The program lines in the <program segment> are repeated <num exp>
times. The end of the program segment is indicated by ENDREPEAT.
The optional VARYING clause is used to vary a memory variable
from 1 to <num exp>; at the start of the first loop, <num var> is
initialized as 1; <num var> is incremented by 1 each time the top of
the loop is reached.
This command is especially useful to manipulate matrix variables.
Repeats can be nested.
The BREAK command is used in 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 then being executed.
The SR-Info/VP-Info keywords: TIMES and VARYING should not be in
macros. <num var> cannot be a matrix variable.
Note that, if <program segment> contains commands that move the
current record pointer (for instance, a SKIP command), REPEAT does not
terminate if EOF becomes true. Thus displaying a record and skipping
in a file with 50 records, using REPEAT 100 TIMES, will display the
last record in the file 51 times. DO WHILE .NOT. EOF is the better
construction for such a task.
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.
REPEAT SRI VPI VPIN REPEAT
SR-Info/VP-Info Reference Manual Page 304 SECTION 4
Examples:
SET WIDTH TO 40
DIM NUM num[10]
REPEAT 10 TIMES VARYING count
num[count]=POW(2,count)
ENDREPEAT
? num
This displays:
2.00 4.00 8.00
16.00 32.00 64.00
128.00 256.00 512.00
1024.00
REPEAT SRI VPI VPIN REPEAT
SR-Info/VP-Info Reference Manual Page 305 SECTION 4
REPLACE
Replace field(s) in the selected data file.
╔════════════════════════════════════════════════════════════════════╗
║ REPLACE [<scope>] <field1> WITH <exp1> [,<field2> WITH <exp2> ... ]║
║ [FOR <cond>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select by scope ║
║ (default scope: current record) ║
║ <field> WITH <exp>... list fields and expressions for replacement║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
This command is used for changing some records in the selected
data file. The number of <field> WITH <exp> is only limited by the
length of a command line (254 characters).
The scope ALL can be used to change all the records in the data
file. This could be dangerous. Consider backing up your data file
before you use this command.
This command is very useful, especially in conjunction with SET
RELATION TO, so that the fields from which <exp> is formed may come
from a number of data files.
Examples:
1>USE employee
1>REPLACE name WITH 'Mareck'
1>? name
Mareck
1>REPLACE ALL salary WITH salary*1.05
6 REPLACE(S)
1>LIST name,salary
1 Mareck 27090.00
2 Steiner 37569.00
3 Rayme 83065.50
4 Poyner 9145.50
5 Poyner 9145.50
6 Wilson 35563.50
1>GO TOP
1>REPLACE NEXT 4 salary WITH salary*1.06 FOR name < 'P'
1 REPLACE(S)
1>USE order
1>USE#2 clothing
1>SET RELATION ON inven:no TO 2
1>REPLACE price WITH price#2
REPLACE SRI VPI VPIN REPLACE
SR-Info/VP-Info Reference Manual Page 306 SECTION 4
REPLACE SRI VPI VPIN REPLACE
SR-Info/VP-Info Reference Manual Page 307 SECTION 4
REPORT
The report generator.
╔════════════════════════════════════════════════════════════════════╗
║ REPORT [FORM] <form file> [<scope>] [FOR <cond>] ║
║ ║
║ <form file> the name of the form file ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ FOR <cond> select by condition ║
║ <scope> select by scope (default:ALL) ║
╚════════════════════════════════════════════════════════════════════╝
The command REPORT is a very versatile report generator. With a
minimum of effort the user can generate a great variety of columnar
reports. The command takes care of the width of the report, the
arrangement of the date, page numbering, title(s), the columns, the
data in the columns, headings, subtotals (two levels), totals, and
many other parameters.
This command reports on the file(s) in use according to the
format in the report form file <form file>. The form file can be
created with the SR-Info/VP-Info editor (WRITE) or with any word
processor; the default extension is FRM.
SR-Info/VP-Info computes the necessary width as the minimum
required to accommodate the title(s), headings, the expression list,
and the company name.
The report is automatically centered over 80, 112, or 132
characters wide, whichever is equal to or greater than the width of
the report body. The SET WIDTH TO command also affects the heading,
but not the width of the body.
The following keywords can be used in a report form file:
COMPRESS Sends code 15 to the printer for
compressed printing on Epson and
IBM Proprinter printers, sends
code 18 after completion of the
report to restore normal-width
mode. For non-compatible
printers, use SETUP.)
DOUBLE Prints double spaced lines.
EJECT Ejects a page after each subtotal.
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 308 SECTION 4
FIELDS - <exp1>,<exp2>,... The expressions for the columns of
the report.
FILE - <file> [INDEX <index file>] Opens the data file <file> and,
optionally, the index file.
HEADING - string1,string2,... The headings for the expressions in
the report.
INDEX - <exp> TO <index file name> [FOR <cond>]
Indexes on the expression <exp> to
the specified file the last data
file opened with the FILE
keyword; a FOR clause is
permitted (see INDEX).
LENGTH - <num exp> Number of printed lines per page.
MESSAGE - <str exp> Introduces the message to be
displayed for a subtotaled group
(2 allowed).
NODETAIL Shows only the totals and
subtotals.
PICTURE - <picture list> Which expressions (in the FIELDS
line) are to be totaled.
PRINT Sends the report to the printer.
RELATION - <exp> TO <file number> Sets a relation between file 1 and
the file <file number>.
SELECT - <cond> Selects the records by condition
<cond>.
SETUP - <setup string> A list of control codes to be sent
to the printer before beginning
page 1 (do not use without PRINT
or SPOOL keywords).
SPOOL - <file name> Sends the report to the file <file
name> (PRINT must not be used).
SUBTOTAL - <exp> Subtotals be printed when the
expression <exp> changes (2
allowed).
TITLE - string or <str exp> The title of the report (2
allowed).
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 309 SECTION 4
Some of these keywords can be used more than once. More detailed
explanation follows in the subsection on keywords.
The REPORT command is influenced by the commands previously
given, such as USE, INDEX, SET PRINT ON. Most of these can also be
done from within the report form file.
Commands influencing REPORT. The REPORT command works on the
selected file (if any). So
1>SELECT 3
3>REPORT salary
means: report on file 3 using the report form file SALARY.FRM. If no
file is in use as file 3, the report form file will have to specify
(with the FILE keyword) the data file(s) to use.
Similarly, specifying the index file(s) to use with the data
file(s) and reindexing can be done before the REPORT command is given.
Here is a simple example:
1>SELECT 2
2>USE clients
2>INDEX ON newdate TO newdate
2>REPORT call
The report can be directed to the screen, the printer, or to a
text file. To the printer:
2>SET PRINT ON
To a text file (TEMP.TXT):
2>SPOOL temp
2>SET PRINT ON
2>REPORT call
2>SET PRINT OFF
2>SPOOL
REPORT can use files related to each other:
1>SELECT 1
1>USE order INDEX order
1>USE#2 client INDEX client
1>SET RELATION ON client TO 2
1>REPORT order
REPORT can use linked files:
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 310 SECTION 4
1>SELECT 1
1>USE order index order
1>USE#2 history1
1>USE#3 history2
1>SET LINK TO 2
1>SET#2 LINK TO 3
1>REPORT order1
It may be necessary to send control characters to the printer to
set up the desired printing mode. Example:
1>SET PRINT ON
1>?? CHR(27)+CHR(121)+CHR(128)
The system variables :COMPANY, :TITLE, and :DATE influence the
report. The company name in :COMPANY appears centered in the second
line of the report. The text in :TITLE becomes the title of the
report unless the report form file specifies otherwise (with the
keyword TITLE). The date on the first line of the report comes from
:DATE.
The three system variables may be changed before REPORT.
Much of what can be accomplished by setting the environment of
REPORT before the command is given, can also be done in the report
format file. There are some exceptions: for instance, since SPOOL
adds to the top of an existing file with the same name as the spool
file, you may want to delete the existing file before doing the
report, or alternately using the SPOOL command outside the report and
the keyword PRINT inside the report. You may also want to set page
depth with SET LENGTH TO, the number of character over which the
heading will be centered with SET WIDTH TO, the left margin with SET
MARGIN TO, etc. See also SET EJECT.
The form of the REPORT command. The selection criteria can be
placed in the REPORT command and/or in the report form file. If the
REPORT command contains a FOR clause, and the report form file has a
SELECT line, then the FOR clause of the REPORT command overrules the
SELECT line of the report form file.
You may restrict the range of records in the report by the LIMIT
command or a scope; both must be invoked outside the REPORT form. The
WHILE <cond> form of the scope may be very useful when reporting on a
very big file. As an example,
1>USE orders INDEX clients
In the current record the field CLIENT contains A234. To report on
all the orders by this client with part number > 1200:
1>REPORT ship WHILE client='A234' FOR VAL(part:num)>1200
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 311 SECTION 4
or
1>LIMIT client
1>REPORT ship FOR VAL(part:num)>1200
1>LIMIT
Note that without either the scope or the LIMIT command, processing
would stop only after all the records of the file had been processed.
Report form file. Look at the examples of report form files
given below. In a report form file, the first word of a line has to
be a keyword, followed by any modifiers separated from the keyword by
a hyphen (-). There are currently 18 keywords.
Only the FIELDS line is required; all the others are optional.
Some keywords can occur more than once.
Keywords:
TITLE - string/<str exp>
This keyword is followed by the title of the report; the title
appears centered as the third line of the report. If no title is
specified in the text file, then the string in the system variable
:TITLE (if any) is used for the title.
If a <str exp> is used, it will be evaluated, and used as the
title. If an invalid expression is used, it will be printed as a
literal.
SR-Info/VP-Info looks at the TITLE line; what appears to the
right of the hyphen is evaluated as an expression. If it is valid,
then it is used as an expression. If it is not, then it is printed
"as is."
So to get Annual Report as the title, simply use the line
TITLE - Annual Report
No quotation marks are needed.
The TITLE keyword may be used twice:
TITLE - string1
TITLE - string2
Then the title is in two lines, both centered.
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 312 SECTION 4
If ASOF is a variable containing the date of the last accounts-
receivable aging in the standard format, then
TITLE - 'Accounts receivable as of '+DATE(FULL,asof)
will display
Accounts receivable as of Thursday, September 19, 1991
FILE - <data file> [INDEX <index file>]
This keyword opens the data file (as file 1, if there was a file
open as file 1, it is first closed) and, optionally, the index file.
This keyword may occur a number of times. The second time it
opens file 2, then file 3, and so on. Since the reporting is done on
the first data file opened by FILE, more than one file should be
opened only if relations are used.
If there is no FILE line, REPORT uses the current data file. If
none is open, an error message (usually: 2. Variable not found.) is
given.
INDEX - <exp> TO <index file name> [FOR <cond>]
This keyword will index the last data file opened with the FILE
keyword on the expression <exp> to the specified index file. If this
is only a temporary index, then you should specify a name such as
TEMP. A condition can be specified to limit the index to only those
records matching the condition; this is often faster than using SELECT
or a FOR clause on the REPORT command.
Example:
FILE - inventry
INDEX - inven:no TO temp1 FOR type='G'
FILE - supplier
INDEX - suppl:code TO temp2
opens up the data files: INVENTRY as file 1 and SUPPLIER as file 2,
and indexes both, limiting the primary index and the report to those
for which type='G'.
FIELDS - <exp1>,<exp2>,...
This is the expression list; these expressions fill the columns
of the report. Often, these expressions are just field names, though
they may be arbitrary expression including fields (from various data
files), variables, and constants.
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 313 SECTION 4
If all the expressions do not fit on one line, then leave a comma
at the end of the line and continue on the next line.
HEADING - string1,string2,...
These are the column headings for each expression in FIELDS line.
Separate the strings with commas. The spacing of each column is done
by the program based on the largest of the following: the length of
the heading, the width of the field, and the picture clause in the
PICTURE line. Blanks on the left and on the right of a heading are
counted in the width.
To move a column to the right, put spaces in front of the column
heading. To make a column wider, put spaces at the end of the column
heading. To move the column heading of a numeric field to the left,
put spaces at the end of the column heading.
If no heading is required for a column, it may be omitted, but
its comma is required if any later columns are to have a heading; no
trailing commas are permitted, since they would be understood as
continuation characters merging the next keyword to the HEADING line..
If the strings in the HEADING line do not fit on one line, then
leave a comma at the end of the line and continue on the next line.
Do not break a heading with a comma.
Multi-line headings. In the HEADING line, a semicolon (;) breaks
the heading into more than one line. At most three lines are
permitted.
For instance,
HEADING - Last Name;=========,First Name;==========,
Department;==========,Salary;======
produces the headings:
Last Name First Name Department Salary
========= ========== ========== ======
Note the use of the comma (,) at the end of the first line as a
continuation character.
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 314 SECTION 4
PICTURE - <format list>
The PICTURE keyword is used to indicate which expressions (in the
FIELDS line) are to be totaled. The PICTURE line also shows how the
expressions and totals (and subtotals) are to be displayed.
A format is some 9s and, optionally, a decimal point or other
special characters used in the format clause for numbers (see the
command @). Examples:
999
999999.99
9.9999
999999.99-
999999.99>
A format list is a number of formats separated by commas. Some
formats may be missing, but the commas have to be there as long as
formats are required to reach the last field requiring accumulation.
no trailing commas are permitted, since they would be understood as
continuation characters merging the next keyword to the picture line.
Negative values can be displayed in any of three ways. The
default is to use a leading minus sign. It is possible to surround
negative values with pointed brackets, or to use trailing minus signs
as follows:
Indicator for Negatives Example Value Displays
None 9999999.99 -19876.87 -19876.87
Trailing minus sign 9999999.99- -19876.87 19876.87-
None 9999999.99> -19876.87 <19876.87>
If a format includes a comma, that format must be enclosed in
quotes.
The following will all total the fourth and the fifth columns out
of the eight (or more) specified in the FIELDS line:
PICTURE - ,,,999.99,999999
PICTURE - ,,,999.99,'999,999'
PICTURE - ,,,999.99,'$$$,$$9.99'
PICTURE - ,,,999.99-,'999,999-'
PICTURE - ,,,999.99>,'$$$,$$9.99>'
There can be no format for character fields in the PICTURE line,
since no strings are carried from record lines to total lines. To
format a character field, use PIC( or other functions.
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 315 SECTION 4
SUBTOTAL - <exp>
This keyword causes subtotals to be printed when the expression
<exp> changes. Subtotaling is done for all numeric expressions that
are specified in the PICTURE line.
Of course, subtotaling produces erratic result if the data file
is not sorted or indexed in a way to group all the items with the same
<exp> in one group. The command REPORT works whether or not this is
the case.
MESSAGE - <str exp>
This keyword introduces the message to be displayed on the report
lines at the start of a subtotaled group; e.g., 'Salesman - '+salesm.
Two levels of subtotaling. If there are two SUBTOTAL lines:
SUBTOTAL - <exp1> "inside level"
MESSAGE - string1 message for the "inside level", footer
SUBTOTAL - <exp2> "outside level"
MESSAGE - string2 message for the "outside level", header
two levels of subtotaling is done. <exp1> is the "inside" level (the
sub-subtotal) and <exp2> is the "outside" level (the grand subtotal).
The message for the outside level appears as a header; the
message of the inside level appears with the sub-subtotal. String1 is
printed from the start of the line. Make sure that there is enough
room for string1 before the start of the first totaled column.
For instance, if the file is indexed on salesman+style, then
salesman is exp2, the outside level, and salesman+style is exp1, the
inside level. Thus one obtains a sales report grouped by salesman
(outside level), and within salesman by style (inside level):
SUBTOTAL - salesman+style
MESSAGE - 'Style '+style
SUBTOTAL - salesman
MESSAGE - 'Salesman '+salesman
Note that the inside subtotal expression in on salesman+style
instead of by style alone; this is done because the last record for
one salesman might be the same as the first record for the next
salesman, thus giving confusing results. Both subtotal expressions
should be some leftmost part of the index expression, with the inside
expression longer than the outside expression.
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 316 SECTION 4
PRINT
This will send the report to the printer. It has the same effect
as SET PRINT ON at the beginning of the report and SET PRINT OFF at
the end.
EJECT
This keyword will cause a page eject after each subtotal. If two
levels of subtotals are specified, only the main level will cause a
page eject.
If SET EJECT OFF, instead of sending a form feed code to the
printer, SR-Info/VP-Info will send enough carriage returns to move the
paper in the printer to the form depth set by the SET LENGTH TO
command (default is 66).
RELATION - <str exp> TO <file number>
This keyword sets a relation between file 1 and the file <file
number>. It is equivalent to the commands:
1>SELECT 1
1>SET RELATION ON <str exp> TO <file number>
Example:
RELATION - inven:no TO 2.
There can be a number of these lines. File 1 can be in relations
to file 2, file 3, and so on. The relations are always between file 1
and another file.
DOUBLE
Print double spaced lines.
COMPRESS
Sends code 15 to the printer for compressed printing; and code 18
after the report to discontinue compressed printing. If the printer
requires different codes, use the SETUP keyword or send them before
and after the REPORT command with the function CHR(.
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 317 SECTION 4
SETUP - <setup string>
SETUP establishes a string of control characters to be sent to
the printer when printing begins. It should not be used if neither
printing nor spooling is in effect.
The setup string is a list of character descriptors, separated by
commas. Each descriptor may be a number (the ASCII value of a
character), a hex number followed by an "h" (the hex value of a
character, or any alpha character. Example
SETUP - 27,W,1Bh,41h,3h
SPOOL - <file name>
This is an alternative to the PRINT keyword and SET PRINT ON, and
should not appear if either of the others is present. It sends the
report to the file <file name> (default extension TXT).
Spool a report if you want to pretty it up with your word
processor, or include it in a document, or print it some other time.
The SR-Info/VP-Info command SPOOL finename TO PRN or the operating
system command PRINT can later print the report in the background mode
from this file.
Note that if <file name> already exists, the report will be added
at its end; it will not be overwritten. (Do not confuse the SPOOL
keyword with the SPOOL command, which does overwrite existing files.)
SELECT - <cond>
Select by condition <cond>; the same as a FOR clause in the
REPORT command. If a FOR clause is used in the REPORT command, it
overrides the selection of the SELECT line. If a FILTER is in effect,
only records which match both the filter and the select condition are
included in the report.
NODETAIL
This modifies a report with subtotaling: only the totals and
subtotals are shown. The expressions from the FIELDS line and the
column headings from the HEADING line are not displayed.
LENGTH - <num exp>
This sets the number of printed lines per page. For instance,
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 318 SECTION 4
LENGTH - 40
will set the page length at 40.
Comments. The lines in the report form file can be separated by
any number of blank lines to increase readability.
A * can be put at the front a line to comment out (temporarily)
that line.
The lines can appear in just about any order. The INDEX keyword
must appear after the FILE keyword, and the MESSAGE keyword must
appear after the SUBTOTAL keyword.
Examples of report form files:
Example 1. The simplest report form file, SALARY.FRM:
FIELDS - name,fname,dept,salary
Use it with the commands:
1>USE employee INDEX name
1>REPORT salary
Example 2. Using a multi-line heading (use it with the same
commands as those for Example 1):
HEADING - Last Name;=========,First Name;==========,
Department;==========,Salary;======
FIELDS - name,fname,dept,salary
Example 3. Using two title lines (use it with the same commands
as those for Example 1):
TITLE - Salary Report
TITLE - For the Third Quarter
HEADING - Last Name,First Name,Department,Salary
FIELDS - name,fname,dept,salary
Example 4. A simple totaling using a string expression for the
title; the memory variable QUARTER contains 'First', 'Second, 'Third',
or 'Fourth' (use it with the same commands as those for Example 1):
TITLE - Salary Report
TITLE - 'For the '+quarter+' Quarter'
HEADING - Last name,First name ,Department,Salary
FIELDS - name,fname,dept,salary
PICTURE - ,,,9999999.99
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 319 SECTION 4
Example 5. Subtotaling by department:
TITLE - Salary Report
HEADING - Last name,First name ,Department,Salary
FIELDS - name,fname,dept,salary
SUBTOTAL - dept
PICTURE - ,,,9999999.99
Use it with the commands:
1>USE employee
1>INDEX ON dept TO dept
1>REPORT salary
Example 6. Subtotal with a message, appearing as a header for the
group (use it with the same commands as those for Example 5):
TITLE - Salary Report
HEADING - Last name,First name ,Salary
FIELDS - name,fname,salary
MESSAGE - 'Department: '+dept
SUBTOTAL - dept
PICTURE - ,,9999999.99
Example 7. Two levels of subtotaling (use it with the same
commands as those for Example 5):
HEADING - , ,Part,Date,Amount
FIELDS - ' ',' ',part,date,amount
PICTURE - ,,,,999999.99
SUBTOTAL - salesman+part
MESSAGE - 'Part '+trim(part)+' total: '
SUBTOTAL - salesman
MESSAGE - 'Salesman: '+salesman
Example 8. Specifying files in use and a relation:
FILE - sales INDEX sales
FILE - abbrev INDEX abbrev
RELATION - part TO 2
HEADING - , ,Part,Date,Amount
FIELDS - ' ',' ',part,date,amount
PICTURE - ,,,,999999.99
SUBTOTAL - salesman+part
MESSAGE - TRIM(descr#2)+' total: '
SUBTOTAL - salesman
MESSAGE - 'Salesman: '+salesman
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 320 SECTION 4
Example 9. A real-life example:
TITLE - 'Report on '+trim(product)+' sales'
TITLE - 'For month ending '+date(lchar,date(ymd))
FILE - inven INDEX inven2
INDEX - style TO inven2 FOR q1+q2+q3+q4+q5+q6+q7+q8>0
HEADING - COLOR,DESCRIPTION,,ONE,XXS,XS,S,M,L,XL,QUANT
FIELDS - color,descript,
q1,q2,q3,q4,q5,q6,q7,q8,
q1+q2+q3+q4+q5+q6+q7+q8
SUBTOTAL - style
MESSAGE - 'Style - '+style
PICTURE - ,,9999,9999,9999,9999,9999,9999,9999,9999,99999
EJECT
PRINT
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 321 SECTION 4
Example 10. An example with expressions:
TITLE - Inventory Listing
*
FILE - inven
INDEX - style+color TO inven1
*
HEADING - STYLE,COLOR,DESCRIPTION,COST,
,ONE,XXS,XS,S,M,L,XL,
QUANT,ORDER,PROG,AVAIL,OYTD,CYTD,SYTD
*
FIELDS - style,color,descript,cost,
q1,q2,q3,q4,q5,q6,q7,q8,
quant,order,progress,quant-order+progress,oytd,cytd,sytd
*
PICTURE - ,,,,9999,9999,9999,9999,9999,9999,9999,9999,99999,99999,
99999,99999,99999,99999,99999
*
PRINT
*
SUBTOTAL - style
MESSAGE - 'Style - '+style
A General Discussion on
Multi-File Reports
Using Relations and Subtotaling
Since many database users come to SR-Info/VP-Info with some
exposure to other database languages which cannot print reports using
relations, this powerful tool is often overlooked by many users and
even magazine reviewers.
SR-Info/VP-Info allows any two data files to be linked together,
either in a chain (1-to-2, 2-to-3, 3-to-4, etc.) or multiple-child
relationship (1-to-2, 1-to-3, 1-to-4, etc., simultaneously).
Let's say you want to print a list of all items sold today from
your store. Each item is described in ITEMS.DBF, customers are stored
in CUST.DBF, and invoices list all items in a file called INVOICE.DBF.
You can get the report you want, using the report specification
in Figure 1, with the following command, either in a program or at the
command prompt:
REPORT invcdate FOR date=date(1)
──────────────────────────────────────────────────────────────────────
Figure 1
* INVCDATE.FRM report form for printing invoice details by date
FILE - invoice INDEX invcdate
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 322 SECTION 4
FILE - items INDEX itemcode
FILE - cust INDEX custcode
RELATION - itemcode TO 2
RELATION - custcode TO 3
FIELDS - date,custcode,name#3,itemcode#2,quant,price,price*quant
HEADING - DATE,CUSTOMER,NAME,ITEM,QUANTITY,PRICE,TOTAL
PICTURE - ,,,,,,$$$$$$9.99
PRINT
TITLE - 'Invoices Produced '+date(char)
──────────────────────────────────────────────────────────────────────
This produces the report shown in Figure 2.
SUBTOTALING
Of course, the report could have been printed in order by
customer or item code just as easily, and even grouped and subtotalled
by either of them. For example, adding these two lines after the
PICTURE line,
SUBTOTAL - custcode
MESSAGE - name#3
would print the name of the customer above all items he purchased, and
show a total cost of all these items for each customer, as well as a
grand total of all customers.
SR-Info/VP-Info actually provides two levels of grouping and
subtotaling, which we call the "inside" level and the "outside" level.
Let's say our file in indexed on CUSTCODE+DATE to INVCCUST.NDX.
Then we produce the report shown in Figure 3 by inserting the
following four lines into our report specification after the PICTURE
line:
SUBTOTAL - custcode+date
MESSAGE - blank(5)+date(dmy,date)
SUBTOTAL - custcode
MESSAGE - name#3
The first two lines specify the inside level, while the last two
set up the outside level. You'll notice that there can be several
days grouped inside a single customer; that's why date is the INSIDE
grouping.
Also notice that the "trigger expression" for the inside level is
CUSTCODE+DATE and not DATE alone. Remember that you want a date
heading and subtotal printed whenever a customer changes, even if the
next customer's purchase was on the same day. The best rule is to
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 323 SECTION 4
make sure that the trigger expression for the inside grouping is
longer than, and includes all of, the outside trigger expression.
(In actual practice, you would probably adjust the specification
to remove the date and name#3 fields from the FIELDS line, since they
are printed in the header and footer of the groups.)
A FEW REPORT TIPS:
Although the single command, REPORT invcdate FOR date=DATE(ymd),
can produce the report shown above, there are a couple of better and
faster -- but more complicated -- ways to get the same result. The
problem is that, over time, the invoice file will become very large,
and the method shown above requires every single record to be
processed, even though only a few are going to be printed.
Better Method 1 is primarily for those who want to use the report
from the command prompt. Use these three lines instead,
USE invoice
INDEX ON item TO temp FOR date=date(ymd)
REPORT invcdate
thus making a special index which includes only the records you want
to print. Even with very large files, this is extremely quick. Of
course, you'll have to change the first line of your report file to
read "FILE - invoice INDEX temp".
Better Method 2 will be chosen by most programmers who can easily
set up the files and relations to be used for the report in their
program as follows:
SELECT 1
USE invoice INDEX invcdate
USE#2 items INDEX itemcode
USE#3 cust INDEX custcode
SET RELATION ON itemcode TO 2
SET RELATION ON custcode TO 3
FIND &date(ymd)
REPORT INVCDATE WHILE date=date(ymd)
Of course, the FILE and RELATION lines would be omitted from
INVCDATE.FRM.
USING RELATION TO SHOW WHAT ISN'T THERE
Relations aren't used just to show what is in another file. In
fact, one of these best uses is to highlight things that aren't there.
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 324 SECTION 4
Remember that setting up a relation means that, every time the
record number changes on the main file, a FIND is executed on the
relation expression to the related file. If no matching record is
found, the related file is set to the mythical record zero, meaning
that all character fields are blank and all numeric fields are zero.
Say you have a data file with a customer code field, but you
aren't sure that every code is correct. You can set up a relation
between the two files and print the report specified in Figure 4,
showing all records for which NO customer was found in CUST.DBF. It's
the line "SELECT - custcode<>' '" that causes only mismatched
records to print.
With all the power built into the SR-Info/VP-Info REPORT command
-- relations and two levels of grouping -- it's rare even for full-
time custom programmers to take the time to write a program to produce
a report. Once you get a little practice, you'll find that only a few
minutes are needed to create complex and exciting reports.
──────────────────────────────────────────────────────────────────────
Figure 2
Monday, February 13, 1991 Page 1
COMPUTER DISTRIBUTING EXTRORDINAIRE
Invoices Produced February 13, 1991
DATE CUSTOMER NAME ITEM QUANTITY PRICE TOTAL
910213 SUB50 Sub Rosa Inc. VPINF 10 199.00 $1990.00
910213 CRE50 Create Computer VPEXP 2 179.00 $358.00
910213 PSI50 Paperback Software VPPLA 1 149.00 $149.00
910213 SUB50 Sub Rosa Inc. VPPLU 2 249.00 $498.00
910213 CRE50 Create Computer VPINF 12 199.00 $2388.00
910213 PSI50 Paperback Software VPEXP 54 179.00 $9666.00
910213 SUB50 Sub Rosa Inc. VPPLA 1 149.00 $149.00
910213 CRE50 Create Computer VPPLU 5 249.00 $1245.00
910213 PSI50 Paperback Software VPINF 1 199.00 $199.00
910213 CRE50 Create Computer VPEXP 21 179.00 $3759.00
910213 PSI50 Paperback Software VPPLA 285 149.00 $42465.00
910213 SUB50 Sub Rosa Inc. VPPLU 85 249.00 $21165.00
==========
$84031.00
──────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────
Figure 3
Monday, February 13, 1991 Page 3
COMPUTER DISTRIBUTING EXTRAORDINAIRE
Invoices Produced February 13, 1991
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 325 SECTION 4
DATE CUSTOMER NAME ITEM UANTITY PRICE TOTAL
Create Computer
910213 CRE50 Create Computer VPEXP 2 179.00 $358.00
910213 CRE50 Create Computer VPINF 12 199.00 $2388.00
910213 CRE50 Create Computer VPPLU 5 249.00 $1245.00
910213 CRE50 Create Computer VPEXP 21 179.00 $3759.00
13-Feb-1991 $7750.00
----------
$7750.00
Paperback Software
910213 PSI50 Paperback Software VPPLA 1 149.00 $149.00
910213 PSI50 Paperback Software VPEXP 54 179.00 $9666.00
910213 PSI50 Paperback Software VPINF 1 199.00 $199.00
910213 PSI50 Paperback Software VPPLA 285 149.00 $42465.00
13-Feb-1991 $52479.00
----------
$52479.00
Sub Rosa Inc.
910213 SUB50 Sub Rosa Inc. VPINF 10 199.00 $1990.00
910213 SUB50 Sub Rosa Inc. VPPLU 2 249.00 $498.00
910213 SUB50 Sub Rosa Inc. VPPLA 1 149.00 $149.00
910213 SUB50 Sub Rosa Inc. VPPLU 85 249.00 $21165.00
13-Feb-1991 $23802.00
----------
$23802.00
==========
$84031.00
──────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────
Figure 4
* NOFIND.FRM report form listing all invoices for customers
* not found in CUST.DBF
FILE - invoice
FILE - cust INDEX custcode
RELATION - custcode TO 2
FIELDS - date,custcode,invoice,itemcode,quant,price,price*quant
HEADING - DATE,CUSTOMER,INVOICE,ITEM,QUANTITY,PRICE,TOTAL
PICTURE - ,,,,,,$$$$$$9.99
PRINT
TITLE - Invoices For Customers Not In Customer Data File
SELECT - custcode<>' '
REPORT SRI VPI VPIN REPORT
SR-Info/VP-Info Reference Manual Page 326 SECTION 4
RESTORE
Restore memory variables from file.
╔════════════════════════════════════════════════════════════════════╗
║ RESTORE FROM <file> [ADDITIVE] ║
║ ║
║ <file> name of memory variable file ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ ADDITIVE add new variables, update old ones ║
╚════════════════════════════════════════════════════════════════════╝
This command is used for restoring the memory and system
variables that had previously been saved by the SAVE TO command. This
command erases all the variables that are currently in memory. (See
the command SAVE TO.)
The ADDITIVE clause inhibits clearing of memory variables. It
adds the memory variables from the file to the memory variable table.
If a memory variable occurs both in the table and the file, its value
gets updated from the file. With the ADDITIVE clause, the position of
the existing variables in the memory variable table does not change,
so pointers to them remain correct. It is recommended that RESTORE
FROM be always used with the ADDITIVE clause.
This command should be used with the utmost care. Compiled
programs set pointers to memory variables. If the memory variables
are restored, the restore must be absolute, not dependent on some
conditions. (See Appendix A. At compilation, the memory variable
file must be present.)
Example:
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
AGE N 8 11
** Total ** 2 variables, 13 bytes
1>SAVE TO child
1>QUIT
C:\>SRI
1>RESTORE FROM child
RESTORE SRI VPI VPIN RESTORE
SR-Info/VP-Info Reference Manual Page 327 SECTION 4
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
AGE N 8 11
** Total ** 2 variables, 13 bytes
RESTORE SRI VPI VPIN RESTORE
SR-Info/VP-Info Reference Manual Page 328 SECTION 4
RETURN
Return to the calling program.
╔════════════════════════════════════════════════════════════════════╗
║ RETURN ║
╚════════════════════════════════════════════════════════════════════╝
The RETURN command returns the current program to the program
from which it was called with the DO command.
There may be any number of RETURN commands in a program. (See
also the command DO.)
RETURN SRI VPI VPIN RETURN
SR-Info/VP-Info Reference Manual Page 329 SECTION 4
RING
Sound a beep on the computer speaker.
╔════════════════════════════════════════════════════════════════════╗
║ RING ║
╚════════════════════════════════════════════════════════════════════╝
The RING command has different effects in SR-Info and VP-Info
Professional; refer to the section applying to you.
A. In VP-Info Professional without the NOEFFECTS keyword in the
VPI.SET file:
RING uses one of the sound effects from its effect library,
and does not send anything to the screen.
B. In SR-Info (and in VP-Info Professional with the NOEFFECTS
keyword in the VPI.SET file):
RING sends character 7 (the ASCII bell character) to the
screen at the current cursor position. If there is already
a character in that position, it will be overwritten
(erased).
See the SOUND command.
RING SRI VPI VPIN RING
SR-Info/VP-Info Reference Manual Page 330 SECTION 4
RUN
Execute DOS commands or run a program outside SR-Info/VP-Info.
╔════════════════════════════════════════════════════════════════════╗
║ RUN <command file>/<DOS command> ║
║ ║
║ <command file> an EXE, COM or BAT file to be executed ║
║ <DOS command> an internal DOS command (COMMAND.COM must be ║
║ in the current directory or in the PATH ║
╚════════════════════════════════════════════════════════════════════╝
Provided your computer has sufficient memory available, the RUN
command allows you to execute DOS commands and run small programs
outside SR-Info/VP-Info without leaving SR-Info/VP-Info.
The amount of memory devoted to VP-Info is controlled by the
MEMORY= command in the VPI.SET file, but cannot be changed from the
default configuration in SR-Info. The default is to use as much high
memory as possible up to 128K. See MEMORY= and BINSPACE= commands.
Examples:
1>RUN chkdsk ;check current disk...CHKDSK must be
;in current directory or path
1>RUN editor test ;use an editor on file TEST...EDITOR
;must be in current directory or path
1>RUN mode com1:1200,n,8,1 ;configure the COM1: port...MODE must be
;in current directory or path
RUN SRI VPI VPIN RUN
SR-Info/VP-Info Reference Manual Page 331 SECTION 4
SAVE
Save the memory variables to a file.
╔════════════════════════════════════════════════════════════════════╗
║ SAVE TO <file> ║
║ ║
║ <file> the name of the memory variable file ║
╚════════════════════════════════════════════════════════════════════╝
This command is used to save the memory variables to a file.
These can later be restored using the RESTORE FROM command. (See
RESTORE FROM.)
If no extension is given to the file name, the file will have
extension MEM.
During debugging, you may save the memory variables to a file for
later analysis.
Example:
1>LIST MEMO
Name Type Width Contents
** Total ** 0 variables, 0 bytes
1>name='David'
1>age=11
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
AGE N 8 11
** Total ** 2 variables, 13 bytes
1>SAVE TO child
1>QUIT
C:\>SRI
1>RESTORE FROM child
1>LIST MEMO
Name Type Width Contents
NAME C 5 David
AGE N 8 11
** Total ** 2 variables, 13 bytes
SAVE SRI VPI VPIN SAVE
SR-Info/VP-Info Reference Manual Page 332 SECTION 4
SCOPE
Limit the records available within the current master index to those
matching all or part of the current records index key. A synonym for
LIMIT command.
╔════════════════════════════════════════════════════════════════════╗
║ SCOPE <num exp> ║
║ SCOPE <key exp> ║
║ SCOPE ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <num exp> the number of characters in the key expression to ║
║ to match ║
║ <key exp> the string expression to match in the current master ║
║ index ║
╚════════════════════════════════════════════════════════════════════╝
When the current file has an index, SR-Info/VP-Info can be made
to treat the file as though it includes only those records matching
the current record's key expression, or some leftmost part of it.
When a SCOPE is in effect, no SR-Info/VP-Info command can access a
record outside that limit.
You can most quickly implement this command by using the
<num exp> option. The effect is to have SR-Info/VP-Info set the SCOPE
to the leftmost <num exp> characters of the key expression of the
master index. If <num exp> exceeds the length of the key, the effect
is identical to setting the SCOPE to the entire index expression.
When SCOPE is used with no option, or when <num exp> is zero, the
limit is deactivated.
Using SCOPE with <key exp> requires precision is its use to avoid
problems that may become extremely serious. Note that the <key exp>
expression must be the same as the master index key in use at the
moment, or some LEFT( portion of it. Do not attempt to use an
expression that does not meet this requirement.
Cautions:
A. FIND should not be used on a file with an active limit. If
you choose to do so, be certain that the FIND will be
successful. An unsuccessful FIND places the record pointer
on record 0 which is by definition not in the index. This
causes an error, suspends operation of a program, and turns
off the SCOPE.
SCOPE SRI VPI VPIN SCOPE
SR-Info/VP-Info Reference Manual Page 333 SECTION 4
B. Do not use REPLACE ALL on a field included in an active
limit expression, since upon completion, no records will be
included in the limit; the result is the same as above.
C. Do not use APPEND, APPEND BLANK or BROWSE APPEND, or enter
"append mode" in EDIT, while a limit is active unless you
are sure to make all new records equal to the current SCOPE
key before leaving the new records. Doing so causes the
file to move outside the SCOPE; the result is the same as
above.
D. SCOPE should be used with extreme care, and left in effect
for the minimum number of commands possible. For instance,
if used with BROWSE, SCOPE should be invoked immediately
before the BROWSE command and canceled immediately
afterward.
E. SCOPE should be canceled before closing the index or the
file with which it is active, or before the master index is
changed with SET INDEX TO n. If not done by the user or
programmer, the SCOPE is automatically turned off by
SR-Info/VP-Info.
F. SCOPE cannot be used with a string constant instead of a
<key exp>. The <key exp> can be implemented with a macro.
G. SCOPE is a synonym for the LIMIT command, and can be used
interchangeably.
SCOPE SRI VPI VPIN SCOPE
SR-Info/VP-Info Reference Manual Page 334 SECTION 4
SCREEN
Save and restore screen images between the displayed screen and up to
three additional background screens.
╔════════════════════════════════════════════════════════════════════╗
║ One of three forms: ║
║ 1. SCREEN <source>,<destination> ║
║ 2. SCREEN <destination> ║
║ 3. SCREEN <effect> ║
║ ║
║ <source> the number of the screen to be transferred to ║
║ destination in form 1 ║
║ <destination> screen number to which all screen output in to be ║
║ directed in form 1; the "active" screen in form 2 ║
║ <effect> transfer the stored image of Screen 2 to Screen 1 ║
║ (the visible screen) in form 3; transfer uses the ║
║ named effect in VP-Info Professional only if ║
║ NOEFFECTS not in CNF file ║
╚════════════════════════════════════════════════════════════════════╝
Screen 1 is the screen the user can see, although screen output
can be directed to any of three background screens, numbered 2 through
4, and images can be transferred directly from any one to any other.
In VP-Info Professional, the visual impact of these transfers can
be enhanced by using any of seven special effects, each accompanied by
a characteristic sound effect. The seven special effects are achieved
by naming it with one of these keywords:
Keyword Effect
Tear Push the current screen up and to the right
Left Push the current screen to the left
Right Push the current screen to the right
Up Push the current screen up
Down Push the current screen down
Open Expose Screen 2 gradually from the middle
Close Push the current screen into itself at the middle
Shortcut: When specifying effect by name, only the first
character is required.
In all cases, these effects move screen 2 to Screen 1; in order
to see to effect, the active screen should be Screen 1.
In its default mode, color attributes and cursor positions are
stored and restored automatically. SET SCREEN OFF to allow color
attributes and cursor position to be unaffected by the SCREEN command.
SCREEN SRI VPI VPIN SCREEN
SR-Info/VP-Info Reference Manual Page 335 SECTION 4
Example in a program:
SCREEN 2 ;direct output to background screen
<commands> ;draw the background screen
SCREEN 1 ;make the visible screen active
SCREEN TEAR ;use effect to move Screen 2 to 1 -- in SR-Info,
; or VP-Info with NOEFFECTS, same as SCREEN 2,1
SCREEN SRI VPI VPIN SCREEN
SR-Info/VP-Info Reference Manual Page 336 SECTION 4
SCROLL
Scroll a part of the screen.
╔════════════════════════════════════════════════════════════════════╗
║ SCROLL <line1>,<line2> ║
║ ║
║ <line1> from this line number ║
║ <line2> to this line number ║
╚════════════════════════════════════════════════════════════════════╝
Scroll the screen up one line from line number line1 to line
number line2; line1 and line2 are numeric expressions. If line1 is
less than line2, the scrolling is reversed. line1 cannot equal line2.
This command is used to scroll text on the screen.
Examples:
1.
1>SCROLL 2,5
1>SCROLL 5,2
2. Scrolling demo. Needs two data files: CUST, with fields CUSTN
(customer number), NAME (customer name), ADD:1 (address); INVEN with
fields: STYLE, COLOR, DESCRIPT, QUANT, COST.
USE cust
USE#2 inven
@ 2,0 SAY CEN('SR-Info can scroll windows',80)
@ 5,0 SAY CEN('windows can scroll up !',80)
DELAY .5
@ 7,0 SAY 'CUSTN NAME ADDRESS'
REPEAT 5 TIMES VARYING i
? custn,name,add:1,i
SKIP
DELAY .5
ENDREPEAT
REPEAT 5 TIMES
SCROLL 8 12
@ 12,0
?? custn,name,add:1
DELAY .5
SKIP
ENDREPEAT
@ 14,0 SAY CEN('and windows can scroll down',80)
DELAY .5
@ 16,0 SAY 'STYLE COL DESCRIPTION QUANT COST'
SCROLL SRI VPI VPIN SCROLL
SR-Info/VP-Info Reference Manual Page 337 SECTION 4
DELAY .5
SELECT 2
REPEAT 5 TIMES VARYING i
? style,color,descript,quant,cost,i
SKIP
DELAY .5
ENDREPEAT
REPEAT 5 TIMES
SCROLL 21 17
@ 17,0
?? style,color,descript,quant,cost
DELAY .5
SKIP
ENDREPEAT
SCROLL SRI VPI VPIN SCROLL
SR-Info/VP-Info Reference Manual Page 338 SECTION 4
SEEK
Find the last record matching a given FIND string by its index in the
selected data file.
╔════════════════════════════════════════════════════════════════════╗
║ SEEK <char exp> ║
║ VP-Info Professional only ║
║ ║
║ <char exp> expression to be evaluated and found in the current ║
║ index ║
╚════════════════════════════════════════════════════════════════════╝
SEEK is one of a family of commands that finds a record in an
indexed data file by matching a given string with key values in the
index file:
SEEK is identical to FIND, except that it searches for the match
to the value of a character expression instead of a string
constant (VP-Info Professional only) (no-find positions the
file at the top of file)
FIND positions the file on the first record in the index matching
the LAST string (no-find positions the file at the top of
file)
LAST positions the file on the last record in the index matching
the FIND string (VP-Info Professional only) (no-find
positions the file at the top of file)
NEAREST positions the file on the first record in the index equal
to or greater than the FIND string (VP-Info Professional
only)
All forms allow a search to be made on a character expression
when the expression if preceded by the macro symbol "&". When the
variable var='TAYLOR', all of the following command lines are
equivalent:
SEEK var
FIND &var
SEEK &var
If SET DELETE ON, deleted records will not be found. (See the
command SET.)
Numbers must always be treated as strings, even if the key
expression is a numeric field. If NUM is a numeric field of width 2,
FIND 1 will not find 1, but SEEK STR(1,2) or SEEK ' 1' will be
successful.
SEEK VPI VPIN SEEK
SR-Info/VP-Info Reference Manual Page 339 SECTION 4
When SEEK is successful, the value of the current record pointer
(as shown by the # and RECNO( functions) is set to the current record
number, and the system variable :NEAR is set to the same number.
If the record is not found, the current record pointer will be
set to 0 and the value of :NEAR will be set to the number of the first
record in the index with an index key greater than the FIND string; if
the index contains no key greater than the FIND string, :NEAR is set
to the bottom of the file and EOF( is set to T (true).
SEEK VPI VPIN SEEK
SR-Info/VP-Info Reference Manual Page 340 SECTION 4
SELECT
Select the file number to work with.
╔════════════════════════════════════════════════════════════════════╗
║ SELECT <num const>/PRIMARY/SECONDARY ║
║ ║
║ <num const> a file number between 1 and 6 SR-Info or between ║
║ 1 and 10 VP-Info ║
║ PRIMARY same as 1 ║
║ SECONDARY same as 2 ║
╚════════════════════════════════════════════════════════════════════╝
This command selects a file number, <num const>. Once this
number has been selected, the data files opened with the USE command
will be referred to as file <num const>.
(For compatibility with older VP-Info programs, file 1 is also
called the PRIMARY file and File 2 is also called the SECONDARY file.)
In SR-Info and VP-Info, there can be six or ten data files open
at the same time; each must have a different file number.
SELECT 1, SELECT 2, and so on are regarded as command verbs; no
part of the command can be in a macro.
Examples:
1>SELECT 4
4>SELECT SECONDARY
You can temporarily change the selected file by putting the file
number after the command keyword.
Example:
1>SELECT 1
1>USE invoice
1>USE#2 customer
1>LIST
The LIST command will list from the invoice file and the customer
file will be opened as file 2.
Note to dBASE programmers: No version of dBASE uses file numbers
the way SR-Info/VP-Info does, but both have a method of field
redirection that must be adjusted when porting dBASE applications to
SR-Info/VP-Info. dBASE II named fields in a different work area by
preceding the name with P. or S. to indicate Primary or Secondary work
SELECT SRI VPI VPIN SELECT
SR-Info/VP-Info Reference Manual Page 341 SECTION 4
area. dBASE III and later versions use aliases, established when the
file is opened with USE, that are linked to a field name with an arrow
(example: cust->name). Your first step in program conversion is
replacing these constructs with SR-Info/VP-Info file-numbering scheme
(example: cust#2).
SELECT SRI VPI VPIN SELECT
SR-Info/VP-Info Reference Manual Page 342 SECTION 4
SET
Set up environmental controls.
╔════════════════════════════════════════════════════════════════════╗
║ SET <param> ON/OFF ║
║ ║
║ <param> is chosen from the list: ║
║ ADD, ALTERNATE, ANSI, BELL, CARRY, CONFIRM, ║
║ CONSOLE, DEBUG, DELETED, DELIMITER, DISPLAY, ║
║ DIVZERO, DO, ECHO, EJECT, END, ERROR, ESCAPE, ║
║ EXACT, EXECUTION, FUNCTION, GET, HEADING, ║
║ INTENSITY, KEEP, LINE, LOCK, MENU, MONO, NETWORK, ║
║ PRINT, PROMPT, RAW, SAVE, SCREEN, SNOW, ║
║ STEP, TALK, TEXT, TRIM, UPPER, ZERO ║
╟────────────────────────────────────────────────────────────────────╢
║ Switch: ║
║ ║
║ ON or OFF ║
╚════════════════════════════════════════════════════════════════════╝
These parameters enable and disable certain features of
SR-Info/VP-Info. The features are explained below.
SR-Info/VP-Info comes with some of these features on, and some
off; an asterisk marks the default.
Parameter Switch Explanation:
ADD ON When doing a POST, and the find is unsuccessful, a
record will be appended to the Master File, the
non-numeric fields of the Master File record
will be replaced by the matching fields in the
Transaction File record, and, the posting is
done to the new record.
*OFF When doing a POST, and the find is unsuccessful,
an error message is sent.
ALTERNATE ON An alternative to SET PRINT ON and SET FORMAT TO
PRINT commands: output that would be sent to
the printer is sent to a disk text file
instead. The name of the disk file is
specified in the SET ALTERNATE TO <file>
command (see also SET ALTERNATE TO. SET PRINT
ON is ignored when SET ALTERNATE ON.
*OFF Stop sending output to the disk file. (NOTE: SET
PRINT OFF also sets ALTERNATE OFF if ALTERNATE
ON. Do not mix SET PRINT and SET ALTERNATE
commands, however; only use these commands in
ON/OFF pairs.)
SET SRI VPI VPIN SET
SR-Info/VP-Info Reference Manual Page 343 SECTION 4
ANSI ON ANSI.SYS is no longer supported for terminal
emulations by SR-Info/VP-Info, but the SET ANSI
command is allowed for compatibility with
programs written for earlier versions. It has
no effect.
*OFF SET ANSI has no effect in SR-Info/VP-Info.
BELL *ON The computer rings the bell whenever illegal data
is entered or when data input goes from an
editing field to the next editing field.
OFF Bell is turned off.
CARRY ON When in APPEND or the append mode of EDIT, make
the appended record identical to the current
record.
*OFF Appended records are blank.
CONFIRM ON In full-screen editing, data entry into an editing
field must be terminated by pressing <ENTER>.
(When filling a numeric field, this condition
will drop the last numeric character, the one
under the cursor. The remedy is to make the
input picture one character wider.)
*OFF Once an editing field is filled, data entry
proceeds to the next editing field.
CONSOLE *ON The output directed to the screen goes to the
screen. This flag is always set when <Esc> is
pressed or SR-Info/VP-Info stops execution on
an error.
OFF All output directed to the screen is suppressed.
(Note, however, that scrolling is not
suppressed by this command, so existing
material on the screen can be scrolled off the
top of the screen. Consider directing screen
output to a background screen instead of SET
CONSOLE OFF.)
DEBUG ON Activate all the DEBUG print commands.
*OFF Ignore all the DEBUG print commands.
DELETED ON All records with the DELETED flag are ignored by
all the commands except the GOTO command.
*OFF Records with the DELETED flag are listed, found
with FIND, etc., but marked as DELETED
(however, these records are never appended,
averaged, copied, counted, summed, totalled, or
reported).
SET SRI VPI VPIN SET
SR-Info/VP-Info Reference Manual Page 344 SECTION 4
DELIMITER ON The editing fields in the @ GET, EDIT, BROWSE,
TEXT (@ and % macros) commands are bounded by
colons.
*OFF These editing fields are not bounded by colons.
DISPLAY *ON Displayed macros are immediately updated in a TEXT
during READ when their values are changed in an
ON FIELD structure.
OFF Displayed TEXT macros are not updated during READ.
DIVZERO ON Division by zero is permitted and does not cause
execution of a program to cease with an error
message; the result of division by zero is
arbitrarily set at zero.
*OFF Division by zero is not permitted and causes
program execution to abort with an error
message.
DO *ON Subroutines are compiled as overlays to the
calling program (see DO command).
OFF Subroutines are not compiled in the calling
program. Instead, the compile produces files
containing the compiled environment for the
subroutines (with the extension ENV). May be
useful in developing and debugging very complex
applications.
ECHO ON When compiling a SR-Info/VP-Info program
(including the compiling done on-the-fly before
running an uncompiled program), the program
lines are shown on the screen as they are
compiled; it has no effect while programs are
actually being executed.
*OFF Program lines are not shown.
EJECT *ON In a report form file, the EJECT line will send a
form feed character after each subtotal.
OFF In a report form file, the EJECT line will send
enough carriage returns to move the paper in
the printer to the form depth set by the SET
LENGTH TO command (default is 66).
SET SRI VPI VPIN SET
SR-Info/VP-Info Reference Manual Page 345 SECTION 4
END *ON During READ while SET FUNCTION OFF, pressing any
function key has the same effect as pressing
<End>; READ is exited and the function key
number is stored into :KEY.
OFF If SET FUNCTION OFF, then all function keys give a
carriage return and line feed combination
(leave input field) and the function key number
is stored in :KEY. READ is not exited, but
action can be controlled in an ON FIELD
structure.
ERROR *ON If an ON ERROR structure is in effect, it is
executed in event of an error.
OFF An active ON ERROR structure is ignored and
SR-Info/VP-Info reacts as though the structure
did not exist.
ESCAPE *ON Hitting <Esc> aborts program execution, or if an
ON ESCAPE structure is in effect, program
execution jumps to the start of the structure.
OFF <Esc> is ignored.
EXACT ON Whenever strings are compared for equality (in
conditions, or when invoking FIND), all
characters in both strings, including trailing
blanks, are compared, and only perfect matches
are true. Thus 'ABCD'='ABC' is false, and FIND
ABC will not find 'ABCD'.
*OFF Whenever strings are compared for equality,
trailing blanks are ignored, and only the
number of characters to the right of the = sign
are compared. Thus 'ABCD'='ABC' is true, and
FIND ABC will find 'ABCD' (if 'ABCD' is the
first record key starting with 'ABC').
EXECUTION ON All FIELD modules in an ON FIELD structure are
executed before exiting READ (or the current
record in BROWSE OFF and EDIT OFF), as well as
when leaving their respective input fields.
*OFF FIELD modules are executed only when leaving their
respective input fields.
FUNCTION *ON Function keys display values stored in them when
pressed.
*OFF Disable the usual functions of the function keys
<F1> to <F10>. Pressing a function key will
produce a Ctrl-W (or a carriage return/line
feed if SET END OFF); the number of the
function key pressed is available to the
programmer in the :KEY system variable.
SET SRI VPI VPIN SET
SR-Info/VP-Info Reference Manual Page 346 SECTION 4
GET ON A Get Table is maintained when calling a sub-
program; it is, therefore, still in effect upon
return from the sub-program, provided it is not
cleared in the sub-program. (A Get Table is
cleared either with the CLEAR GETS command, or
by creating a get with TEXT or an @ GET command
after a READ command.)
*OFF A Get Table is cleared whenever program execution
leaves a sub-program.
HEADING ON Field names are displayed over each column during
LIST and DISPLAY command execution. If fields
names are longer than column width, the name is
truncated as in BROWSE. Headings are not
displayed if an expression list is given on the
LIST or DISPLAY command line.
*OFF Field names are not displayed with LIST and
DISPLAY.
INTENSITY *ON The editing fields in full-screen editing are
shown in reverse video.
OFF Editing fields are shown in normal video.
KEEP ON When a TEXT file is read from the disk, it is
stored in memory so that subsequent calls for
the same TEXT will use the version in memory
instead of reading it in from the disk again.
*OFF The disk is accessed every time the TEXT file is
called. Note: If the TEXT filename is a macro
or variable name, SR-Info/VP-Info always goes
to the disk for the text whether SET KEEP is ON
or OFF.
LINE *ON Place line numbers in compiled program to be used
with error messages.
OFF No line numbers in compiled program.
LOCK ON VP-Info Professional Network Edition only. All
data file records are automatically locked
whenever the user is positioned on them.
*OFF Records are not automatically locked.
MENU ON Display the meaning of the editing keys for EDIT
and BROWSE.
*OFF No editing keys displayed.
MONO ON A monochrome monitor is used. (Has no default.
Not required unless both monochrome and color
adapters are present in your computer; put the
appropriate command in your CNF file.)
OFF A color monitor is used.
SET SRI VPI VPIN SET
SR-Info/VP-Info Reference Manual Page 347 SECTION 4
NETWORK ON Turn network facilities on (VP-Info Professional
Network Edition only; enables the user to LOCK
and UNLOCK records on any network or multi-user
system adhering to the standard conventions of
Microsoft DOS 3.1 and above. See SET NETWORK
TO command).
*OFF Network facilities are not turned on (VP-Info
Professional Network Edition only).
PRINT ON Output produced such by relative display commands
as LIST, DISPLAY, ?, and ?? is sent to a
printer (or to a text file if SPOOL is in
effect). In the interactive mode, the effect
of SET PRINT ON is turned off when the prompt
appears, so that the commands will not be
printed. SR-Info/VP-Info will continue
printing the results of the commands.
*OFF The output is sent to the screen. This flag is
always set OFF when <Esc> is pressed or an
error is encountered while running a program.
PROMPT ON A dot prompt, as in dBASE.
*OFF The n> prompt, where n is the file number.
RAW ON No blanks separate the expressions when the
DISPLAY or LIST command is used with an
expression list (see ?, ??, DISPLAY, and LIST).
*OFF Blanks are placed between expressions.
SAVE *ON Changes are saved to disk when the user leaves a
changed record or closes the data file.
OFF Changes are not written to disk.
SCREEN *ON SCREEN command works as described under SCREEN
command.
OFF When screens are switched with SCREEN command,
cursor position and color attributes are not
saved or restored. (Provided only to allow
user to force compatibility with early versions
of VP-Info.
SNOW *ON When using a CGA color monitor and some other
monitor types, SR-Info/VP-Info may cause screen
flicker called "snow."
OFF Snow is suppressed, at a cost of slowing screen
displays.
SET SRI VPI VPIN SET
SR-Info/VP-Info Reference Manual Page 348 SECTION 4
STEP ON Execute a SR-Info/VP-Info program a line at a time
(with SET LINE ON, the line numbers will be
displayed on the top line of the screen
display).
*OFF Execute SR-Info/VP-Info programs continuously.
TALK *ON SR-Info/VP-Info messages from commands are
displayed. This flag is always set when <Esc>
is pressed and when the conversational mode is
entered.
OFF Messages are not displayed.
TEXT *ON The TEXT display macros created with & and # are
put into the Get Table; usually required for
input screens created with TEXT.
OFF Display macros are not put into the Get Table;
usually required when using TEXT for printer
output, as in mail-merge programs.
TRIM *ON The & macro in TEXT trims string variables.
OFF The trimming is turned off.
UPPER ON All keyboard-input characters from "a" to "z" are
forced to upper case "A" to "Z"; a software
"Caps Lock".
*OFF Lower-case keyboard entry is not altered.
ZERO *ON Display zeros whenever the numeric value zero must
be displayed.
OFF If the value zero has to be displayed, display
blanks instead.
SET SRI VPI VPIN SET
SR-Info/VP-Info Reference Manual Page 349 SECTION 4
SET ALTERNATE
Specify text file for output.
╔════════════════════════════════════════════════════════════════════╗
║ SET ALTERNATE TO <file> ║
║ ║
║ <file> text file name ║
╚════════════════════════════════════════════════════════════════════╝
The command SET ALTERNATE specifies the text file to be used when
the SET ALTERNATE ON command is given. The default extension of the
file is TXT. If the file already exists, the new data is appended at
the end. (See SET ALTERNATE ON under the SET command.)
All data that would normally go to the printer is sent to this
file.
Example:
SET ALTERNATE TO record
SET ALTERNATE ON
@ 10,0 SAY 'This goes to RECORD.TXT'
SET ALTERNATE OFF
SET ALTERNATE SRI VPI VPIN SET ALTERNATE
SR-Info/VP-Info Reference Manual Page 350 SECTION 4
SET COLOR
Set the attribute byte of the characters to be displayed.
╔════════════════════════════════════════════════════════════════════╗
║ SET COLOR TO <attrib> ║
║ ║
║ <attrib> numeric expression, the attribute byte: 0 to 255 ║
╚════════════════════════════════════════════════════════════════════╝
This command sets the attribute byte of all characters to be
displayed on the screen, and updates the system variable :COLOR with
<attrib>. SET COLOR TO 0 returns to the normal mode. An alternative
way of getting the same result is:
:COLOR=<attrib>
These commands work with standard IBM monochrome and color
monitors.
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 blink, or any combination of them. The important numbers
are:
standard characters 7
underline 1
reverse video 112
to get bold: add 8
to make it blink: add 128
For color monitors, both the background and the character has
color. 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
SET COLOR SRI VPI VPIN SET COLOR
SR-Info/VP-Info Reference Manual Page 351 SECTION 4
2 - green
3 - cyan
4 - red
5 - magenta
6 - brown
7 - white
blink 0 - no blink
128 - blink
brightness 0 - normal
8 - intense
See also the COLOR command for setting the attribute bytes for a
rectangular part of the screen.
Examples:
1>SET COLOR TO 7 ;white on black, the mono default
1>SET COLOR TO 48 ;black on light blue, the color default
1>SET COLOR TO 58 ;bright green on light blue (48+8+2)
1>SET COLOR TO 96 ;black on gold
1>SET COLOR TO 112 ;black on white...the mono reverse
SET COLOR SRI VPI VPIN SET COLOR
SR-Info/VP-Info Reference Manual Page 352 SECTION 4
SET DATE
Set the default form for dates.
╔════════════════════════════════════════════════════════════════════╗
║ SET DATE TO <str exp> ║
║ ║
║ <str exp> the default date format ║
╚════════════════════════════════════════════════════════════════════╝
This command, in conjunction with the date function DATE(7,
<str exp>), is designed to give control over input of dates. The
order of the day, month, and the year, and the number of digits in
year (2 or 4), is controlled as follows:
SET DATE TO formats '12/31/1991' as follows:
'mmddyy' 123191
'ddmmyy' 312191
'yymmdd' 911231
'mmddyyyy' 12311991
'ddmmyyyy' 31121991
'yyyymmdd' 19911231
These are the six available options.
SET DATE SRI VPI VPIN SET DATE
SR-Info/VP-Info Reference Manual Page 353 SECTION 4
SET DEFAULT
Set the drive letter of the default disk drive for data and index
files.
╔════════════════════════════════════════════════════════════════════╗
║ SET DEFAULT TO <drive letter> ║
║ ║
║ <drive letter> the drive letter of the default drive ║
╚════════════════════════════════════════════════════════════════════╝
This command sets the drive letter of the default drive for data
and index files. If this drive letter is, say, C, every data and
index file will be searched for on drive C, unless the file name
contains an explicit drive letter.
This command will rarely be used, but is provided for
compatibility with older versions of SR-Info/VP-Info. Most users will
prefer the extra flexibility of the FILES command, the FILES ...
ENDFILES structure, and the SET DIR command. The first two allow you
to specify exactly where specific files and groups of files are to be
found, and the third actually "logs" you onto any disk and/or
directory.
See the FILES command, the FILES ... ENDFILES structure, and the
SET DIR command.
Example:
1>SET DEFAULT TO C
1>USE employee INDEX a:emp2
In this example, the data file EMPLOYEE.DBF will be looked up on
drive C:; however, the index file EMP2.NDX will be fetched from
drive A:.
SET DEFAULT SRI VPI VPIN SET DEFAULT
SR-Info/VP-Info Reference Manual Page 354 SECTION 4
SET DIR
Change drive and/or current directory.
╔════════════════════════════════════════════════════════════════════╗
║ SET DIR TO [<drive>:][<directory>] ║
║ ║
║ <drive> the drive letter of the new default drive ║
║ <directory> the directory name (according to DOS rules) ║
╚════════════════════════════════════════════════════════════════════╝
This command changes the current drive and/or the current
directory; equivalent to combining the DOS commands change drive and
CHDIR (CD)..
Contrast this with the FILES and SET DEFAULT TO commands, which
only tell SR-Info/VP-Info where to look for certain categories of
files without changing the user's current position on the disk. Exit
from SR-Info/VP-Info after SET DIR is in the new directory on the new
drive.
If <drive> is not specified, the new directory is on the same
drive. If directory is not specified, the new directory will be the
last directory DOS changed to on the target drive or, if no directory
has been changed to, the root of that drive.
If <directory> begins with a backslash (example \DATA), the
directory will be off the root; if not, the directory will be off the
directory onto which the user is currently logged.
If the <drive> is invalid, no message will be given, but the
change will not take place. If no <drive> is given and the <directory>
is invalid, again no change will occur. However, if <drive> is valid
and <directory> is invalid, the drive will change and the user will be
logged into the current directory on that drive.
The current drive and directory can be checked with the :DIR
system variable, which always contains the current drive and directory
(example C:\INFO).
`
Caution: If you change directories within SR-Info/VP-Info,
you may lose track of where some of your files are. This is
particularly likely if you have a FILES structure in use without
full path names giving both drive letter and leading backslash on
the directory.
Example:
1>SET DIR TO D:\UTIL
SET DIR SRI VPI VPIN SET DIR
SR-Info/VP-Info Reference Manual Page 355 SECTION 4
1>? :DIR
D:\UTIL
SET DIR SRI VPI VPIN SET DIR
SR-Info/VP-Info Reference Manual Page 356 SECTION 4
SET FIELDS
An obsolete command retained in the language for compatibility with
earlier versions of VP-Info.
╔════════════════════════════════════════════════════════════════════╗
║ SET FIELDS TO <num const> ║
║ ║
║ <num const> the number of fields ║
╚════════════════════════════════════════════════════════════════════╝
This command is ignored in SR-Info/VP-Info. In VP-Info
Professional, its role is taken by the FILES= command in the VPI.SET
file.
SET FIELDS SRI VPI VPIN SET FIELDS
SR-Info/VP-Info Reference Manual Page 357 SECTION 4
SET FILTER
Set a condition which applies to all subsequent data-file commands.
╔════════════════════════════════════════════════════════════════════╗
║ SET FILTER TO [<cond>] ║
║ ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <cond> the condition applied to all subsequent data-file ║
║ commands ║
╚════════════════════════════════════════════════════════════════════╝
Most command that use data files (LIST, REPLACE, REPORT, etc.)
allow a selection condition to be specified with a FOR clause.
SR-Info/VP-Info also allows a global condition to be attached to
all data-file commands, including many that do not allow a FOR clause,
including SORT, EDIT, and BROWSE.
The filter is turned off with FILTER TO without a condition.
While a filter is in effect, a FOR clause can be used with
commands to limit further the records subject to the command.
Examples:
1. Browse a filtered data file:
1>SET FILTER TO amt:due>0
1>BROWSE
2. Produce a listing of payables due to vendors in California,
only if there is actually an amount due.
1>SET FILTER TO amt:due>0
1>REPORT owing FOR state='CA'
SET FILTER SRI VPI VPIN SET FILTER
SR-Info/VP-Info Reference Manual Page 358 SECTION 4
SET FORMAT
Directs the @ SAY commands to screen or printer.
╔════════════════════════════════════════════════════════════════════╗
║ SET FORMAT TO SCREEN/PRINT ║
╟────────────────────────────────────────────────────────────────────╢
║ Switch: ║
║ ║
║ SCREEN send output to screen; the default ║
║ PRINT send output to printer ║
╚════════════════════════════════════════════════════════════════════╝
SET FORMAT TO SCREEN or PRINT is used to send data formatted with
the @ SAY command to the screen or the printer (but not to both). The
default is SCREEN. (See the command @.) The default is always set
when <Esc> is pressed.
IF SPOOL or SET ALTERNATE TO has redirected print output to a
disk file, SET FORMAT TO PRINT will cause output to go into the disk
file.
SET FORMAT SRI VPI VPIN SET FORMAT
SR-Info/VP-Info Reference Manual Page 359 SECTION 4
SET INDEX
Specify index files.
╔════════════════════════════════════════════════════════════════════╗
║ SET INDEX TO ║
║ SET INDEX TO <file> ║
║ SET INDEX TO <file list> ║
║ SET INDEX TO <num const> ║
║ ║
║ <file> the name of the index file ║
║ <file list> a list of up to 7 index files ║
║ <num const> a number between 1 and 7 ║
╚════════════════════════════════════════════════════════════════════╝
The command SET INDEX TO specifies the index file(s) to be used
with the selected data file. If more than one index file is given,
the first index file will be used as the Master Index. The Master
Index is used by the FIND command, and all the display type commands
(BROWSE, LIST). However, all the index files specified in the list
are maintained by the commands that add or edit records (APPEND, EDIT,
@ GET, and so on).
The Master Index can be changed with the SET INDEX TO <num const>
command. The index files are assigned numbers when they are activated
in a file list. Say, SET INDEX TO 3, makes the third on the list the
Master Index. This involves no disk action; no file is opened or
closed.
Index files can also be opened with the USE command (see USE).
SET INDEX TO with no file name, closes all the index files for
the selected data file, but the data file is not closed. Index files
are also closed when the data file is closed. (See the commands CLOSE
and USE.)
Examples:
1>USE employee
1>SET INDEX TO employee,empl2,empl3
1>LIST
1>SET INDEX TO 3 ; makes empl3 the Master Index
1>SET INDEX TO ; closes all index files for the selected file
SET INDEX SRI VPI VPIN SET INDEX
SR-Info/VP-Info Reference Manual Page 360 SECTION 4
SET LENGTH
Set page depth for the printer when the printer does not support a
standard formfeed control character.
╔════════════════════════════════════════════════════════════════════╗
║ SET LENGTH TO <num exp> ║
║ ║
║ <num exp> the page depth ║
╚════════════════════════════════════════════════════════════════════╝
The page depth is the number of lines from the top of the page to
the very bottom of the page. If the SET LENGTH command is not used,
page depth is assumed to be 66.
Warning: SET LENGTH does not set how many lines will be printed
on a page but the physical size of the page. This command is used if
the page depth is unusual (e.g., filling in a preprinted form), or if
the usual 6 line per inch printing is changed, say, to 8 lines per
inch.
Example:
1>SET LENGTH TO 40
SET LENGTH SRI VPI VPIN SET LENGTH
SR-Info/VP-Info Reference Manual Page 361 SECTION 4
SET LIBRARY
Set the drive letter of the default disk drive for data and index
files.
╔════════════════════════════════════════════════════════════════════╗
║ SET LIBRARY TO <library> ║
║ ║
║ <library> a library file, default extension LIB ║
╚════════════════════════════════════════════════════════════════════╝
This opens a special form of file called a library, which
contains up to 65,000 library entries each of 256 bytes. Library
entries are automatically combined into volumes of up to about 20,000
characters by creation of an internal linked list, analogous to the
way DOS links disk clusters together to make large disk files.
If the <library> does not exist, it will be created. The default
extension for library files is LIB.
Library volumes can be created only with the WRITE command, and
output only with the TEXT command (although a programmer can also
access the data through use of the sequential file functions SEEK(,
GET(, and PUT( if sufficiently skilled).
Both WRITE and TEXT distinguish between standard disk files and
volume numbers in their command lines by preceding volume numbers with
a period. Do not mistake this usage for a decimal number.
Technical information for experienced programmers: the structure
of a library file is as follows:
Header:
Bits 0 and 1 next volume to be added, an unsigned
integer
Bits 2 and 3 next available volume, an unsigned
integer; may be less than next to be
added because existing volumes may
have been released with REMLIB(
function or shortened with WRITE
Bits 4 through 15 unused
Each volume:
Bits 0 through 253 the text contents of the volume; end of
file indicated by 1A hex
Bits 254 and 255 a pointer to the next part of the
volume, an unsigned integer; if no
next part, pointer is null
SET LIBRARY SRI VPI VPIN SET LIBRARY
SR-Info/VP-Info Reference Manual Page 362 SECTION 4
Example:
1>SET LIBRARY TO screens
1>? :avail ;get number of next available volume
65.00
1>WRITE .:avail ;use WRITE to enter a file in volume 65
SET LIBRARY SRI VPI VPIN SET LIBRARY
SR-Info/VP-Info Reference Manual Page 363 SECTION 4
SET LINK
Set up a physical link between two data files.
╔════════════════════════════════════════════════════════════════════╗
║ SET LINK TO <num const> ║
║ SET LINK OFF ║
║ ║
║ <num const> the selected file is linked to the file with ║
║ this file number ║
╚════════════════════════════════════════════════════════════════════╝
The command SET LINK TO sets up a link between two files by
record number. After the link is set up between the selected file and
another file, as the record pointer is moved in the selected file (for
instance, with GO, FIND, or LIST), the record pointer in the other
file is similarly moved. If the selected file has more records, once
the record number is too large for the other file, its current record
number pointer will stay on the last record.
SET LINK OFF turns off the linkage (if any) from the selected
file.
The command SET LINK TO temporarily "creates" data files with
more than 32 fields from data files with such limits. Data files
which permanently have more than 32 fields can be created with the
CREATE command.
SET LINK TO can "chain" many files together.
1>SET LINK TO 2
1>SET#2 LINK TO 4
1>SET#4 LINK TO 6
links together the files 1, 2, 4, and 6.
There can be only one SET LINK TO command from any one file.
2>SET LINK TO 3
2>SET LINK TO 4
The second command overrules the first.
SET LINK SRI VPI VPIN SET LINK
SR-Info/VP-Info Reference Manual Page 364 SECTION 4
It is the user's responsibility to make sure that there are no
"loops" such as in:
1>SET LINK TO 2
1>SELECT 2
2>SET LINK TO 1
If SET LINK is used, SET RELATION should be avoided.
SET LINK SRI VPI VPIN SET LINK
SR-Info/VP-Info Reference Manual Page 365 SECTION 4
SET MARGIN
Specify text margin for printer.
╔════════════════════════════════════════════════════════════════════╗
║ SET MARGIN TO <num exp> ║
║ ║
║ <num exp> the margin ║
╚════════════════════════════════════════════════════════════════════╝
The command SET MARGIN sets the left margin for the printer.
This command can be used in conjunction with any command that sends
output to the printer. See the commands SET PRINT ON, SET FORMAT TO
PRINT, SET WIDTH, and TEXT.
Example:
SET PRINT ON
SET MARGIN TO 5
? 'This is indented'
Prints:
This is indented.
SET MARGIN SRI VPI VPIN SET MARGIN
SR-Info/VP-Info Reference Manual Page 366 SECTION 4
SET MEMORY
An obsolete command retained in the language for compatibility with
earlier versions of VP-Info.
╔════════════════════════════════════════════════════════════════════╗
║ SET MEMORY TO <num const> ║
║ ║
║ <num const> the amount of memory reserved for high memory ║
╚════════════════════════════════════════════════════════════════════╝
This command is ignored in SR-Info/VP-Info. In VP-Info
Professional, its role is taken by the MEMORY= command in the VPI.SET
file.
SET MEMORY SRI VPI VPIN SET MEMORY
SR-Info/VP-Info Reference Manual Page 367 SECTION 4
SET NETWORK
Specify the network.
╔════════════════════════════════════════════════════════════════════╗
║ SET NETWORK TO <num exp> ║
║ SET NETWORK ON/OFF ║
║ ║
║ <num exp> the network number ║
╚════════════════════════════════════════════════════════════════════╝
This command enables the user to LOCK and UNLOCK records on any
network or multi-user system adhering to the standard conventions of
Microsoft DOS 3.1 and above.
The network calls are turned on with SET NETWORK TO 1 or SET
NETWORK ON.
The network calls are turned off with SET NETWORK TO 0 or SET
NETWORK OFF.
Caution: Do not SET NETWORK ON when the SHARE command or your
network's equivalent is in effect, or run with SET NETWORK OFF while
SHARE is in effect. If you want to run VP-Info Professional Network
Edition in both modes, start from different directories depending on
whether the network is loaded. Put SET NETWORK ON in the VPIN.CNF
file in one directory, and SET NETWORK OFF in the other.
Examples:
1>SET NETWORK TO 1
1>SET NETWORK TO 0
1>SET NETWORK ON
SET SRI VPI VPIN SET
SR-Info/VP-Info Reference Manual Page 368 SECTION 4
SET RELATION
Set up a relation between the selected file and another indexed data
file.
╔════════════════════════════════════════════════════════════════════╗
║ SET RELATION ON <str exp> TO <num const> ║
║ SET RELATION OFF ║
║ ║
║ <str exp> the key of the relation ║
║ <num const> the relation is set between the selected file ║
║ and file <num const> ║
╚════════════════════════════════════════════════════════════════════╝
<str exp> is an expression made up of fields (of character type)
of the selected file, string constants, and string variables.
Any time the current record pointer is changed for the selected
file, <str exp> is evaluated, and a FIND is made with the result in
the file <num const>.
A file can be related to a number of other files: 1 is related to
2, 1 is related to 3, 1 is related to 4 (file 1 has 3 fields on which
additional information is available in files 2, 3, and 4); 1 is
related to 2, 1 is related to 3, and 3 is related to 4 (the
information linking 1 and 3 has additional data on file 4).
Relations can also be chained: 1 is related to 2, 2 is related to
3, and 3 is related to 4.
However, only one file can SET RELATION TO a given file: you
cannot have both 1 related to 6 and 2 related to 6.
It is the user's responsibility to make sure that there is no
loop, such as 1 related to 2, 2 related to 3, and 3 related to 1.
To disable a relation, SET RELATION OFF, close either the
selected file or the target file, of close the indexes on the target
file.
Examples:
1>USE order
1>USE#3 customer
1>INDEX#3 ON cust:no TO customer
3 RECORDS IN TOTAL INDEXED
1>SET RELATION ON cust:no TO 3
1>LIST order:no,fname#3,name#3
1 10001 Robert Steen
SET RELATION SRI VPI VPIN SET RELATION
SR-Info/VP-Info Reference Manual Page 369 SECTION 4
NO FIND
2 10002
3 10003 Joe Smiths
NO FIND
4 10004
5 10005 Robert Steen
1>SET RELATION OFF
Note: the first order has CUST:NO 0050; this was found in the
customer file, and the customer name was listed. The second order has
CUST:NO 105; there is no such customer in the customer file, so a NO
FIND message is sent (this can be turned off in programs only with SET
TALK OFF), and only the ORDER:NO was listed.
SET RELATION SRI VPI VPIN SET RELATION
SR-Info/VP-Info Reference Manual Page 370 SECTION 4
SET WIDTH
Specify text width for printer.
╔════════════════════════════════════════════════════════════════════╗
║ SET WIDTH TO <num exp> ║
║ ║
║ <num exp> page width ║
╚════════════════════════════════════════════════════════════════════╝
The command SET WIDTH sets the page width (number of characters
per line) for the TEXT and REPORT commands. The WIDTH is the width of
the text from the left margin; the default is 80. So if the commands:
SET MARGIN TO 10
SET WIDTH TO 50
are given, TEXT will wrap the words at character position 60.
When a matrix variable is displayed, it is wrapped by the value
set by SET WIDTH.
The only aspect of a report that is affected by SET WIDTH TO is
the number of characters over which its heading is positioned. It has
no effect on the report columns themselves.
See the commands SET MARGIN, SET PRINT ON, SET FORMAT TO PRINT,
and TEXT.
Examples:
1. Program segment:
SET WIDTH TO 40
TEXT
This is a nice long sentence to illustrate SET WIDTH.
ENDTEXT
Prints:
This is a nice long sentence to
illustrate SET WIDTH.
2. Program segment:
SET WIDTH TO 80
TEXT
This is a nice long sentence to illustrate SET WIDTH.
ENDTEXT
SET WIDTH SRI VPI VPIN SET WIDTH
SR-Info/VP-Info Reference Manual Page 371 SECTION 4
Prints:
This is a nice long sentence to illustrate SET WIDTH.
3. 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
SET WIDTH SRI VPI VPIN SET WIDTH
SR-Info/VP-Info Reference Manual Page 372 SECTION 4
SKIP
Move ahead or back in data file.
╔════════════════════════════════════════════════════════════════════╗
║ SKIP [<num exp>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <num exp> by this many records; may be positive (forward) or ║
║ negative (backward); default 1 record forward ║
╚════════════════════════════════════════════════════════════════════╝
The command SKIP moves the current record pointer ahead or back
in the selected data file.
SKIP by itself advances the record pointer to the next record.
If you SKIP ahead more records than there are records left in the
data file, then the current record becomes the last record. Skipping
past the last record sets the function EOF true.
If you SKIP too many records back, the current record pointer
will be set to 0.
If there is an index file, ahead and back is understood in the
indexed order.
Examples:
1>USE employee
1>? #
1.00
1>SKIP
1>? #,EOF
2.00 F
1>SKIP 5
1>? #,EOF
6.00 T
1>SKIP -2
1>? #,EOF
4.00 F
1>SKIP -10,EOF
1>? #
0.00 F
SKIP SRI VPI VPIN SKIP
SR-Info/VP-Info Reference Manual Page 373 SECTION 4
SORT
Sort the selected data file into another data file.
╔════════════════════════════════════════════════════════════════════╗
║ SORT ON <str exp> TO <file> ║
║ ║
║ <str exp> the key of the sort ║
║ <file> the data file to contain the result of the sort ║
╚════════════════════════════════════════════════════════════════════╝
This command sorts the selected data file to the data file
specified. The sort is done by evaluating the <str exp>, creating a
temporary index, and copying the file to <file>.
Example:
1>USE employee
1>SORT ON name+fname TO empl2
This is equivalent to the following:
1>USE employee
1>INDEX ON name+fname TO temp
1>COPY TO empl2
However, the second version has the advantage of allowing a field
list and FOR clause, and output as an SDF file, none of which is
available in SORT.
For example, suppose the intention is to create a small, sorted
data file with only name and address information on single employees
for use by the company social club for a mailing about an upcoming
event.
The correct way to accomplish this is:
1>USE employee
1>INDEX ON name+fname TO temp FOR .NOT. married
1>COPY TO empl2 FIELDS fname,name,addr,city,state,zip,tel_no
See COPY and INDEX.
SORT SRI VPI VPIN SORT
SR-Info/VP-Info Reference Manual Page 374 SECTION 4
SOUND
Use the computer speaker to generate a sound effect.
╔════════════════════════════════════════════════════════════════════╗
║ SOUND <numeric exp> ║
║ VP-Info Professional only ║
║ ║
║ <numeric exp> the number of the sound required ║
╚════════════════════════════════════════════════════════════════════╝
When effects are enabled (i.e., the NOEFFECTS keyword is not in
the VPI.SET file), SOUND activates the computer speaker with one of a
library of sounds effects.
At publication time, there are 13 preprogrammed sound effects,
numbered 1 through 13. SOUND 0 terminates any sound. Values outside
the range 0 through 13 are ignored.
As naming the effects is not meaningful, VP-Info Professional
users are urged to run the program example below and try all of them.
Note that effect 2 continues until another sound is activated or
SOUND 0 is executed; all other effects have defined duration.
The command RING actually executes SOUND 7.
Examples:
1>SOUND 3
A program to demonstrate all 13 effects:
CLS
REPEAT 13 TIMES VARYING effect
@ 10,35 SAY 'Effect'+STR(effect,3)
SOUND effect
DELAY 1 ;timed pause
SOUND 0 ;terminate sound if not self-terminating
ENDREPEAT
SOUND VPI VPIN SOUND
SR-Info/VP-Info Reference Manual Page 375 SECTION 4
SPOOL
Redirect printer output to disk file, or send disk file to printer.
╔════════════════════════════════════════════════════════════════════╗
║ Four forms: ║
║ 1. SPOOL <filename> ║
║ 2. SPOOL ║
║ 3. SPOOL <filename> TO <device> [PAGE <num exp>] ║
║ 4. SPOOL/T ║
║ ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ Form 1: Create file <filename> and direct print output to ║
║ that file; default extension TXT ║
║ Form 2: Close any open spool file and stop redirection ║
║ Form 3: Do background printing of <filename> on <device>, ║
║ usually PRN but can be any DOS device ║
║ PAGE <num exp> start printing on page <num exp> ║
║ Form 4: Stop background printint started with Firm 3 ║
╚════════════════════════════════════════════════════════════════════╝
This command allows printer output to be captured into a disk
file, and optionally spooled out to disk while other processing
continues. This command has four forms as follows:
1. Used with a filename, it creates a new spool file with
the name of filename (default extension TXT).
2. Used without a filename, SPOOL closes any open spool
file and restores printer as standard print device..
3. Used with both filename and device name, <filename> is
spooled to the specified DOS device, such as PRN, LPT1,
etc. If PAGE option is used with a page number (can be
an expression) prinnting starts with the top of that
page number.
4. Used with a slash-T (/T), spooling is terminated. This
is same symbol as used with the DOS PRINT command for
the same purpose.
If SPOOL is used to create a file, and a file already exists with
that name, the user in Conversational SR-Info/VP-Info is required to
confirm that the file should be overwritten; in programs, the existing
file is overwritten without prompting.
Examples:
SPOOL SRI VPI VPIN SPOOL
SR-Info/VP-Info Reference Manual Page 376 SECTION 4
1>SPOOL reports
1>REPORT custlist
1>SPOOL
1>SPOOL reports TO prn
SPOOL SRI VPI VPIN SPOOL
SR-Info/VP-Info Reference Manual Page 377 SECTION 4
STATUS
Display status information.
╔════════════════════════════════════════════════════════════════════╗
║ STATUS ║
╚════════════════════════════════════════════════════════════════════╝
If used in the interactive mode, this command displays two
screens of information on the status of SR-Info/VP-Info.
The first page lists the data files in use, the current record
numbers, which file number is selected (marked by an asterisk), the
expressions on which the index files had been indexed (the index file
names are not shown). In the example below, the lines:
Rec # File name Indexed by
0000008 *File 1 ... SALES.DBF SALESMAN+PART , PART , DATE
tell you that SALES.DBF is file 1; the asterisk shows that file 1 is
selected; the current record number is 8; there are three index files,
indexed by the expressions: SALESMAN+PART, PART, DATE.
Next, you find the setting of all the flags; ON is show as Y, OFF
as N.
The "Total space left" message gives the number of bytes left in
the 64K data space (see Appendix A).
SR-Info can use 20 files altogether, of which only 16 are
actually available to the user. VP-Info users with DOS 3.3 and above
can have up to 50 files open at one time, provided FILES= commands are
in both the CNF file and the CONFIG.SYS file in the root directory of
the boot drive, and both call for at least that number of files.
"Files in use" shows how many are being used; you can infer how many
are still available (16-4=12 in the standard setting, 46-4=42 if
FILES=50).
"High memory remaining" is the number of bytes available for use
by matrix variables and background-screen storage.
"Width" and "Left margin" show the most recent setting by SET
WIDTH and SET MARGIN, respectively, or the default.
In the example shown below, the top line shows NETWORK ON; when
not on, or when not using VP-Info Professional Network Edition, this
message is omitted. When SET NETWORK ON and data files are opened
with file modes (READ, WRITE, LOCK, or SHARE), the first letter of the
mode is shown immediately before the index expressions.
STATUS SRI VPI VPIN STATUS
SR-Info/VP-Info Reference Manual Page 378 SECTION 4
The second page of the STATUS display is the same as the listing
produced by the command LIST MEMORY.
If STATUS is a command in a program, the execution of the program
stops, the user can view the two screens, and then program execution
resumes. In this use of STATUS, the first page also shows the name of
the current program.
Example:
Give the commands:
1>number=21
1>name='David'
1>USE sales INDEX sales,part,date
1>STATUS
The display:
──────────────────────────────────────────────────────────────────────────────
Thursday, March 22, 1990 VP-Info STATUS NETWORK ON
Rec # File name Indexed by
0000001 *File 1 ... SALES.DBF W SALENUM , PARTNUM , DATE
0000000 File 2 ...
0000000 File 3 ...
0000000 File 4 ...
0000000 File 5 ...
0000000 File 6 ...
0000000 File 7 ...
0000000 File 8 ...
0000000 File 9 ...
0000000 File 10 ...
┌────────────┬────────────┬────────────┬────────────┬────────────┬────────────┐
│ Add...... N│ Delete... N│ End...... Y│ Heading.. N│ Print.... N│ Step..... N│
│ Alternate N│ Delim.... N│ Error.... Y│ Intensity Y│ Prompt... N│ Talk..... Y│
│ Bell..... N│ Display.. Y│ Escape... Y│ Keep..... Y│ Raw...... N│ Text..... N│
│ Carry.... N│ Divzero.. Y│ Exact.... N│ Line..... Y│ Save..... Y│ Trim..... Y│
│ Confirm.. N│ Do....... Y│ Execute.. Y│ Lock..... N│ Screen... Y│ Upper.... N│
│ Console.. Y│ Echo..... N│ Function. Y│ Menu..... Y│ Snow..... Y│ Zero..... Y│
│ Debug.... N│ Eject.... Y│ Get...... N│ Mono..... Y│ │ │
└────────────┴────────────┴────────────┴────────────┴────────────┴────────────┘
Program .............. GENERAL.PRG Files in use ......... 1
Memory remaining ..... 23490 High memory remaining. 39744
Width................. 80 Left margin .......... 0
──────────────────────────────────────────────────────────────────────────────
STATUS SRI VPI VPIN STATUS
SR-Info/VP-Info Reference Manual Page 379 SECTION 4
STORE
Assign value to a memory variable.
╔════════════════════════════════════════════════════════════════════╗
║ STORE <exp> TO <memvar> ║
║ ║
║ <exp> the value assigned ║
║ <memvar> name of memory variable ║
╚════════════════════════════════════════════════════════════════════╝
This command assigns a value to a memory variable; if the
variable does not exist, it will be created. An equivalent way of
assigning value is with the = command.
See the command =.
Examples:
1>STORE 3 TO b
1>STORE 5*b TO c
1>? c
15.00
STORE SRI VPI VPIN STORE
SR-Info/VP-Info Reference Manual Page 380 SECTION 4
SUM
Sum numeric expressions for selected records.
╔════════════════════════════════════════════════════════════════════╗
║ SUM [<scope>] <num exp list> [TO <memvar list>] [FOR <cond>] ║
║ ║
║ <num exp list> the numeric expressions to sum ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select by scope (default scope: ALL) ║
║ <memvar list> store the results in these memory variables ║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
The command SUM adds up numeric expressions for selected records
of the selected data file. Up to 10 expressions can be summed with
one command. Optionally, the results can be stored in numeric memory
variables; the expression list and the numeric memory variable list
must have the same number of entries. <memvar list> cannot contain
numeric matrix variables.
Records flagged as DELETED are not summed. See also AVERAGE,
COUNT, MIN, and MAX.
Example:
The total payroll of the company presently, and after a 5% raise:
1>USE employee
1>SUM salary, salary*1.05
6 SUM(S)
191980 201579
1>SET TALK OFF
1>SUM salary,salary*0.05 TO sal,salincr
1>? sal,salincr
191980 201579
SUM SRI VPI VPIN SUM