Home Shark Reference Guide Shark Commands Shark Functions The Configuration File Write Editor Contact 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.

The WRITE command activates the program editor:

WRITE <filename>

Options:

file     name of file to be created or edited
.volume   number of a volume in the current library; a numeric
                expression
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           prints entire document on 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.

Alt-F formats program files; it indents the lines according to the program structures and capitalizes the first command verb on every line.

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

Examples:

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

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.