programming.using.up Article/Article

programming.using.up

Command programming.using.up Article/Article
Applicable release versions: AP
Category Article (24)
Description short discussion on using the Update processor for programming in Pick/BASIC.

Contributed by Terri Hale
(Original article was published in PickWorld)

If you have Advanced Pick (AP) and you are a programmer, consider using the Update processor (UP) to build your Pick/BASIC programs. (Note: The verb "ed" does not exist in my vocabulary anymore. Why? Read on.)

UP is a full screen editor, unlike 'ed', which is a line-editor. This means that you have full text editing capabilities within your Pick/BASIC programs.

All of the UP commands for moving the cursor and text are available. Some of the most commonly used commands in writing programs are listed in the following table:

mark beginning of text to cut <ctrl>+cd or <ctrl>+cl
mark end of text to cut <ctrl>+cc
paste cut text <ctrl>+cp
read cut text from specified item <ctrl>+cr
write cut text to specified item <ctrl>+cw
load prestore buffer <ctrl>+zl
read saved prestore command <ctrl>+zr
write prestore command to a file <ctrl>+zw
execute prestore command <ctrl>+p
sentence forward and backward <ctrl>+f, <ctrl>+d
word forward and backward <ctrl>+u, <ctrl>+y
character forward & backward <ctrl>+k, <ctrl>+j
delete character <ctrl>+l
go to top of program <ctrl>+t
delete word <ctrl>+o
delete sentence <ctrl>+e
delete program <ctrl>+xo
redisplay screen <ctrl>+zp
display columnar positions <ctrl>+zc
undo previous delete (aka: oops!) <ctrl>+zz
page forward <ctrl>+zn
page backward <ctrl>+zy
toggle insert / overtype modes <ctrl>+r

UP has two modes, insert and overtype. When UP is initially entered, it is in overtype mode.

There is a prestore processor available with AP which is quite a sophisticated programming language in and of itself. There is no limit to the number of prestore commands available. Prestores can be saved in any file on the system and recalled as needed. (See the article in the March/April 1992 issue of Pickworld titled 'Advanced Pick Prestore Commands' for more information on prestore commands.)

Level pushing, or the ability to suspend your program and go list a dictionary or look at another program, is a handy tool to use in writing programs in AP. Level pushing is available from anywhere in AP, not just in the Update processor.

There are several ways to exit a Pick/BASIC program from UP, as shown i the following table:

exit without filing <ctrl>+xe
exit and file changes <ctrl>+xf
exit, file changes, compile & catalog <ctrl>+xc
exit, file changes, compile & run <ctrl>+xr
exit, rename the item & file <ctrl>+xi
exit and go to a new item (program) <ctrl>+xn
exit out of a list back to TCL <ctrl>+xk
exit and return to previous item <ctrl>+xb

Unlike R83, you do not have to file, compile, catalog and run your program with separate editor and TCL commands. In UP, you can do it all with two keystrokes from within the program itself. This is a great time-saver.

Subroutines can be called from within a Pick/BASIC program either at the time the program is filed or anytime during the update session. A subroutine can be called by putting "call subroutine.name" in the file-defining item of the Pick/BASIC program file on the correlative field (file time processing) or on any of the hotkey fields (for in-line program calls). To call a Pick/BASIC subroutine from within a program use <ctrl>+x0-9. A handy use for a subroutine call from a Pick/BASIC program file is to record the time, date and user who updated the program.

Programs can be entered in either upper or lower or mixed case. You never have to hit the caps lock or shift key.

In AP, the TCL verbs "compile" and "basic" behave differently. When you exit a Pick/BASIC program using either <ctrl>+r or <ctrl>+c, the compile form is used.

The "compile" verb is case-insensitive. This means that the variable names, TOTAL, total, and Total will all evaluate to the same symbol. So beware, if you are using the compile verb on programs written in R83 Pick with variable names in both upper and lower case which have different meanings.

On the other hand, "basic" compiles the source code with case sensitivity in effect. This means that the variable names, TOTAL, total, and Total will evaluate to three different symbols.

There are many features available in the Update processor which make writing, compiling and executing Pick/BASIC programs easier, faster and a lot more fun.
Syntax
Options
Example
Purpose
Related