SHARK REFERENCE GUIDE & Error Codes:
Redirection, Command & Field
Colors & Attributes
Date Input & Output Formats
Write Program Editor
APPENDIX A: Shark Compiler
Creating a Program
Programs in Shark are created as text files using the methods described in this reference manual. When Shark boots, the screen will show a "1>" prompt:
At this point, you can simply start typing with the built-in Shark Write environment:
1>use invoices 1>list 1>quit
The result will be a series of instructions, executed by Shark as each line is typed and the <Enter> key is pressed. To repeat the sequence, each line will need to be typed again.
In order that the sequence of instructions ("the program") can be repeated endlessly, the series of instructions can be assembled into a "program" and saved. To create a program named "TEST", start by typing:
Shark will load the Write program, and the screen will then display:
TEST.PRG SharkBase 2.20 WRITE ....+....1....+....2....+....3....+....4....+....5 _
The same series of instructions can be typed again in the Write program, and then SAVED:
TEST.PRG SharkBase 2.20 WRITE ....+....1....+....2....+....3....+....4....+....5 use invoices list quit _
TEST.PRG can be saved as a stored Shark program by pressing the <End> key on your keyboard, and following the simple instructions. After that, you can run your Shark program any time you want by typing:
1>DO TEST or "DO TEST.PRG"
Use these editing keys to edit field contents during APPEND, EDIT, and BROWSE. Except as noted, these commands work identically with the above commands:
Moving the Cursor
Within a field: Left arrow or Ctrl-S (one character left) Right arrow or Ctrl-D (one character right) Ctrl-Left arrow (to beginning of field) Ctrl-Right arrow (to end of field) Between Fields: Up arrow or Ctrl-E (to previous field) Down arrow or Ctrl-X (to next field) ENTER (to next field) Between pages: Ctrl-K (to previous page) Ctrl-L (to next page) Between records: PgUp or Ctrl-R (to previous record-EDIT/BROWSE) PgDn or Ctrl-C (to next record)
Entering and Editing Data
INS or Ctrl-V (toggles insert/overwrite modes) DEL or Ctrl-G (deletes character at cursor) BACKSPACE or Ctrl-H (deletes character to the left) Ctrl-Y (deletes to end of the field)
Saving and Ending
END or Ctrl-W (save changes and end) Ctrl-Q (cancel changes to this record)
Ctrl-U (toggles deleted flag status) Ctrl-HOME (move to top of file) Ctrl-END (move to end of file) Ctrl-PgDn (append a new record) Alt-E (skips backward in file as many records as can be displayed in current window - BROWSE) Alt-X (skips forward in file as many records as can be displayed in current window - BROWSE)
Format strings determine how numbers and strings are displayed. Shark information can be formatted at any time results are being displayed.
Format strings are used in the PICTURE clause of @...GET, in the USING clause of @...SAY, in the format lines in a TEXT block, in the REPORT keyword PICTURE, in the PIC() function, and in the system variable :PICTURE.
Format strings don't affect how Shark stores information; only how it is entered, displayed, or printed. Format strings are made up of format characters and background characters. In most cases (except TEXT and PICTURE in a report form), format strings are enclosed in quotes.
Format characters work as placeholders for displayed data and as "masks" to limit the kind of data that can be entered. There are separate format characters numbers and strings (listed in the next two help screens).
Background characters are primarily decorative, added to make data easier to read. They include all characters (including spaces) not listed in the format character tables. Background characters are displayed exactly as they appear in the format clause, but are not stored as data.
These are the format characters for numbers: 9 -- Displays or permits entry of any digit (0-9), the minus sign (-), or a decimal point (.). $ -- Displays any digit. The leading digit of a value is preceded by a dollar sign (e.g., 182.34 is displayed as $182.34). comma (,) -- Determines placement of commas in a displayed number. period (.) -- Determines placement of the decimal point in a display or input number.
Any other character in a numeric format clause is a background character and is displayed "as is". Here are some display examples (invalid for input):
Number Format Display Effect 1123.89 "9,999.99" 1,123.89 Commas added 100.89 "$9,999.99" $ 100.89 Fixed dollar sign 100.89 "$$$$$$.99" $100.89 Floating dollar sign
Rule: Do not use formats for numeric field input; formatting is for displaying variables.
These are the format characters for strings:
X or x -- Any typed character. A or a -- Any letter, upper- or lowercase. 9 -- Any digit or letter.
All other characters are regarded as background characters: they are depicted literally when displayed and ignored upon input.
Format case when accepting input:
! -- Any character, but converts and displays lowercase input as uppercase.
x="brown dog" ? x brown dog ? !(x) BROWN DOG
A screen can be setup to collect (i.e. "GET") several input variables at one time. The inputs can be edited individually before saving the entire lot at one time. The input variables are organized in a TABLE called a GET TABLE.
To set up a Get Table, use the @...GET command or the input macros (@ and %) of a TEXT block to set up the layout of an input screen. These commands specify how the input screen will be "painted" and to which fields or memory variables the entries are to be stored. These variables are called Get Variables. A Get Table can contain as many as 64 variables.
The READ, APPEND/EDIT OFF or BROWSE OFF commands cause Shark to "activate" the Get Table, allowing the user to view and edit the values of the Get Variables. During this time the command sequences in an ON FIELD structure will execute as the user moves from one Get Variable to another.
The CLEAR GETS command erases the current Get Table definitions, as will any @...GET commands or text macros executed after the Get Table has been activated.
See also: READ, TEXT
Macros are a method of including several operations in a single request. For example, Shark can go to a memory location, retrieve the variable stored there, and feed that variable to a FIND command:
mname="John Macintyre" ... later in the program: find &mname disp name,address,city
One of Shark's most powerful features is the rich variety of ways in which macros can be used. Unfortunately, some users encounter difficulties, especially in the following areas:
1. Putting a data file into use with a macro. This technique requires a data file to be put into use with the COMPILE keyword or the compiler will not "know" that a data file is open. Secondly, users of the file-as-a-vector technique must reference the file only by the name of the COMPILE file. See the sample program VECTOR.PRG for an example of these techniques.
2. Using macros in TEXT blocks. Only standard variables and fields may be used as macros in TEXT. Do not use system variables, matrix variables, or functions.
3. Using a macro in a command when what is intended is use of the variable itself. Remember: a macro used in a command always contains the name of a field or variable, and means that you intend to use the value of that field or variable in the current command instead of the macro.
4. Using macros with commands that do not allow their use. The following commands may not be used with a macro:
COMMANDS PROHIBITED IN MACROS:
@ CLOSE CLS COLOR DO DO WHILE ERASE FIELD FILES...ENDFILES GLOBAL GOTO HELP LOCK ON PERFORM PROCEDURE SELECT SET INDEX TO
Fields are storage places for data in data files. Fields make up each record in a data file. Each item in a record (e.g., name, address, amount) is ONE FIELD.
Fields are a special type of variable; their value reflects the content of the current record of a data file. The value changes as the record pointer moves from one record to another.
Memory variables are temporary storage places cleared when you quit Shark (unless you write them to disk with the SAVE command).
Create a memory variable by assigning a string, number, or logical value to a name of 1 to 10 characters with the = or STORE command. Memory variables' data types are Character, Numeric, or Logical. Text surrounded by quotes creates a character variable. A number with no quotes creates a numeric variable. Logical values (T,t,F,f, etc.) create logical variables.
You can use 128 memory variables at a time. Arrays, or matrix variables, (defined with the DIM command) can contain many values per individual variable. Use the LIST MEMORY command to see all currently defined memory variables.
Memory variable names are 1 to 10 characters in length, with the first character a letter; remaining characters can be letters, numbers, colons (:), or underlines (_).
These commands use memory variables:
Command Stores --------- -------------------------------------------------- = Any string or value @...GET User input (using READ) ACCEPT String input AVERAGE Average of numbers COUNT No. of records INPUT Any user input REPEAT... Count passes in loop (with VARYING) SUM Sum of numbers STORE Any string or value WAIT TO User input
All of the above commands except @...GET will create a memory variable if it does not already exist. Some DOS file-handling functions also create and use memory variables. These include IN(), GET(), and READ().
RELEASE clears some or all (with the ALL clause) memory variables and makes room for others. CLEAR closes all memory variables and all open data files (it's a combination of RELEASE ALL and CLOSE ALL).
RELEASE ALL is automatically invoked when you use CHAIN to call a new command file from within another. Transfer memory variables from one command file to another, chained command file, use the GLOBAL command.
SAVE TO saves the current memory variables and their current values to a disk file (default extension MEM).
RESTORE recalls memory variables stored in a specified memory variable file.
In an expression such as
Shark has to decide whether to perform the + first (result: 20) or the * first (result: 23). The Rules of Precedence decide such questions. Functions have the highest precedence.
Arithmetic operations have the second highest precedence; among themselves:
*, / (multiply & divide)
+, - (add & subtract)
Relations are next; among themselves they all have the same precedence. Logical operations come last; among themselves:
When two or more of the above have the same precedence, they are performed from left to right.
The parentheses: ( and ) have higher precedence than functions, operations, or relations. Thus you can set the precedence explicitly using parentheses.
This means that you do not have to get involved in familiarizing yourself with the Rules of Precedence. If you want THE "+" operation first, write
If you want a "*" performed first, write:
The parentheses tell Shark how you want the operations performed. Since Shark throws away the parentheses when the expression is compiled, you will gain readability by using parentheses - and lose nothing.
Keywords that take no arguments are described under REPORT command.
FIELDS Keyword FILE Keyword HEADING Keyword INDEX Keyword LENGTH Keyword MESSAGE Keyword PICTURE Keyword RELATION Keyword SELECT Keyword SETUP Keyword SPOOL Keyword SUBTOTAL Keyword TITLE Keyword
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.
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.
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.
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.
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.
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 almost always faster than using SELECT or a FOR clause on the REPORT command. (Note: It is faster to index a file using the INDEX ON command outside REPORT, whether a condition is specified or not.)
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'.
LENGTH - <num exp>
This sets the number of printed lines per page. For instance,
LENGTH - 40
will set the page length at 40.
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.
When two levels of subtotaling are specified, 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.
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 @).
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:
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.
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>
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. To set up chaining relations (1 to 2 to 3, for example, set up the files are relations in the program before executing REPORT.
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. Caution: Do not use SELECT or SET FILTER when running a report with a SUBTOTAL; create a special index with the required records instead.
Note that NODETAIL can be used only when SUBTOTAL is also used. NODETAIL 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.
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.
SETUP - 27,W,1Bh,41h,3h
SPOOL - <file name>
This is an alternative to the PRINT keyword and diverts printed output to a file. It sends the report to the file <file name> (default extension TXT).
SPOOL EXAMPLE.TXT; "txt" is default and not needed SET PRINT ON . . . SET PRINT OFF SPOOL; end spooling of output and return to program
Output can be sent to a stored file name:
INVNUM=INVNO5+".INV" SPOOL &INVNUM . . .
Spool a report if you want to pretty it up with your word processor, or include it in a document, or print it later. The Shark command SPOOL filename 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.)
Check your Shark directory after SPOOLing output; output will normally be directed according to your preferences
in the FILES/ENDFILES instruction in SHARKNET.CNF configuration file.
NOTE: when running Shark under a DOS emulator, the location of output can end up in C:/SHARK directory depending on how your drives were mounted at boot time. For example, DOSbox sets the drive locations in this manner:
mount c c:\shark\
vDOS sets the drive as follows:
use c c:\shark\
In this example, if SHARKNET.CNF contains a FILES statement "*.DTA,C:\DTA", the \DTA folder will actually be "C:\SHARK\DTA\" since "C:\SHARK\" was mounted as the "C" drive. A little experimentation will show where the files are written.
SUBTOTAL - <exp>
This keyword causes subtotals to be printed when the expression <exp> changes. Subtotaling is done only for numeric expressions that are specified in the PICTURE line.
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).
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.
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.
Shark 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.
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)
Accounts receivable as of Thursday, September 19, 1998
Memo fields may be specified in the structure of any data file of any type. This may be done in either CREATE or MODIFY. The field width is automatically 10 characters, but what you see when the field is displayed or edited is either "memo" if the memo has been attached to the record, or "MEMO" if a memo is present.
All memos associated with a data file are stored in a file of the same name, but with a DBT extension (standing for data base text).
Since memo fields were originated in dBASE III, many database programs still use its standard format, which is not compatible with dBASE IV. Shark handles either format when a DBT file is created externally, but all DBT files created by Shark itself use the same format as dBASE IV version 1.1. This format has the advantage of reusing space that becomes available inside the DBT file, in much the same way as Shark's libraries have always done; the original dBase memo files grew endlessly.
1. Writing & Editing Memos. Memos may be written and edited in two ways:
WITH THE WRITE COMMAND:
Whenever a data file with one or more memo fields is open, you may create or edit a memo attached to any memo field in the current record by entering WRITE with the name of the field, preceded with the letter M and a period. For example, WRITE M.COMMENT will open the memo associated with the field COMMENT and allow you to edit it. If it does not already exist, it will be created.
INSIDE FULL-SCREEN EDITING
You are in full-screen editing whenever you are executing READ, EDIT, BROWSE or APPEND commands. If a memo field is on the screen, you may move your cursor to the memo field and press Alt-W to enter WRITE in read/write mode, or Alt-R to enter WRITE in read-only mode (no changes are saved). Again, if no memo already exists, it will be created.
Memos may be copied to or from DOS files and library entries inside WRITE. For example, to write M.COMMENT out to disk, merely change its name before storing it for a valid DOS name, such as COMMENT.DAT.
2. Displaying Memos.
Memos are displayed with the TEXT command. Just as you can display a DOS file or library entry by naming it after the TEXT command
TEXT comment.dat or TEXT .123), you may name a memo field using the same "M." convention used by WRITE (example: TEXT m.comment).
TEXT's margins and width are controlled by the SET MARGIN and SET WIDTH commands. When writing to the screen, positioning may also be controlled by setting a WINDOW, with or without a border.
Be aware when printing to the screen that TEXT stops the display when it reaches the last line of the window, or of the current screen if no window is in effect. It waits for a keystroke before proceeding, but no prompt is displayed. Pressing <Esc> is not recommended.
1. Using a DO WHILE loop to control movement between records, memo fields are successively displayed:
USE memodemo ;a data file with memo fields WINDOW ;these two lines initialize the screen CLS DO WHILE t ;do endlessly, or until
is pressed WINDOW 1,2,9,77 ;single-line window in top half of screen TEXT NOTE_NUM #NOTE_NUM NOTE_NOTE #NOTE_NOTE press a key: - (minus) for previous memo to exit any other key for next memo ENDTEXT WINDOW 12,2,23,77 ;window over botton half to display text TEXT m.note dummy=inkey() ;wait for a keystroke IF dummy=asc('-') ;compare to minus sign...if it is, skip back IF #>1 ;skip -1 only if we're past top of file SKIP -1 ENDIF ELSE SKIP ;otherwise, skip forward ENDIF ENDDO
2. Use EDIT OFF with an ON FIELD structure to control display of memo fields and allow memos to be created and edited.
USE memodemo ;same file as in previous example SET text on ;we want non-editable display to update recnum=# ;variable to show record number WINDOW ;initialize screen CLS WINDOW 2,2,9,77 ;window for top half of screen TEXT .. recnum,9999 Record #recnum NOTE_NUM.... @NOTE_NUM Use the standard EDIT keys, including PgUp and PgDn between records. To edit MEMO, place cursor in this field and press Alt-W: @note NOTE_NOTE... @NOTE_NOTE ENDTEXT SCREEN 1,2 ;save screen as it is to screen 2 ON FIELD ;set up ON FIELD FIELD 0 ;on entry to record... recnum=# ;get current record number SCREEN 2,1 ;restore original screen and window WINDOW 12,2,23,77 ;new screen to put TEXT into TEXT m.note FIELD note ;when leaving memo field WINDOW 12,2,23,77 ;display memo again to ensure changes shown TEXT m.note ENDON EDIT off ;edit the records WINDOW ;cancel the window CLS ;erase the screen
Shark was designed to run older DOS-type environments. Running Shark in a modern DOS-emulator may not require DOS-type memory allocation management. Be that as it may, Shark's memory space on older MS-DOS, DR-DOS, or PC-MOS machines is managed by a SET file:
SHARK.SET or SHARKNET.SET ("SHARK" refers to the single-user version; "SHARKNET" to the multi-user version)
The SHARK.SET file is a text file located in the Shark folder.
SHARK.SET file is required for older DOS environments. Some later environments such as DR-DOS, PC-MOS, dbDOS, DOSbox, and vDOS are able to manage file memory internally and some elements (e.g. BINSPACE,FILES,HANDLES,FIELDS) of SHARK.SET/SHARKNET.SET FILE may not be required.
Assembly-language programs may be copied from disk into a special area of memory called BINSPACE, which is set aside with the BINSPACE= command in your SHARK.SET or SHARKNET.SET file. See BINSPACE
Allocate memory in the SHARK.SET or SHARKNET.SET file using the BINSPACE=n where <n> is the number of 1K blocks to allocate to the BINSPACE in memory. The limit for <n> is 32. Example: BINSPACE=32 allocates 32K.
Sufficient space to load binary files must be provided with the BINSPACE= command in the SHARK.SET or SHARKNET.SET file; and no more than eight binary files may be loaded at any one time. BIN files can be removed from memory with the BINUNLOAD command.
Caution: Be sure you have set FIELDS= in the SHARK.SET or SHARKNET.SET file to a number large enough to accommodate all the fields in all the data files you will ever have open at one time, plus the largest number of fields in any of these files. The limits for FIELDS= are 128 and 1000, with a default of 320 files. See FIELDS=. Later environments such as DR-DOS, PC-MOS, dbDOS, DOSbox, and vDOS are able to manage file memory internally and a FIELDS= statement may not be required.
Reserving memory space for a single field requires 16 bytes. Therefore, increasing the number of fields requested reduces the memory space available for your program.
Shark has a default maximum of 20 files, unless the operating system allows more than 20 open files (DOS 3.3 and above) and that a FILES=statement is present in the CONFIG.SYS file specifying at least <n> files. Later environments such as DR-DOS, PC-MOS, DOSbox, and vDOS are able to manage file memory internally and a FILES statement may not be required.
As a practical matter, <n> should be in the range 25 to 60; the default and minimum is 20. Loading more files reduces the maximum size of programs and reduces speed of such memory-intensive commands as INDEX.
The command MEMORY= in the SHARK.SET file allocates a specific amount of high memory for use of Shark rather than the default of 128K.
The number of blocks can be as little as 32, although Shark can be expected to be sluggish in performance at that level, and there will be little space available for matrixes and background screens.
This command in the SHARK.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. NOEFFECTS must be used in network installations to avoid unwanted effects appearing on remote workstations.
Example of contents of SHARK.SET file:
BINSPACE=32 NOEFFECTS FIELDS=480
Shark's configuration on your computer is managed by a CONFIGURATION FILE.
SHARK.CNF or SHARKNET.CNF ("SHARK" refers to the single-user version; "SHARKNET" to the multi-user version)
The SHARK.CNF file is a text file located in the Shark folder.
NOTE: The file extension "cnf" is a Windows config file extension and some Windows editors will not see or open a file with this extension. On a Windows PC, the file may appear in the file listing NOT as "SHARKNET.CNF" but simply as "SHARKNET". You may have to use a programmer's editor to access this file. This doesn't affect the operation of Shark within a DOS emulator like DOSbox or vDOS.
SET NETWORK ON turns NETBIOS instructions on for multi-user version of Shark SET APRI OFF undocumented instruction to permit escaping to Shark prompt only if APRI is set ON, Shark escapes to DOS prompt, enabling direct access to files SET DATE TO 'YYYYMMDD' sets global calendar date format CLS clears screen on sign-on :USER=99 User number identifies each local workstation :color=31 default color = blue with white text :RETRY=15000 on file lock, default setting tries to open file for 15000 times until admitting defeat with an error message :UNDOC=PIC(DATE(8),"XXXX.XX.XX") store today's global formatted calender date in this location :TITLE='DEBUG=Y' store global debug flag in this location
FILES instructions can be placed here:
FILES Sets the location of working files for this workstation; note DBF files are in *.TXT,C:\SHARK\TXT (sub-folder) a common parallel shared folder while LOC,MEM,GET,SCR,STO files are *.LOC,C:\SHARK\LOC (sub-folder) local to each workstation. Shark won't direct working files like LOC,MEM,GET *.MEM,C:\SHARK\MEM (sub-folder) to a shared parallel folder, but will send working files to a local sub-folder *.FRM,C:\SHARK\FRM (sub-folder) as shown below(be sure to set up the sub-folders beforehand). *.GET,C:\SHARK\GET (sub-folder) *.SCR,C:\SHARK\SCR (sub-folder) *.STO,C:\SHARK\STO (sub-folder) *.PRG,C:\PRG (shared parallel folder) *.DTA,C:\DTA (shared parallel folder) *.MNU,C:\CPL (shared parallel folder) *.CPL,C:\CPL (shared parallel folder) *.DBF,C:\DBF (shared parallel folder) *.NDX,C:\NDX (shared parallel folder) ENDFILES
SET files instructions can be placed here:
SET EXECUTE OFF ON FIELD is not executed at one time; it's executed line by line SET END OFF :F1=" " Contents of function keys f1 - f10 are set here :F2=" " :F3=" " :F4=" " :F5=" " :F6=" " :F7=" " :F8=" " :F9=" " :F10=" "
Some CNF locations can store quite a bit of global information. Subsets can be accessed using the $( substring function. The size limit of each global variable is about 256 bytes.
? :UNDOC 1998.03.27 ? $(:UNDOC,1 4) 1998
Sample SHARKNET.CNF file:
SET NETWORK ON SET APRI OFF SET DATE TO 'YYYYMMDD' CLS :USER=99 :COLOR=31 :RETRY=15000 :DATE=DATE(8) :COMPANY="ACME INDUSTRIES INC" :PICTURE="9999999.99" :UNDOC=PIC(DATE(8),"XXXX.XX.XX") :TITLE=" " FILES *.TXT,C:\TXT\ *.BAK,C:\BAK\ *.MSG,C:\MSG\ *.ERR,C:\ERR\ *.LOC,C:\LOC\ *.MEM,C:\MEM\ *.SCR,C:\SCR\ *.PRG,C:\PRG\ *.FRM,C:\FRM\ *.DTA,C:\DTA\ *.CPL,C:\CPL\ *.DBF,C:\DBF\ *.NDX,C:\NDX\ ENDFILES SET EXECUTE OFF SET END OFF :F1=" " :F2=" " :F3=" " :F4=" " :F5=" " :F6=" " :F7=" " :F8=" " :F9=" " :F10=" "
System Variables (Global Variables)
:F1=" " :F2=" " :F3=" " :F4=" " :F5=" " :F6=" " :F7=" " :F8=" " :F9=" " :F10=" " :USER=99 :COLOR=31 :RETRY=15000 :DATE=DATE(8) :UNDOC=PIC(DATE(8),"XXXX.XX.XX") :TITLE='DEBUG=N' :TIME="22:53:43" :DATE=DATE(8) :VERSION="710 " :SERIAL="710020194A" :COMPANY="ABC Inc " :PICTURE="9999999.99" :TITLE=" " :KEY="0" :AVAIL="0" :FIELD="0" :ERROR="0" :MESSAGE="2. Variable not found." :DIR="C:\" :NEAR="0" :ROLL="ROLL.$$R"See also the command LIST SYSTEM
These system variables are built into Shark. They include the contents of the function keys (F1 - F10), the date and time (from DOS), various default values, and other information. System variables may be changed by the user, but they're not removed by the CLEAR command. For example, the :DATE and :TIME variables will always be available to running programs.
A system variable is distinguished from other variables by having a colon as the first character of its name -- e.g., :TIME.
To see the contents of a particular system variable, give the ? command followed by the system variable name:
To see all system variables, type:
Like memory variables, the values of most system variables, including the function keys, are changeable using the = (equal sign) or STORE...TO commands.
Each of the function keys contains a pre-defined string (shown with LIST SYSTEM). Using the = command, you can redefine any function key (e.g., :F2="SET DEFAULT TO b:" assigns the string "SET DEFAULT TO b:" to F2). Function keys can be defined as commands or as frequently repeated entries for use in full-screen editing.
A semicolon (;) in a function key definition indicates a press of the ENTER key. A function key definition that contains a semicolon will be executed when you press the function key.
A quick way to redefine function keys is to type the string to be stored, then press ALT key along with the function key to store the string to that key. To capture a line of text to move in WRITE, place the cursor at the beginning of the line, then press ALT and the function key to store the text; then move to the new position and press the function key to insert it.
These processes redefine function keys only during the current Shark session.
To save changes to function keys or other system variables enter the new definitions in the CNF configuration file.
In addition to the function keys, there are a number of other system variables which can be viewed by typing LIST SYSTEM:
:AVAIL contains the number of the next available volume in the current library file. See SET LIBRARY command. :COLOR The current value of the color attribute written into the screen memory for every byte of screen display; set with SET COLOR TO or :COLOR= command. :COMPANY contains the company name. This is used by the REPORT command. (It can be changed to the name of the company you are reporting on.) :DATE. Contains a string of the date as formatted the last time the DATE() function was used. DATE(Full) is used with the system date when Shark is started up. :DIR. The user's current drive letter and directory. :ERROR. The current value of Shark's internal error variable. Shows why execution of the last command failed. :FIELD contains the number of the Get Table entry currently being processed. See ON FIELD command. :KEY is a numeric variable. It contains the number generated by the last keystroke used to exit a process or execute a command. See the function INKEY( for the definition of this number. :KEY is used in Shark programming to find out which key was pressed to abort or interrupt a procedure. The inkey() function displays the :KEY value: DO WHILE t @ 10,0 SAY "To display a key code, press any key . . ." ? inkey() ENDDO or: SET FUNCTION ON * if <R> or <r>, <R>eturn to opening menu CASE :KEY=114 .or. :KEY=82 LOOP * if <E> or <e>, <E>nter inventory CASE :KEY=101 .or. :key=69 CLS etc :MESSAGE. The message from the MSG file associated with the error number contained in :ERROR :NEAR The number of the record containing a key equal to or greater than the last FIND's FIND string. See FIND command. :PICTURE. The :PICTURE system variable is a format for numbers (see Formatting numbers under the @ command). This formats the display of all numeric memory variables and numeric expressions. This format can be overridden by a format clause in TEXT or an @ command, or with the PIC( function. :RETRY. Controls the number of times that Shark Network Edition will attempt to connect to a dbf file if the file has been opened by another user. 15,000 RETRIES will be approximately 30 seconds, then Shark will signal "File Locked" and look for an escape or return instruction. It has no meaning under other versions. :SERIAL may contain the serial number. Once Shark is loaded, you may use this as a variable that survives a CLEAR command such as different colored text or screen formatting. :TIME. Contains a string of the time of the last use of the TIME() function in the format last used by that function. TIME(1) is used with the system time when Shark is started up. When :TIME is set with STORE or = commands, the system time is set to the same time. :TITLE is the default title of a report. See the REPORT command. :UNDOC. Unused - may be used to store formatted date or other useful data. Note that :DATE contains an unformatted date read from DOS. :USER. A number between 1 and 999 assigned to each user on a network under Shark Network Edition. :VERSION contains the current version number of Shark.