Home Shark Introduction Shark Reference Guide Contact/Purchase Menu ☰

WRITE Program Editor

The built-in WRITE editor is a simple built-in WordStar-type program editor for working on small Shark text and program files. It cannot handle files bigger than 20000 characters (about 18k), but it is still useful for locating and fixing run-time errors since it is designed to go to the location where the program fails at run-time. It actually goes to the line where the code fails, but in most cases that is close enough to find the error.

If you like to use a code editor such as Notepad++, a runtime error in Shark will indicate the line number where your program failed. This will be the line number in your Notepad++ editor.

The WRITE command activates the program editor:

WRITE <filename>


file     name of file to be created or edited
.volume   number of a volume in the current library; a numeric
OFF             omit header and opportunity to rename file or volume

If file or volume is not specified, the last file used is understood to be the file to edit. If no extension is specified, PRG is assumed. It's OK to use any routine programming editor, but the SHARK editor is EXTREMELY useful for debugging programs and reports since it takes you to the location of the bug or error.

The editing keys are the same as in full-screen editing. WRITE uses an 80 character "window" for its 254 character lines.

Using data and index files reduces space available for WRITE, as does running WRITE inside a program; consider running WRITE from a subroutine instead of the main routine if maximum file size is required.

Editing keys: The following is WRITE's editing screen:

                           SharkBase WRITER HELP  
Delete and Insert              Block Commands            Miscellaneous       
=================              ====================      ====================
delete character..... Del      Mark block.... Alt-B      QUIT:               
delete to end of line  ^Y      Move block.... Alt-M      with save.... End, or ^W
                               Copy block.... Alt-C      without save.  ^Q
delete line..........  ^T      Delete block.. Alt-D                          
insert line..........  ^N      Remove marks.. Alt-K      PRINT TEXT...  ^P   
insert-mode toggle... Ins      tab.......... TAB Key     FORMAT PROGRAM Alt-F
 +------------------------  FAST CURSOR MOVEMENT   --------------------------+
 |  end of line... ^Right Arrow   page up....... PgUp  top of text... ^Home  |
 |  start of line. ^Left Arrow    page down..... PgDn  bottom of text ^End   |

NOTES:  1. ^ is Ctrl  2. Keys in pointed brackets are on the Numeric Keypad

Left Arrow or Ctrl-S   moves the cursor back one character
Right Arrow or Ctrl-D  moves the cursor forward one character
Up Arrow or Ctrl-E     moves the cursor to the previous line
Down Arrow or Ctrl-X     moves the cursor to the next line
Ctrl-Left Arrow        moves to the beginning of the line
Ctrl-Right Arrow       moves to the end of the line
Ctrl-Home              moves to the beginning of the document
Ctrl-End               moves to the end of the document
Ctrl-N                 inserts a new line
Ctrl-T                 deletes the line
PgUp or Ctrl-R         displays previous page
PgDn or Ctrl-C         displays next page
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 line
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
End or Ctrl-W          quits and updates text
Ctrl-Q                 quits and does not update text
Ctrl-P                 sends entire file to printer
Alt-F                  formats program
Alt-H                  displays a help screen

To break a line into two, press Ins to get into insert mode, and press ENTER. To merge two lines, delete the end of line character. When you leave the line (with a cursor key or End), the two lines merge.

Formatting & Debugging:

Shark's WRITE editor is EXTREMELY useful for debugging programs and reports since it takes you to the location of the bug or error. Alt-F formats program files; it indents the lines in a program (PRG) file according to the program structures and capitalizes the first command verb on every line. All structures in a program file must be "balanced"; that is, every DO WHILE requires an ENDDO, etc. Every structure inside another structure must be similarly balanced. A helpful hint: use the WRITE command on the program and press Alt-F to format the file with all structure indented three spaces. If the last END command in the program does not start in column zero, with an indented line above, you know you have an unbalanced structure.

Help inside WRITE:

When using WRITE, Alt-H displays a screen of information (press any key, and the help screen disappears).

Editing new files:

Some examples:

1>WRITE test             ;write TEST.PRG
1>WRITE test.txt         ;write TEST.TXT
1>WRITE test.dat OFF     ;write TEST.DAT with suppression of header
1>WRITE .65              ;write volume 65 in the current library
1>WRITE .num             ;write volume number contained in NUM in the current
1>WRITE .num OFF         ;write volume number contained in NUM in the current
                          library with suppression of header
1>WRITE .:avail          ;write the next available volume (Caution: be sure to
                          capture this value before using this construct or
                          you'll never be able to find your text again.)

Editing SHARK library volumes

Note that library volumes are addressed by placing a period in front of the volume number, which can be either a numeric constant or a numeric expression. Do not confuse this usage with a decimal designation.

Embedded SHARK options

OFF causes WRITE to omit the top three lines of the screen (file name and ruler, etc.) and places the cursor at the beginning of the file in the top left corner of the current window (the entire screen if no window is active), and to save the file immediately upon sensing the End key without giving an opportunity to change the file name. WRITE OFF is used primarily as an embedded option inside programs under program control, and with an active window.

Special Characters

In addition to the standard ASCII Characters available in DOS editors, you may be able to access the following useful Arrow Symbol Alt Codes which are useful when laying out menus:

↑	Up Arrow                 Alt+24 (Hold the 'Alt' key and press 2,4 on the Number Pad)
↓	Down Arrow               Alt+25
→	RightArrow               Alt+26
←	Left Arrow               Alt+27
↔	Left-Right Arrow         Alt+29
↕	Up-Down Arrow            Alt+18


@ 20,20 SAY CEN(' Use <↑> and <↓> to Select From List',30)

NOTE: While there are thousands of ASCII Alt Codes available in the ASCII universe, not all are accessible within Shark. For example, the same symbols in MS-DOS may appear differently in vDOS. Some trial-and-error experiments may be needed!