^^ .TITLE AnalytiCalc (PortaCalc) Reference Manual .comment .PAPER SIZE 80,80 .PAPER SIZE 58,100 .COMMENT 58 LONG, 100 WIDE .SPACING 1 ^^ .COMMENT FOLLOWING ARE FOR BONNER LAB RUNOFF AND LN03 WITH TIMES ROMAN FONT... .LEFT MARGIN 1 .RIGHT MARGIN 100 .enable escape .flags special ? .flags special ` .flags special ~ .define escape "^~",,27,"[17m",27,"[1w" .comment ? controls BOLDING text. .define escape "^?",LCK,27,"[17;1m" .define escape "\?",LCK,27,"[22m" .comment the [?27 codes control PROPORTIONAL SPACING .comment .define escape "^`",LCK,27,"[?27h" .comment .define escape "\`",LCK,27,"[?27l" .define escape "^`",27,"[?27h" .comment c is printer reset. Do at end of doc. .define escape "\~",27,"c" ^~ ^` ^? .c AnalytiCalc .C The Analyst's Tool .C Reference Manual and Guide \? .skip 5 ^? .INDENT -1 1 ANALYTICALC__OVERVIEW \? .C AnalytiCalc (PortaCalc) .P AnalytiCalc is an electronic spreadsheet program which was written in "portable" Fortran 66 and runs on your PDP11 or VAX systems. It has a variety of commands and operates on a "command verb" syntax. That is, everything you tell it is a command. Some commands enter numbers or formulae; others manipulate them or change the display. Online help is available (though limited) via the Help command (or the PF2 key on some systems). .P AnalytiCalc has 5 major ways of addressing cells, over 75 functions (more depending on how you count them), 70 commands (with more variations), unlimited windowing and programmability at the cell and the sheet level, 17 digit precision, and a built in online calculator with extended precision (20 or 99 digit) numbers available. It is designed to handle traditional spreadsheet problems, data access problems, equation solving, engineering applications, and finance, and is designed to be easy to extend both by adding to the program itself and by adding commands externally. .P Interfaces exist to graphics outputs, to word processing integration with the spreadsheet (or AnalytiCalc may be used as a word processing integration tool as a kind of framework document integrator), to data access from data files separate from the sheet, and to saved sheets permitting access to systems of spreadsheets. Simple methods of moving to other system commands make this program a powerful command interface as well as a unique analytic tool. Approximately 400 function key assignments are left for user specification. AnalytiCalc is designed to be mobile to any system with a cursor controllable terminal and a Fortran compiler able to handle Fortran 66 and byte addressing. Currently, versions exist for PDP11, VAX, and 8086/8088. .P Unlike nearly all commercial spreadsheet type products, AnalytiCalc delivers what it promises. If a cell can be addressed, it can be used, subject only to limitations on the amount of disk storage you allocate for backing store. You can use EVERY cell fully with enough disk backup. Contrast this with memory only systems which may address 500,000 or more cells, but which permit only a few percent of these to be filled before running out of room, even on large machines. (For example, the popular 1-2-3 spreadsheet on IBM PCs is reported to hold at most around 12,000 simple formulas on a 544K machine, or around 39,000 9-digit numbers. AnalytiCalc can hold 32,000 17-digit numbers, long formulas, or text strings in its cells, using virtual pages on VAX or disk store on a PDP11, so that on the PDP11 only a 64 K Byte address space is needed. RSX configurations can use additional memory to speed the program up. The 8088 version requires 256K bytes for a full functionality 18,000 cell sheet.) The only virtue of pretending your sheet is huge is that there's some runtime flexibility of shape to be gained. AnalytiCalc can do this also. The version with a DTR interface on VAX and which is used on PDP11 allows use of up to 32000 columns and 32000 rows via aliasing to real cells. The result is that you can have very long or wide sheets, provided they don't take up too many overall cells, to a degree NOBODY exceeds, even on large mainframes. (Of course, it's easier to use cells with short names like G12 and F7 than with long ones like AABA20142 or AAAR18435, but you can choose what you wish.) .SKIP 1 ^? .INDENT -1 2 INTRODUCTION \? .C Getting Started with AnalytiCalc .P When using AnalytiCalc, you will find its commands are NOT similar to commercial spreadsheets. This has happened because of the method for reading them in. Do NOT expect to use the same commands you learned with Visicalc here. Few if any of them are the same. Do, however, expect to be able to perform the same functions, even if a bit differently. You will probably find this a more powerful program than you knew on the micros. It just takes some learning. .P Remember two things first: You need an Enter command ("E ") to enter text or numbers into the sheet, and floating point numbers (most are floating point rather than integers) need a period (.) in them to get AnalytiCalc to recognize them as numbers rather than text. If you forget the period, the numbers will be displayed, but only as labels, and the cell will have a numeric value of zero. Scrolling is done differently from most sheets also. The document file AnalytiCalc.PHL details the philosophy of this. The result is that you have scroll keys to move around with, but you also can have as many windows onto the sheet on screen as you care to define. There are 2 major command modes now. The default is described here but the command "/;" command enters the other and the "//" command goes back to the mode described in this manual. .P The second ("/;" mode) command format is more like other spreadsheets generally. Numbers and formulas are automatically ENTERed when typed at the start of a line. If you start a line with ", it is entered as text (minus the "). If you start a line with "/" (just the slash, not in quotes), the remainder of the line is taken as a command. Commands are NOT recognized unless preceded by / in this mode. Some of the auto keypad keys don't work well as defaulted in this mode. To facilitate writing usable command procedures, the /_# command swaps the current mode with a saved mode. A command file can use this to save and restore the user's command mode and use a known mode internally. .P For further convenience, most otherwise-unknown characters can be pre programmed to do commands of your choice. This is described in the rear of the manual. A key point is that the _~ character in a title flags to continue reading sys$input on VAX until EOF. The _~ will be replaced by space prior to display. This is used to allow automated setups. .INDEX VIEW .INDEX RECALCULATE .P If the program's display is not as expected, use a V command to redraw the screen and/or a R command to recompute to ensure the display is really incorrect. Automatic recomputation occurs normally when data is entered, so most invalid conditions due to forward references in equations or lack of an extra recalculation after copying is done are corrected in the normal course of use. Certain cases do not redraw screen labels (since it is not always correct to do so), so the V (View) command is to be used to guarantee the screen's consistency. New users will seldom need these measures. .P The AnalytiCalc spreadsheet asks some questions when you run it, to set up its working storage. AnalytiCalc contains a direct access file which it sets up and can reuse or reinitialize, containing the basic information for the spreadsheet's physical sheet. .SKIP 1 .INDENT -1 3 INITIAL QUESTIONS .SKIP 1 .C Initial Screen .P When you run AnalytiCalc, it first asks you whether to change the .INDEX FORMAT default floating point format. This is initially set to the Fortran format F9.2 (9 characters wide, 2 decimal places), but if you reply Y, it lets you enter any format you like as the default format. It will try to use it, so if you enter an illegal format, AnalytiCalc will issue error messages before it generates a bad workfile. Note that the default applies when the workfile is BUILT, not later (though the DF command will reset the format of any part of the file later). AnalytiCalc then .INDEX TITLE asks you to enter up to 80 characters as the Title of the spreadsheet. This is displayed at the top of the screen and is used as a label for the sheet when printed out. (The space is made available for this rather than being wasted on a copyright statement on your screen.) .P To reply, enter any title you like, up to 80 characters long, followed (as all AnalytiCalc commands) by a carriage return (labelled RETURN on the VT100). This will appear across the top of the sheet on screen and in print images of it. You may include any desired leading spaces in the title. It will be printed on screen printouts, so make it descriptive of the sheet you'll be using. Note that it must not start with two spaces. If you enter a title with two initial spaces (or just type the RETURN key), no title will be entered or altered. PLEASE NOTE that the first 6 characters of the title are used in constructing unique Annotate filenames (i.e. by the Annotate and the Query or ? commands) and so your annotations will be easier to handle if the title is unique in the first 6 characters. .Index Annotate .index Query .INDEX S Command .INDEX Set Title .index TITLE This title remains until an S command is given (at which time you can change the work file also), though reading in a saved sheet also reads in the saved title. .SKIP 1 .P AnalytiCalc will ask you some questions about storage and how much of the sheet you intend to use on non-VAX versions at this point. Try to be accurate and see the Appendix on Variant Versions below for further information. .SKIP 1 .C Calculation Screen .P The remainder of the manual is common to all AnalytiCalc versions, though older versions may not have all commands. .INDENT -1 3 DISPLAY .P .INDEX Display .index Current Position The sheet is displayed at the top part of the screen and a command cell in Row 23 is shown with the current position encoded. This starts off looking like ^? .LIT A 1> ("Command-mostly" mode), or A 1: ("Enter-mostly" mode) .END LITERAL \? .SKIP 1 and then AnalytiCalc awaits your commands. Note that if the cell pointed to by the command (which is always a Physical sheet address) is occupied (i.e., has ever had any numbers or text entered into it), that cell is displayed in the display in reverse video when you are positioned there. If the cell is totally empty, it is not displayed, however, in any reverse video. A pattern of blanks is displayed, .INDEX EMPTY CELLS however, wherever the cell is null. This pattern is in reverse video. On terminals such as VT52 which don't have reverse video, AnalytiCalc uses a ">" character at the start of your current cell to indicate the active cell where anything is in it. This overwrites whatever was at that character position, though it reappears when the cursor is moved. (If you have a terminal with the ability to handle more lines, edit whatever gets copied to VKLUGPRM.FTN and change LCMDR and LDSPR from 23 and 24 to whatever you want as the command line and formula display rows.) .INDENT -1 3 CONTROL .P You control the sheet by entering a command followed by Return. .INDEX COMMANDS These commands are in the first few columns of the command line and are the first few characters (often the first 1 or 2) you type, and they are REQUIRED for every command. AnalytiCalc does NOT assume any command names. .P Commands entered to AnalytiCalc MUST BE IN UPPER CASE. Text entered can be of either case. However, for PDP11 and VAX, AnalytiCalc now translates cases unless the " character is seen on the line (see below). .INDENT -1 2 COMMANDS .P The commands available in AnalytiCalc are each described separately. The following is a brief listing alphabetically of their names. ^? .skip 1 .left margin 30 .indent -28;+J#filename################Start journaling to filename .indent -28;+N#########################Close journal file .indent -28;_<##########################Rewind input file .indent -28;_%prompt_%cmd_%key%###########Issue prompt and do cmd depending on key .indent -28;$#or#_}#####################Perform operating system command .indent -28;_>#or#_>#_>pattern############Search for formula containing or starting with pattern .indent -28;*##########################Comment line .indent -28;-prompt####################Load arguments after prompt .indent -28;//#########################Use "Command-Mostly" mode .indent -28;/;#########################Use "Enter-Mostly" mode .indent -28;/_##########################Swap current mode with save mode (command-mostly or enter-mostly) .indent -28;1,2,3,#or#4################Move cursor Up, Down, Left, or Right .indent -28;?##########################Display any annotation file for this cell .indent -28;@file.typ##################Read file.typ as input instead of console .indent -28;AA#nn#_{R/C}################Add absolute nn rows or columns .indent -28;AN#########################Edit or create annotation file for this cell .indent -28;AR#nn#_{R/C}################Add relocating nn rows or columns (nn may be neg) .indent -28;CA#in-range#out-range######Copy All (Absolute) .indent -28;CV#in-range#out-range######Copy Value .indent -28;CF#in-range#out-range######Copy Formula (and Format) .indent -28;CR#in-range#out-range######Copy Relocating (all) .indent -28;DB#ncol,nrow###############Display Bounds (no. cols,rows on screen) .indent -28;DF#range#[format]##########Display Format of range to format .indent -28;DL#range#_{R/C_}n:m##########Display Locate range as Row/Col to display col:row n:m .indent -28;DS_{R/C_}_{A/D_}#n#############Display Sort row/col, Asc/Desc row/col n .indent -28;DT#range#_{F/I_}#############Display Type range as Float or Integer .indent -28;DW#ncol,wid################Display Width of col "ncol" to "wid" chars .indent -28;E#expression###############Enter expression into cell .indent -28;E"#expression##############Enter expression as text, no case translation .indent -28;ED#'oldstring'newstring'###EDit cell .indent -28;ET#expression##############Enter expression as UPPER CASE text .indent -28;EV#expression##############Enter expression as computable formula .indent -28;F#filename/nskip###########File read from filename onto display .indent -28;G##########################Get saved sheet. Many variants. .indent -28;Hn#########################HELP and show page n .indent -28;IR#inrange#outrange########In Place Relocate inrange as if moved to outrange .indent -28;K##########################Go into interactive calculator (need *V#3). *E goes back. .indent -28;L#cell#####################Go to cell .indent -28;M_{0/1/2/3/4/5_}#############Move - set move direction after enter .indent -28;MS#or#MH###################Macrocell Show or Hide - show or hide included files. .indent -28;OA#cell####################Origin Absolute cell - Map Screen with cell in upper left .indent -28;OAD#cell###################Origin Absolute Displace cell - Map Screen with cell in upper left leaving old windowing alone .indent -28;OR#cell####################Origin Relative cell - map screen down/right of cursor with cursor=cell .indent -28;ORD#cell###################Origin Relative Displace cell - map screen down/right of cursor with cursor=cell leaving old windows .indent -28;OV#+#######################OVerride absolute refs, make relative .indent -28;OV#-#######################OVerride off - let abs refs be absolute .indent -28;P##########################Put (save) spreadsheet. Many variations. .indent -28;QUery######################Display annotation file for this cell if any .indent -28;R##########################Recalculate sheet .indent -28;RB#cell####################Set Relocate Boundary at cell .indent -28;RE#########################Recalculate Entry - recalculate only cell entered. .indent -28;RF#########################Recalculate, Force recalc of constants .indent -28;RI#########################Recalculate Incremental - Recalculate only cell entered and displayed cells. .indent -28;RII########################Set Recalc Incremental flag but don't actually recalculate. .indent -28;RM#########################Recalculate Manual - no recalc until R cmd .indent -28;S##########################Setup - Global mapping/width/title setups .indent -28;TE#expression##############TEst - Evaluate math expression in cmd mode - many special variants. .indent -28;V##########################View - Redraw screen .indent -28;VF#########################View Formulas - Draw with Formulas instead of numbers .indent -28;VM#########################View Manual - no screen repaint until a V cmd .indent -28;W##########################Write display to file or printer. .indent -28;X##########################eXit from AnalytiCalc. Asks for confirmation. .indent -28;ZE#range###############ZEro range of cells .indent -28;ZA#########################Zero All of sheet. Asks for confirmation. Also used for reinitializing. .left margin 1 \? .skip 1 .C Detailed Individual Commands .skip 1 .INDENT -1 3 MOVE__CURSOR ^? .LITERAL CURSOR MOTION (Commands to move around the sheet one cell at a time) 1 (Move up) 2 (Move down) 3 (Move left) 4 (Move right) .END LITERAL \? .P The cursor motion keys move the cursor on the display in the .index Cursor Motion direction indicated. Note these keys are in the same order on the keyboard as the arrow keys of the VT100. .P (The reason the cursor keys are not used directly is that on VT100 they are multiple characters and difficult for Fortran to parse.) .p Note that the keys 1 to 4 are interpreted in the same way as the up, down, left, and right arrow keys on the vt100. they appear in the same order as the arrow keys on the vt100 on the keyboard. .P The X and Y accumulators are set to the column number and the (row number + 1) respectively during commands. This allows procedures to detect cursor position or motion where useful. These accumulators may be used within cells for anything; resetting them does not move the cursor. .P Certain AnalytiCalc versions interpret the PF1, PF3, and PF4 keys on VT100s as the commands .break @KYP, @KYR, and @KYS commands, which will use .break KYP.DAT, KYR.DAT, or KYS.DAT as input command files. This may be used to locally tailor some AnalytiCalc commands using the keypad. (If CMDMUN and TTYINI are altered, the entire aux keypad may be interpreted in this way.) .P If the cursor is pointing to the edge of a screen and a command to move is given, an effective OAD to a new location is given to produce a .Index Scrolling scrolling effect. This happens for auto motion also. Thus, one should be somewhat careful with the cursor keys where complex screen setups have been made, as the redraw of the screen (over or up/down by a screenful, the size depending on your current DB parameters) will repaint a full screen. The scrolling will leave 2 rows or columns from the previous display on screen (to help you keep your place) but will treat the entire screen as one window. Since the display may be set to contain any .Index SC command .Index NS command .Index Control of Scrolling number of windows, the command NS will turn off this scrolling effect, protecting the windows. The command SC will turn scrolling back on. Because the OAD form of the repaint is used, reversing the scrolling will remap the old windows however. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 ADDING__OR__REMOVING__ROWS__OR__COL ^? .LITERAL ADJUSTING PHYSICAL LOCATIONS (Adding or Removing Rows or Columns) .END LITERAL .LEFT MARGIN 12 .index Insert or Delete Rows or Columns .index AA Command .index AR Command .INDENT -7 AA number R ####Add "number" rows ahead of the current physical position, moving all cells below the current cell down by "number" rows and losing the physical sheet's bottom "number" rows' contents, NOT adjusting variable references where the variables are in the moved range and are not the position independent (P_#_# or D_#_# forms) type. .INDENT -7 AA number C ####Add "number" columns ahead of the current physical position, moving all cells right of the current cell right by "number" columns and losing the physical sheet's bottom "number" columns' contents, NOT adjusting variable references where the variables are in the moved range and are not the position independent (P_#_# or D_#_# forms) type. .INDENT -7 AR number R ####Add "number" rows ahead of the current physical position, moving all cells below the current cell down by "number" rows and losing the physical sheet's bottom "number" rows' contents, adjusting variable references where the variables are in the moved range and are not the position independent (P_#_# or D_#_# forms) type. .INDENT -7 AR number C ####Add "number" columns ahead of the current physical position, moving all cells right of the current cell right by "number" columns and losing the physical sheet's bottom "number" columns' contents, adjusting variable references where the variables are in the moved range and are not the position independent (P_#_# or D_#_# forms) type. .LEFT MARGIN 1 \? .P These commands permit the operations known on other spread sheets as "insertion" or "deletion". Deletion takes place where "number" is .index Relocation negative and the sense of the motion is reversed. These commands change the physical sheet's contents and permit wholesale modifications to variable names (other than P_#_# or D_#_# forms which are position independent already and are left alone for simplicity and to preserve some of the flexibility of the D_#_# forms which can be used for projections of 3D sheets onto the display and math with ranges of these). To save a sheet for merging such selected values, both forms, or at least the numeric form, of the Put commands should be used. .P Note that the previous contents of the rows or columns inserted is RETAINED, though it can be zeroed by the ZE command if desired. It will have been copied also to the lower or further-right row/column also, but do not be alarmed; the space is free to re-use. You may however elect to use this feature as a shorthand for copy. .P The AR/AA operations take place on the physical sheet and do not affect the display sheet mapping to the physical sheet. .P Because of the confusing results that could arise, AA and AR do not work on extended cells. (Extended cells are right of column 80 on VAX, or of 50 on PDP11, or below row 400 on VAX or 200 on PDP11.) .SKIP 2 .TEST PAGE 20 .INDENT -1 3 ANNOTATION ^? .LITERAL ANnotate Spawn EDIT cellname.ANN to edit or create annotation file for current cell. ? Display annotation file for current cell. QUEry Display annotation file for current cell .END LITERAL \? .p The Annotation commands implement a very simple scheme for allowing you to place annotations on your cells. An annotation is a separate file created by an editor containing any comments you want to make about a cell. Its name is chosen by AnalytiCalc and reflects the sheet in use (by using the first 6 characters of the title of the sheet) and the cell, and has type ANN. Thus, a file containing annotations for cell F4 of a spreadsheet named PROJECT PLANNER would be named "PROJEC000F0004.ANN" by taking the first 6 title characters and the cellname and filling with zeroes. If the first characters of the title are not alphabetic, they are not used (causing some possibility of name collisions). .P The current Annotate facility requires VMS V4.0 or later due to the long filenames created. Older VMS versions will not be able to use these commands. The cell names are not compacted to allow their directory order to "match" in some sense their logical order on the sheet. Interested programmers may want to edit USRCMD.FVX to change this if desired. .P When you give the AN command with the cursor on a cell, AnalytiCalc generates a name and produces a command "EDIT name" which it spawns to VMS. The editor run by the EDIT command then can be used to create or modify an annotation file. The ? or QUEry commands are the same and display up to 20 lines of the annotation file on screen if one exists for a cell. If no file exists, a message is flashed on the bottom line of the screen to that effect. .P The S command has a subquestion in its' "change widths and mappings" series which allows you to change the command prefix "EDIT " to whatever you like. Thus, if you want to use some other editor, you can do so, or add any convenient command prefix. Up to 15 characters can be so added instead of the 5 in "EDIT ". Thus, an indirect file could in principle be used instead. .P This scheme makes it easy for you to write notes about any strange formulas .Index Annotate .Index Query .Index AN command .Index QUE command or logic you used in a formula while they are still fresh in your mind, and to otherwise document your sheets better than can be done by short comments in the formulas. It has some limitations, chief of which are that the files are not renamed when you copy or move cells around, and that there is no provision for displaying multiple comment files other than using the TYPE command to VMS which will at least give the filenames and thus will make the sources of the tags apparent. .P In view of the limitations, the Annotate commands should be used with a sheet you don't intend to do massive reorganizations on. If you plan to move rows or columns around, annotate AFTER doing so; ditto large copy operations where you would change the meaning of some cells. Once your sheet is laid out, THEN fill in formulae and comments. The ? or QUEry commands only show 20 lines, but since the ANnotate command fires up the editor, you can actually have comment files as large as you like and just Quit out of EDIT if you only want to see comments. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 COPY__CELLS ^? .LITERAL COPYING CELLS CA V1:V2 V3:V4 Copy all cell attributes from V1:V2 to V3:V4. CV V1:V2 V3:V4 Copy numeric values only CD V1:V2 V3:V4 Copy Display Formats only CF V1:V2 V3:V4 Copy Formulas only (no relocation) CR V1:V2 V3:V4 Copy all cell attributes as in CA but relocate cell names to new location from old one. Only relocate names right of or below the cursor or on same row/col with cursor (cells above or left of cursor are NOT relocated). IR V1:V2 V3:V4 Relocate formulas inplace, computing displacements using distance "moved". .END LITERAL \? .P The Copy commands let you reproduce cells' contents in other locations on your sheet without re-entering them. The CA form is most .index Copy .index C Command .index Replicating useful, though the CD part can be used to change default formats and the others may be handy. Note that formulas are NOT changed by the copy operation. If they should function correctly in their new location relative to different cells, the cell identifications should be position independent forms (P_#n_#m for forms relative to physical sheet, D_#n_#m for forms relative to display sheet) so no modification is necessary. CA will normally save all information about a cell in the new cell. .P Unlike the other C class commands, the CR command WILL relocate any variable names that are below or to the right of the cursor at the time the command is given. Names above or left of the cursor are not changed. The row and column the cursor is in is included in the relocation region. Thus, to be sure names are relocated, use a command like L#A1 first to position yourself at the top left part of the physical sheet. .break Be SURE you do the reposition if you use the CR command! .break Note however that if you need certain cells NOT to be relocated, the ability to place them above or left of the cursor when copying or replicating cells around and having them left alone can be useful. Normalization factors, for instance, can be left alone (e.g., at the top of a column) and cells referring to them be copied without having them point to the "wrong" normalization cell. .P When you specify one variable to the C class commands in the V1:V2 range location and give a range V3:V4, the command will copy the named V1 into all cells in the V3:V4 range. .P The IR command allows inplace relocation of formulas. This operates from the cursor to the Relocate Boundary (see below). The *U HERE function returns the current maximum column used in the W accumulator and the current maximum row used in the Y accumulator to permit the repeated use of IR from a command file to simplify moving sections of the sheet. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 SET__DISPLAY__BOUNDARIES ^? .LITERAL DISPLAY BOUNDARIES SETTING (Number rows/cols) DB n,m Set number of columns displayed on screen to n, number of rows displayed to m. .END LITERAL \? .P The DB command sets display size. It also effects the number of cells modified by the OA, OR, OAD, and and ORD commands, so setting the .index DB Command .index Setting Number of Rows .index Setting Number of Cols display small, doing an OA or OR, then setting it large, leaves the part omitted as it was before the OA or OR. The displayed window also controls what is read in with the F command. Note that for automated text retrieval, the VM command (to turn off redisplay during commands) may be useful in connection with using DB commands, F commands, and then V commands to turn the display updating back on from command files invoked either by auxiliary keypad keys or from @file commands. The default VAX maximum dimensions for display are 63 columns and 75 rows. For PDP11, the default is 20 columns by 75 rows. In addition, the VAX version supports displays up to 512 characters wide; the PDP11 version's limit is 132. .SKIP 1 For an example of DB, if you want a display of 14 columns by 20 rows, the command .BREAK ######DB 14,20 .BREAK would be the way to achieve it. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 DISPLAY__FORMAT ^? .LITERAL DISPLAY FORMAT SETTING DF V1:V2 [format] Set Display Format AND set up whether to display formula or number .END LITERAL \? .P The DF command sets the display format for the variable range .index Display Format .index DF Command .index Formula to Text .index Text to Formula V1 to V2 inclusive to be whatever is in the square brackets. This is expected to be a valid Fortran FORMAT specifier for display of the number and may be up to 9 characters long. If the format specifier entered is however just A or L in the first character, the program will indicate the text is to be displayed literally, not as a number, so titles and such can be shown. To display numbers in Fortran A or L forms, just use formats like 4A1 or similar; as long as there is something ahead of the A or L it goes to Fortran. The program will try your format once before writing to disk to ensure against any crashes that will damage your file. Otherwise, the format is up to you. You can even display in octal or hex if you wish! .P The DF command is used to switch a cell from display of numeric information to formula/text display or back on a cell by cell basis (the VF command globally switches cells from numeric to formula and back, though a cell set to display text with DF always displays text). To change a cell to numeric, merely .index FORMAT use the DF command to give it a numeric format (the default is normally F9.2 so the command to set, say, cell G3 to be numeric (possibly after entering a formula not containing +, -, ., (, or [ characters) would be: .SKIP 1 ####DF#G3#[F9.2] .SKIP 1 for the standard Fortran F9.2 format (2 decimal places, 9 digits wide display). In AnalytiCalc-VM, every cell may have an entirely unique format. In AnalytiCalc-PC, however, only a finite number of unique formats is possible (usually about 45) since storage is in memory. The design limit is 255 unique formats, but very few spreadsheets will need more than the 45 normally provided. Typical ones only have 2 or 3 unique formats. The formats may be ANY Fortran formats desired. .P The DF command will also set the type to Floating if the format begins with F or E, and will set the type to Integer if the format begins with I. Beyond this (e.g., for octal or hex) you must use the DT command (below) to set the storage to floating (8 bytes) or integer (4 bytes). .P The DF command will attempt to avoid erroneous format inputs by trying the format out on your current location. If errors occur, the DF command will be quietly ignored, and the program will not crash. This makes it difficult to switch to integer displays. To switch a cell or range to integer, you must use the L command to move to a cell not shown on the screen, then use the DT command to change the desired cells to integer type, then use the DF command to change the display format to an integer display format. The cells will then work correctly as integer cells. Note this checking is done by AnalytiCalc-Vm and AnalytiCalc-PC only. .INDENT -1 4 WHAT__IS__DISPLAYED .LEFT MARGIN 10 NOTE: .BREAK .index Displayed Entity There are 2 items in any cell which may be displayed. One of these is the number in the cell, which takes 4 bytes if an integer, 8 if floating point, and which is displayed normally using a Fortran FORMAT statement type declaration. The other is the FORMULA associated with the cell, which may contain just text or labels. This is selected by the A or L formats. .P Thus, the declaration .BREAK DF A1:A64 [8A1] .BREAK would display the NUMBERs in column A as 8 characters (assuming this makes sense), and would cause strange errors if the number did not make sense as characters. .BREAK The declaration .BREAK DF A1:A64 [A] .BREAK would display the FORMULA TEXT in column A on the screen. This normally will always make sense, and is the normal way to display labels. .LEFT MARGIN 1 .INDENT -1 4 FORMAT .P To reset FORTRAN Formats, the Fw.d format is useful. In that .index FORMAT format, w means an integer giving the width in characters of the output number, and d is the number of decimal places to be shown. For example F9.2 has 9 places total, 2 to the right of a decimal point. A valid number in this format might be (supposing its' exact value is 123456.782) .INDENT 5 123456.78 .INDENT 5 The format F9.1 would give .INDENT 5 123456.8 (note rounding) .INDENT 5 The format F10.3 would give .INDENT 5 123456.782 .P You may devise whatever formats desired. In addition, AnalytiCalc will only display the number of characters that fit in the column on screen, so display width can be set to remove undesired decimals. .INDENT -1 4 OTHER__FORMATS .P The default F9.2 format occupies 9 of the default 10 characters of .index FORMAT Microtutorial column width. Where additional labels are needed, the 1Hc or 2Hcc formats may be used. For example, to show dollars, one might write a format as [1H$,F9.2] in the DF command. If as an alternative one wanted to show thousands of dollars with one decimal place, a format like [2H$K,F9.1] would place "$K" ahead of each number. Thus, a value of 345.67 in the first format would look like .BREAK $ 345.67 .BREAK and in the second format it would look like .BREAK $K 345.7 .BREAK (since the spreadsheet only knows numbers, not their dimensions). .P Where it is desired to display large numbers, FORTRAN offers the E and G formats (the form of such a format is Ew.d or Gw.d where w is the width of the number as printed and d is the number of decimal points). The E format displays the number as a fraction followed be E followed by a power of 10. The G format chooses a floating point display or an E format depending on the number's size. Note that in E and G formats, there need to be 4 spaces in the decimal field just for the exponent. .P The format you display in may be wider than the column; the first "n" characters of the number are shown, where "n" is the width of the column. Thus, if you use a format like F10.0 (which displays 10 digits followed by a period), the period will not show in the default 10 character column width. .P Available format designators for floating numbers (the ones you'll use almost always) are: .indent 4 Fw.d - Simple display with w characters of display (counting the decimal point) and d decimal places after the decimal; .indent 4 Ew.d - Display as a fraction followed by Enn where nn is the exponent of 10 to multiply the fraction by. The format kPEw.d causes k digits to be displayed to the left of the decimal place, so that a format of E10.5 might display the number 73.453 as ".73453E+02" and a format of 1PE10.4 would display it as "7.3453E+01". The w is the total number of characters in the display, and the d the number of decimals shown. Note that the w must have 4 extra characters to handle the "E+nn" part of the number. Very large or small numbers can be handled by this format where they would be too wide in F format. .indent 4 Gw.d - This format works like the Fw.d format provided the number is small enough to fit in the widths provided, and like the Ew.d format otherwise. The display will include only d digits (or k+d digits if using kPGw.d), so for cases where it works, the Fw.d format is more space efficient. .indent 4 Several "modifier" formats are available. nHxx allows characters xx in the output. nX includes n spaces. TRc causes the next output to appear c spaces right of the current one, and 'xx' acts like the nHxx in outputting characters xx. The 'xx' or nHxx designators must be separated by comma from following format designators. Also Dw.d is equivalent to Ew.d. The optional forms Ew.dEe and Gw.dEe act like Ew.d and Gw.d except that only e digits of exponent are displayed. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 DISPLAY__LOCATE ^? .LITERAL DISPLAY LOCATE (Map physical sheet variables onto Display Sheet) .END LITERAL \? .LEFT MARGIN 10 .INDENT -7 DL V1:V2 Rn:m ###point at display coordinates (n,m) (col,row) and, going left to right along a Row, copy in variables V1 through V2 (actually, point those display sheet cells at variables V1 thru V2). .INDENT -7 DL V1:V2 Cn:m ###point at display coordinates (n,m) (col,row) and, going top to bottom along a Column, copy in variables V1 through V2 (actually, point those display sheet cells at variables V1 thru V2). .LEFT MARGIN 1 .P The DL command lets you associate any variables in the physical .index Windows .index DL Command sheet with any location on the display sheet (the display sheet coordinates always count from 1 as the topmost row or leftmost column, through the maximum number there). This flexible association means that in principle every cell on the display sheet can be a "window" in the sense of other sheets, though that would be quite hard to follow. If the :V2 part of the command is left off, only one display cell is changed. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 DISPLAY__SORT ^? .LITERAL SORTING DISPLAYS DSRA#nn Sort display on row/col nn (display coord) .END LITERAL \? .P The DS command sorts "normally" ordered display sheets. It operates .index Sorting .index DS Command something like a sorted OA command, the sort key being the number in a column or row. The command looks like this: .BREAK DS Command specifier .BREAK R or C - Row or Column specifier (i.e. whether to sort a row or a col.) .BREAK A or D - Ascending or Descending order sort .BREAK nn - row or column number to sort on. .P The command letters must all appear together. Thus a command to sort Column 4 on the display in Descending order would be: .BREAK DSCD 4 .BREAK and a command to sort Row 3 in Ascending order is: .BREAK DSRA 3 .BREAK .SKIP 1 The sheet should be in "normal" order (as from an OA command) prior to .index Printing Large Reports the sort for use. The area sorted is the part of the sheet displayed (set by the DB command, so it may actually exceed what shows on the screen. The VAX version of AnalytiCalc normally supports very large display sheets to permit printout of large displays which are not all visible on the screen; the screen display discards all the un-displayable points, but the print routine, and the sorts, do not.) That is, the display sheet size may be given as larger than your screen will display, and the sort will cover that area. Note that ONLY display sheet locations are sorted. A sort on the PHYSICAL sheet may be done via a cell or sheet program, but this primitive does not. .skip 2 .TEST PAGE 20 .INDENT -1 3 DISPLAY__TYPE ^? .LITERAL DISPLAY TYPE SETTING DT V1:V2 F Set V1 thru V2 to Floating data type DT V1:V2 I Set V1 thru V2 to Integer data type .END LITERAL \? .P The DT command sets Float/Integer attributes on physical cells. Initial default is F (8 bytes) but this can set it to I .index Integers .index DT Command .index Display Type (4 byte integer). Computation is done in floating point always, but I type variables will be converted to integer when stored and may be displayed in valid Fortran formats. This information is stored/restored by the P/G class commands, but not in workfiles as it is considered volatile. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 COLUMN__WIDTH ^? .LITERAL DISPLAY WIDTH SETTING DW N,M Set column N on display to be M characters wide .END LITERAL \? .P DW lets you set any column width. They are independent of each other, and may be set in any order. Maximum width supported .index Column Width Set .index DW Command is 132 columns with the present version of UVT100; it may be larger on terminals where it makes sense, if UVT100 is altered. Note that when many widths are to be varied, the VM mode is useful to prevent redrawing the screen between settings; the V mode can then be reset once the widths are as desired. Setting column widths is expected to be frequently done via a command file (see the @ command below). Because a display column may show cells from many parts of the physical worksheet, width is a property of the display column here rather than of the cell in the work sheet. However, the format for displaying each physical cell's number is a property of the physical cell. This separation can be used to aid in formatting a display. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 ENTER .C ENTER .INDEX ENTER Command .index E Command ^? .LITERAL E expression Enter expression, figure out text or value based on contents. ET expression Enter expression as text only E" expression Enter expression as text only EV expression Enter expression as Value .END LITERAL \? .P This command enters the given expression at your current cursor position, and may optionally move in some direction that has been set up by the M command (Move) after the entry is made. .P The Expression may be text or one or more numbers, functions, or equations (separated by the _\ (backslash) character if more than one per cell) in fully parenthesized infix notation. The expressions entered resemble normal algebraic expressions, with the usual operator precedence. There are 26 global accumulators named A through Z (plus a special one named %) available; the result of a calculation is always left in the % accumulator as well as the cell. Operators available include addition (+), subtraction (-), multiplication (*), division (/), and exponentiation (** or !), with normal precedence. Many functions are also available, described below, for other operations. The operator evaluation order is functions, exponentiation, multiplication and division, addition and subtraction, just as in Fortran and most programming languages (and on most calculators). Parentheses may be used to group calculations to override these defaults. .P The text entered becomes the Formula for that cell, and AnalytiCalc takes a guess as to whether that text is just text or .index Formulas .index Text Entry a number to compute. If the text contains any of the characters (, +, -, ., or [, it is assumed to be a formula, and the cell is marked as containing a computable formula. Otherwise it is just .index Text to Formula .index Formula to Text treated as a label and the formula itself is displayed. If you find the guess is not to your liking, the DF command below lets you alter the format and tell AnalytiCalc that the entry is / is not a numeric. An additional special character is the '"' (double quote) character. If this character appears any- where in the entered formula, AnalytiCalc will take the formula as text, regardless of whatever else is in it. You can also combine comments and formulas by using a separate statement and the *C construct .BREAK (e.g. SUM[A3:A12]_\SQRT(%)_\*C SQUARE ROOT OF THE LENGTHS) .BREAK of Calc. Once a cell is set up as numeric or text, it remains as it was originally set until changed (using the DF command, described below). The ET and E" forms of the Enter command force the formula entered to be considered as text and not as computable, and the EV form forces it to be considered computable, regardless of the presence or absence of special characters. Note however that numbers need decimal points for their values to be understood correctly. If the decimals are omitted, the expressions may be considered integer. These will be converted, but the conversion has some limitations and is advised against. Also, integer division truncates results to produce an integer result (so that 7/2 would evaluate to 3, while 7./2. would evaluate to 3.5, for example). Thus, to avoid surprises, use decimals. .P Where the auxiliary console support routines supplied for PDP11 or VAX are in use, any commands will be translated to upper case .index Case Conversion unless a " character appears anywhere in the command. If a " character is .index Help .index Keypad Commands found, only the first 2 characters are converted. These special console routines also attempt to convert the PF2 key to H (Help) (as in EDT), and to convert the arrow keys of VT100 or VT52 to the 1,2,3, or 4 commands to move the current cell. .P On the PDP11 or VAX, AnalytiCalc will turn the auxiliary keypad feature of a VT100 on to allow use of the auxiliary keypad as a shorthand for many user-specifiable command sequences. .P Most keys map to indirect files to make customizing .index Keypad Command Files .index Keypad Commands AnalytiCalc easier. These files are assumed in one's default directory with names KYa.CMD where a is P, R, or S for PF1,PF3, or PF4, or AKa.CMD where a ranges from A through N (0 thru 9 are E thru N). In addition, the program is able to read a keypad diagram into Help page 9 from a file KEYPAD.PIC which may be updated to correspond to the keypad functions chosen. A version of this corresponding to the "standard" keypad is supplied. .p Note the terminal is set into auxiliary keypad mode to enable these keys to function. .TEST PAGE 10 .LITERAL AUX KEYPAD MAPPING IS: KEY CHAR AKx.CMD,x= 0 p E 1 q F 2 r G 3 s H 4 t I 5 u J 6 v K 7 w L 8 x M 9 y N , l A - m B . n C ENTER o D MAPPING FOR PF1 THRU PF4 IS: KEY FILE PF1 KYP.CMD PF2 (none - Equivalent to H Command) PF3 KYR.CMD PF4 KYS.CMD .END LITERAL .P Examine the KEYPAD.DOC file for the values of individual keys. There is a build option to read keypad command files from logical device DK: which may be in effect at your site; the system manager should be able to tell you. .P .index Gold Key Because many prefer a "Gold key" style command processor, AnalytiCalc can be set up for gold key functions. A "gold level" is kept internally and is incremented whenever a command beginning with the character _^ (up arrow) is seen, and cleared upon executing any normal command or opening a new command file. When the gold level is greater than zero, the command file names opened by the auxiliary keypad are modified by adding 1 extra letter, which is computed as 64 plus the gold level, which means that at gold level 1, an A is added, at gold level 2 a B is added, and so on. A gold key top level (no added letter) command file may be built containing a single _^ line. For multiple levels of gold key access, second level files may have two _^ lines (one after the other), third level files may have 3, and so on. Command files are opened read-only, so they may be shared and any desired level of gold key-ing may be supported. Supplied command files using gold key use the VT100 LEDs to indicate that the "gold" level is nonzero. .P A bit of added functionality has been added to allow some extra flexibility in command handling. A line beginning in % is assumed to have several fields: .SKIP 1 %FLD-1%FLD-2%FLD-3 .SKIP 1 in which FLD-1 if present is typed out to the screen first (used to set screen widths). Then FLD-2 is passed as the command. If FLD-3 exists and starts with a _? or \, then the terminal is read and the result is added onto the end of FLD-2 before the command is passed back to the spread sheet. If the command begins with a space or control character or a \, then it is commented out and the command file falls past the % line. If however FLD-3 started with _? and the initial read-in character is not \ or a control character, the command file is rewound. This feature is used in the enter command file (AKD.CMD) to implement an "enter mode" somewhat akin to that of Visicalc, Supercalc, or others of that ilk by automatically inserting the "E " of the PortaCalc Enter command until a \ is seen. If FLD-3 should be present and start with a _& character, the auxiliary file is closed there and console input done as in \ input. .P Note that a file KYSAUX.CMD is supplied which may be used instead of KYS.CMD. If used, it is the ENTER MODE command and will turn off auxiliary keypad mode on the terminal. This way, PF4 may be used to get into enter mode and the numeric keypad used to enter numbers. Recall that the period (.) of numbers is normally needed for their proper recognition as numerics. .P Additionally, where the Gold levels are supported (with lines beginning with "_^" incrementing the level), gold-PF2 will be the same as H9 (help 9), and gold-gold-PF2 will be the same as H10, gold-gold-gold-PF2 will be as H11 and so on. This allows multiple screen picture displays and makes them more available. More than 9 help screens are supported only in PortaCalc-PC, but in that version, a Help system with up to 99 screens is supported. These are externally defined by a help file there. However, by adding Runoff instructions to suppress headers and paging, this manual may be turned into a standard RSX or VMS HELP entry and accessed online via the $HELP command. .INDENT -1 4 EXAMPLES .P .index Multiple Equations The expressions that are entered can be numbers or formulas relating numbers and other cells. They may also consist of several statements separated by a _\ character which will all be evaluated at that cell, up to 110 characters. Thus, valid commands might be .TEST PAGE 8 .LITERAL E 55.234 Enters value 55.234 at current cell E B4+H2+D5 Cell will contain the sum of cells B4,H2, and D5. E Totals Cell contains literal text "Totals". .END LITERAL .INDENT -1 4 FORMULAS .P Formulas may be used too. These include 2 classes. The first are the .index Functions multi-argument functions, which either appear at the start of their statements or substatements (alone), or inside expressions. The difference between the classes is that the multiargument functions must have cell names or ranges as their arguments, while the single argument functions can have arbitrary expressions in their arguments. Otherwise they may mix freely. All functions listed below may appear in command files or cells, and arguments must be cells, not expressions or constants. The IF statement, while it is treated as a function syntactically, may NOT appear inside general expressions, but must begin a cell equation or sub-equation (i.e., it may begin after a \ in a cell containing several operations). It cannot be used inside command files driving cells, but its functionality is supplied there by the "*J#label" function, so no real limitation exists on capability. .SKIP 1 .TEST PAGE 12 The available multiple argument functions are: .index SUM function .index MAX function .index MIN function .index AVG function .index STD (Std Deviation) function .index IF conditional .index Boolean Functions .index IRR function (Internal Rate of Return) .index NPV (Net Present Value) Function .INDEX PMT Function .Index AVE Function .INDEX FVL (Future Value) function .index MOD Modulo function .index LKP, LKN, LKE Lookup Functions .TEST PAGE 20 ^? .LITERAL SUM[variables] Sum of all arguments MAX[variables] Max of arguments MIN[variables] Min of arguments AVG[variables] Average of arguments AVE[variables] Average of arguments excluding zero args STD[variables] Standard deviation squared IF [V1.rel.V2] statement | else-statement AND[variables] Boolean AND of all variables in list IOR[variables] Boolean inclusive OR of variables NOT[variable] Boolean complement of variable XOR[v1,v2] Boolean exclusive OR of v1,v2 EQV[V1,V2] Boolean "equivalence" of V1,V2 (complement of exclusive OR, true if bits have the SAME value) CNT[variables] Number of nonzero variables in list MOD[V1,V2] Returns V1 modulo V2 (i.e., remainder of V1/V2 division.) SGN[v1] Returns 1.0 times sign of V1 LKP[var,variables] Lookup variable in "variables" range greater or equal to var, return its index (starting with 0) into variables range. LKN[var,variables] Lookup variable in "variables" range less than or equal to var, return its index (starting with 0) into variables range. LKE[var,variables] Lookup variable in "variables" range strictly equal to var, return its index (starting with 0) into range. Note all LKP, LKN, LKE return the last variable index if no satisfactory value found. NPV[disc,vars] Net Present Value of vars (equal time interval numbers), at discount rate disc where disc is a fraction (e.g., .12 for 12%) IRR[PV,FV,returns] Internal Rate of Return. Will compute internal rate of return on up to 20 periods, returning rate per period. The returns are expected to be at equal time intervals. PV and FV are initial and final values of investment and the result is computed via Newton approximation. PMT[princ,inter,nper] Payment (mortgage payment per period) function. Will compute payment per period for principal amount "princ" with interest per period as "inter" and number of periods as "nper". All arguments must be cells. The formula is the standard ordinary annuity formula. Interest rate must be a fraction so that 14% would be 0.14, for example. PVL[payment,inter,nper] Present Value formula. Computes present value of an annuity given "payment", the payment per period, interest rate per period (as a fraction, so 12% is 0.12) in "inter", and number of periods as "nper". All arguments must be in cells. RND[DUM] Generates a random number between 0. and 1.0. An argument is needed but it is NOT touched by this function. CHS[IDX,Range] Choose cell from range based on value of cell IDX. If cell used as IDX is 1, first element of range is chosen and so on. Zero is returned for out of range cases. .END LITERAL \? .INDEX Random numbers .Index RND function In all but the case of IF [...], arguments are variable names separated by commas, or variable ranges, or mixtures separated by columns. All these functions require cells or accumulators as arguments; literals and single argument functions may NOT be used here. (That is why it is easy to place multiple commands on a line; the ACs or cells may be loaded in "separate" steps.) .index SUM function .index MAX function .index CHS function .Index AVE Function .Index PMT Function .Index FVL Function .index MIN function .index AVG function .index STD (Std Deviation) function .index IF conditional .index Boolean Functions .index IRR function (Internal Rate of Return) .index NPV (Net Present Value) Function .index MOD Modulo function .index LKP, LKN, LKE Lookup Functions .P Note that the function STD gives a "variance" which normally will be the square of the standard deviation; just use SQRT(STD[range]) to get the ordinary standard deviation (using "n" statistics; scale to use "n-1" statistics). The AVG function computes an average as the sum of all cells in the range given divided by the number of cells. Since label cells are counted (with value zero), this may not always be what is wanted. Therefore, the function AVE[range] returns the average ignoring label cells completely (by ignoring cells with zero value). .P The Boolean variables are computed by taking the integer values of the variables and performing the appropriate boolean masking operations on them. The values are returned as whatever type (floating or integer) the cell is. 32 bit integers are used. The CNT operation will (generally) omit cells that have not been initialized, since these have a value of 0.0 and are not changed unless modified explicitly. It may be used to compute a more accurate average than AVG where many uninitialized cells add zero values in. The quotient of the SUM divided by the CNT of a range will give an average of nonzero cells only. This is duplicated by the AVE function for ease of use. .P The LKP function quickly locates a cell in a list where the value is in a desired range; the *G function may be used to extract other cells close to the addressed cell (e.g., beside it or below it). The LKN and LKE functions are exactly the same but search for lower or equal values instead of greater than values. This makes varied search strategies easy to do. These functions are most useful in user command files for selecting parts of the sheet according to criteria, as they allow very fast searches of large parts of the spreadsheet from inside command files. In this application the LKP class functions would be accessed via the TEst command. Since the ranges can be either rows or columns, no special "horizontal" or "vertical" lookups are needed. Note the FIRST cell that matches the criterion of the search is returned. .P The NPV function is the standard financial Net Present Value function, assuming the discount rate is the fractional interest percent per period for the amounts in the range given, and that the range of numbers represents equal time periods. Remember to give a FRACTION rather than a Percent, so a 5% interest rate per period should be given as .05 for example. .P The IRR function will compute IRR given present value, future value, investments per period (for up to 20 periods), and assuming that the periods are equally spaced. The IRR value returned is per period and must be multiplied by periods per year to get a yearly rate. This function is computed iteratively. The PMT and FVL functions are payment and present value formulas. These functions are implemented only on the VAX version of AnalytiCalc-PC (due to space). They are present only for convenience and follow the same rules about arguments having to be in cells as other functions of this type. To compute them one uses the formula .Break Payment=Princ*(int/(1.-(1.+int)**-nper)) for payment, or .Break PV=payment*(1.-(1.+int)**-nper)/int for present value. .P No function for the value of PI is presented. Pi is approximately 3.14159265358979323846... and may be used in this way if needed. It is suggested that the @PI.CMD command file be used to enter the value PI anywhere desired, or that a cell contain it and be named as {PI so that if you MUST have the constant in your sheet, it will be in one place. Since pi/180. is more often used, you may prefer to compute that instead and use it. .P The random number function RND[] is included to facilitate generating "Monte Carlo" spreadsheet calculations. It is uniformly distributed between 0.0 and 1.0. Other distributions may be derived from it via standard techniques described in numerical methods texts; the GAUSS function in the IBM SSP library can be used as an example of this. In Monte Carlo applications, some accumulator can be used as a counter to provide a count of calculation passes. The built in IF [] function can be used for producing triangular distributions by selecting one of a pair of scalings of this random number also. .P Functions which perform selections on their input ranges (MIN, MAX, LKP, LKN, and LKE) return the column and row numbers of the cells found in accumulators P and Q respectively in addition to returning the function values. This is true of AnalytiCalc-PC and AnalytiCalc-88, V18-07A and later. It is useful for operating on argument lists where the arguments are not single ranges. .skip 1 4 VARIABLE__NAMES .P A valid variable name might be H14 or N22 or A3, or the .index Variable Names position independent forms P_#n_#m and D_#n_#m where n and m are offsets in Physical or Display sheets from the current column and row. A valid range is 2 variable names separated by colon (:). Thus the range B2:B12 is valid and means B2 through B12 inclusive. The range expression D_#0_#1:D_#0_#12 is also valid and means the .index Position Independent Names cells on the display sheet in the same column but 1 to 12 rows down from the current cell inclusive. (The displacements may be negative too, with - sign to indicate it, as D_#-3_#2 for the display cell 3 columns left and 2 rows down from the current position.) The P_# and D_# forms are valuable since they work wherever you move them. Other variables may be relocated when moved (renaming them to correspond to their new locations), but the P_# and D_# forms need never change and allow working with projections across the physical sheet in various ways. There are a few restrictions with these forms. They usually need to be enclosed in parentheses (e.g. (P_#3_#5) rather than P_#3_#5) inside expressions and therefore also won't work in ranges of form v1:v2 inside multi argument functions. For most purposes they do work interchangeably with other name schemes however. For most purposes, the "normal" naming scheme is more flexible. Copying with relocation works in it, provided that the cursor is above and left of cells to be renamed (see below). The keypad copy command normally moves to A1 during a copy for this reason. .P It should be noted that the D_#col_#row forms work correctly only in the "prime region" of the sheet (upper left part) because the speed penalty for handling them globally would be excessive. The P_#col_#row forms work everywhere. .P The special construction P_#%ab or D_#%ab allows relative addressing .index Special Cell Addressing relative to current physical or display location using accumulators named a or b (where a or b may be any accumulator name from A through Z but upper case is REQUIRED). This computable relative addressing affords greater flexibility in command procedure construction. .P If a formula contains the construction {VN (where VN is any cell name), the FORMULA for cell VN is inserted into the formula being evaluated at that point, when the cell value is to be computed. This may be done several levels deep, but is stopped after 20 translations to avoid infinite loops due .index Formula Indirection to circular references. Some care must be used here since the final translated formula must fit in 110 characters and will be truncated if it gets too long. This construct is useful where formulas are to be tested. It provides a handy inline macro capability permitting complex formulas to be entered more easily. This feature may be used with the P_#%ab form of addressing to provide runtime addressing of formulas anywhere in the matrix. .P The command processor may use these inline macros in commands. .INDEX COMMAND MACROS .INDEX PARAMETER SUBSTITUTION If a command line contains 2 successive underscores (____) anywhere in its length, the underscores will be stripped out of the command line and the command line will be scanned for {Vn forms. If any are found, they will be substituted for prior to interpretation of the command. This will occur AFTER any console text is read if console text is required by one of the %%% forms of command line. This permits formula cells to be used as a convenient place to store intermediate answers in models being driven by command files. It is not particularly useful from the console, but works, and may be used to reenter a formula without moving it explicitly if there is a reason to do so. .P If a command is given that AnalytiCalc cannot otherwise understand, and if it is the name of an accumulator, the formula associated with that accumulator is executed as a command as if instead of typing, let us say, Q, you had typed ____{Q0 which will execute the formula of Q. Accumulators B, J, N, Q, T, U, and Y can be assigned commands in this way, allowing limited quick commands to be implemented. Since the accumulators are scratch storage, you must run a command file or have the file that starts AnalytiCalc set the commands desired up. .skip 1 .C Naming Regions or Formulas .P In the VAX version, PortaCalc will allow you to define names (as many names as there are rows) to refer to the contents of certain cells' formulas. The names may be up to 16 characters long and they may be defined with a command like: .P TEst {namestring=V1 .skip 1 where "namestring" is the name being defined and V1 is the cell .index Names .index Macros name whose contents replace the {namestring construct in later formulas. If the construct "{namestring" (less the " marks) is seen in a formula, it is treated exactly as if it had been a {V1 string. For example one could place a sales total formula in cell C5 and issue a command: .P TE {SALES=C5 .skip 1 and later one could have a formula like "0.06*{SALES" in another cell, which would no longer have to remember the definition of "sales". There is no facility to dump definitions, but they may be included in formulas and saved with a sheet if desired, being executed when computed. Save as text and use TE __{cell to get them evaluated to define the names. .P Note there is some scratch formula storage as well as the scratch accumulator stores. A phantom "row 0" exists which includes the accumulators, but all cells in row 0 may contain formulas .index Scratch Storage .Index Row 0 and/or values (though cell AA0 conflicts with accumulator % in value and should be used for text storage only). This is handy for storing name definitions TEMPORARILY, as during command file execution. The storage in these cells is NOT saved but is purely available for scratch use while running AnalytiCalc. It does however save you from having to use the bottom or right edges of the sheet for scratch formulas if you are using the macro feature as a way of entering text. .P A dump of definitions may be made onto a disk file by typing the command .P TE {*= .skip 1 which will ask for the output filename. Type a return an extra time or two after the dump. Note that the format of the output file is a set of TE commands which may be played back into PortaCalc via the @ command to recreate the definitions. .Index Symbolic Name Dump .P Since it is sometimes useful to have mixed formulas which allow .index Mixed Relocatable Names certain cell references to be absolute and never relocated, with other references which are relocatable, cell names may be specified absolute. If the character "$" (dollar sign) is placed after the letter, the number, or both, parts of the variable name, the part of the variable name followed by the dollar sign is absolute. Thus, the variable AB30 is relocatable in both row and column. Variable AB$30 is relocatable in row only (the 30 is not followed by $), and the AB column will not be changed in any relocate. Variable AB30$ is relocatable in column, but the row 30 reference does not change. Variable AB$30$ is totally absolute. Note that these absolute variables are harder to move around even on adding or deleting rows, so they should be used with care. This relocation protection can be temporarily inhibited with the OV + command and reinstated with the OV - command. This will allow .index Mixed Relocation Override copy of cells with relocation if it is needed, without laborious editing. The program starts in OV - mode and will remain in OV + mode until OV - is set up again. The commands may be given in the form OV-, OV -, OV+, or OV +. .skip 1 .INDENT -1 4 VARIABLE__RANGES .index Ranges .P Variable ranges must lie in a single row or column. Erroneous specifications are rejected and ignored generally. For versions of AnalytiCalc supporting matrix operations, matrix dimensions are however given by specifying the upper left and lower right corners of the matrices. Thus the range A1:B2 is the 2 by 2 matrix containing cells A1, A2, B1, and B2. For operations using full rectangular regions, support is offered via auxiliary keypad commands which allow filling of large regions or moving data into them. This is done via command files automatically invoked, but the methods used are transparent to the user. Other operations on rectangular regions not confined to a single row or column may easily be added in the same way. The internal implementation permits copying rows to columns and vice versa as well as rows to rows and columns to columns; this is why regions must be one or the other. It is expected that regions are specified starting at top left and ending at bottom right. .skip 1 .INDENT -1 4 FUNCTION__ARGUMENTS .P Note that the square brackets ([]) are needed to delimit .index Function Arguments arguments in multiple argument functions. The results are left in accumulator % and in the cell. The IF form will compare 2 variables and execute .index IF statement either the statement or the else-statement (which must NOT be another .index Relations IF). The valid relations are: .LITERAL .EQ. Equal .NE. Not Equal .GT. Greater than (V1 greater than V2) .LT. Less than (V1 less than V2) .GE. Greater than or Equal to (V1 >= V2) .LE. Less than or Equal to (V1 =< V2) .END LITERAL and must appear in this form. (Note that your formulas must generally be in upper case only; text can be anything.) .skip 1 .INDENT -1 4 UNARY__FUNCTIONS .P The second class of formulas permit fully general arguments of expressions, cells, and the like (and are evaluated AFTER the multi argument functions lexically). These are more conventional, use parentheses, and include single argument functions like SQRT, ALOG, EXP, SIN, COS, and so on. See the built in interactive calculator mode manual section below .index Functions for more detail. However, they may use variable names as anywhere, not just single letter accumulators. Thus, SQRT(A5) is a valid number. There is a function list in the documentation of Calc mode later in this manual. .skip 1 .INDENT -1 4 ACCUMULATORS .P The single letter accumulators of Calc (letters A through Z and .index Accumulators .index Arguments %) are available globally and may take on all Calc data types (see the description of calc mode below) including multiple precision. They are usable globally on the entire sheet and may serve as arguments to command files or return cells for results. Inside command files, Calc can perform any of its usual calculations. The multi-argument functions listed above are not available there (though they can be simulated by enumerating cells), but everything else is. The letter accumulators are available in all cases in addition to cells. Of course, any unused cell may be used as an accumulator too, but cells in the spreadsheet are at most 8 bytes long and cannot hold multiple precision arguments. .P To get, e.g., the square root of the sum of several variables (in a row or column; ranges may only be in rows or columns together) one might have a formula line like: .SKIP 1 SUM[A1:A20,B4,F2,C5:C20,J3:M3]_\SQRT(%) .SKIP 1 which computes the sum of the 2 cells and 3 ranges and leaves it in %, .index Multiple Equations then computes the square root of that and leaves it in the cell. The formulas to Calc may be complex but MUST NOT be longer than 78 characters. Break up longer ones so they can be fed to Calc in smaller chunks. Notice that the expression given could have been written as SQRT(SUM[A1:A20,B4,F2,C5:C20,J3:M3]) but was broken up for tutorial purposes. .skip 1 .INDENT -1 4 AUX__COMMANDS .P The commands of CALC should be examined carefully for usefulness. .index Other Functions You can enter programs into CALC which can be used as user-defined functions from the sheet if need be. Also, there are a few new commands in CALC for the sheet. See the documentation about the Calc mode (interactive calculator) for full lists of functions. .P One of these is the *G command. Its syntax is .SKIP 1 *G V1,V2 .SKIP 1 which has the effect of evaluating variables V1 and V2 as column and row numbers on the physical sheet and returning the .index Indirect Cell References physical sheet variable addressed by those variables. The ranges are clamped to fit on the sheet. This gives indirect addressing, permitting lookup tables to be made up by creating the index you want and then accessing the addressed table element. Typically the *G command would be the last on a formula line, though it need not be. Its value is returned in the % accumulator. .P Another is the *W command, which simply takes the number in % and places it in the formula for the current cell on the spread .index Value Freeze sheet. This may be used to "freeze" a value, replacing a formula by a constant for future use. Note that the previous contents of the formula entry are lost. Thus, a *W command in the sheet will normally cause itself to be overwritten after one use. The number is stored in a format D35.24 in the worksheet. The *WF command stores the value using the current cell format. It is a good idea to use a command like "E#_%=P_#_#\*WF" rather than just E#*WF to ensure the % accumulator REALLY is the current cell. .P To implement user functions, if Calc sees an expression of .index Command Files .index Cell Commands the form "*@filename.ext", it will execute that file as a command at that cell. Any filename may be used and as many functions as desired can be handled in this way (with obvious overhead), with nesting depth of up to 3 permitted. Once Calc starts using logical unit 4, however, it conflicts with the P or G commands and may have problems. .P Calc has also a command called *P which allows resetting .index Temporary Motion of the physical coordinates while executing a cell's formulas, ^? for the duration of that cell's formula only\? or while in K mode only. .P The syntax of the *P command is either just *P (which causes Calc to prompt for column and row), or *P Variablename (which moves the current location to the named location), or *P@ variable1,variable2 (which moves to the location which is defined by variable 1 and 2 as col. and row). .P Some other commands exist for the main benefit of AnalytiCalc in Calc. .P The command *F LABEL .BREAK will evaluate the % variable. If it is positive and nonzero, then .index Conditional Loops the current input line will be rewound and the program will (silently) .index Command Files seek a line of the form *CLABEL. This allows loops to be defined with % as the counter. This command acts on the unit used by the AnalytiCalc @ command, NOT the unit for the Calc *@ command, and is a way that the Calc formula conditionals may be reflected back into its command processing. The TE expression command may be used first to set the % variable as needed to any arithmetic expression to control the loop. .P The command *J LABEL .BREAK will act as does *F LABEL but its search will be in the current file .index Conditional Loops .index Command Files opened by a Calc *@ command (i.e., an *@file inside a cell on the sheet, or given from the console after a K command [see below] to enter bare interactive Calc). .P The command *QF or *QW file _?searchkey_? .BREAK .index Command Files .index Data Base Access will open file and look for lines starting with searchkey as given (with __ as a wild character). Upon finding this, it will look for the and if it finds it, it will select the part of the line in the file between the 2 characters given (which may be alike) as they are first found, and will do one of 2 things. If the command was *QF, then Calc will Float the value found there (attempting to use a large E format) and return it in %. If the command was *QW, then Calc will Write the selected part of the record into the formula at the current physical position on the sheet (which may be reset by an immediately preceding *P command). The record may contain the search key anywhere. It is up to the user to make sure the formulas copied make sense. This however allows access to sequential files of data which can be created by an editor, word processor, etc., and which might hold keyed information that the spreadsheet should be able to manipulate. As a user convenience, there may be a second key specified (also inside a pair of _?s). If two keys are specified, Calc will search for and require that BOTH be somewhere in the record accepted. Note too that the files opened may not have any records longer than 128 characters per line. There are 2 variant forms, involving the 4th character (i.e., the next one after the F or W of *QF or *QW). These may permit sequential access to a data file. The *QFK command is exactly like the *QF command (ditto *QWK and *QW) BUT it will not close the data file after finding the desired cell unless it reached EOF. This permits subsequent commands of the *QFN command (for "Next") to continue reading the file. The *QFN command will continue reading the file (the file spec must be there but is ignored) from the next record and will also not close the file. (Ditto *QWN.) The *QFC command will act exactly as *QFN BUT will close the file when the request completes. Thus, a file may be opened with a *QFK (or *QWK) command, subsequent data retrieved by *QFN commands, and finally the last data retrieved with a *QFC command. Also, *QF commands will close the file prior to opening another. .P Formulas entered may have (this version only) the following constructs which will be edited into the formula as entered (so a command file can enter them): .SKIP 1 .LEFT MARGIN 15 .index Command Files .index Formulas .index Cell Names .INDENT -5 __@V1,V2 Means get the values stored in V1 and V2 and use them as column and row locations pointing at some cell in the sheet. Replace the construct with the name of that cell. .INDENT -5 ___#V1 Means take the real number in cell V1 and unpack it as if it had been a packed value from a formula with 8 characters packed; then convert it back into ASCII and place in the formula in place of this construct. This construct is intended to be used with the *U#STRVL function to allow retrieval and edit of formulas. The *U#XQTCM function permits use of the EDit command within a cell for string manipulation. Only 8 characters at a time may be represented (the limit imposed by cell size), but repeated use allows handling any desired length. An application would be setting the cell used as V1 to a packed representation of either of two strings inside an IF#[] and then EDiting the string into the formula as desired where one of the 2 strings should be made to appear. This capability is crude but provides the bare bones functionality. Additional USRFCT calls to give simpler (but more verbose) string manipulations are not too hard to add should the user need them. .LEFT MARGIN 1 .skip 1 .INDENT -1 4 FORMULA__LENGTH .P Formulas have 109 characters allotted to them for use .index Formulas .index Formula Length inside the spread sheet. It may happen these are not enough for use. In other spreadsheets, the technique is to put the formulas in other cells inside the sheet and possibly use screen windows to avoid display of the intermediate results. .P While you can use that technique here too, you have an alternative. It is to use an indirect file in that cell .index Command Files and inside the cell in the spreadsheet just have a command "*@FILE.TYP" where the file is named "FILE.TYP" (you pick the real name). Inside this file may be whatever calculations you like. .P So long as the file is to operate in a fixed cell location .index Command Files .index Command File Limitations in your spreadsheet, you may use variable names like A3, D1, etc. inside the file. Your command files may include any multiple argument functions except the IF function. (The *F and *J functions can be used to provide equivalent functionality inside command files however.) The only restriction on multiple argument functions is that their arguments must be cells, not general expressions. .P Once you add or delete rows or columns, or copy a formula, though, the file may not work as expected if the cell .index Relocation .index Command Files calling it has moved. Since the relocation done by AnalytiCalc only operates on formulas stored directly in the spreadsheet, it cannot relocate variables in the indirect files. However, you can make the files "position independent" so they WILL work wherever they are called from. (This has the side benefit that a single file can be called from many cells.) .P The way to make the files position independent is to use location-relative variable names instead of absolute ones. That is, inside cell B4, the cell immediately above .index Position Independent Cell Names can be named B3 (the ABSOLUTE name), or it can be relocatably named P_#0_#-1 (the relative name). Likewise the cell one to the right would be named either C3 or P_#1_#0, and so on. The cell two down and one left would be either A5 or P_#-1_#2 (you can begin to see how it goes). A file containing only location-relative variable names will work even if called from a different cell, since the references will be figured out when used. These references are more difficult to write than the absolute ones, but since they work without renaming, they provide a level of flexibility needed where long formulas must be used. These forms should be used wherever indirect files are used to hold cell formulas. The computed cell name forms like P_#_%ab can be used also provided the a and b accumulators are initialized properly, or the command file does its own relocation using the X and Y accumulators set on entry. .skip 1 .INDENT -1 4 LINKING__SHEETS .C LINKING SHEETS .P To enhance AnalytiCalc, it is possible to have a cell refer .index Linking Sheets to cells from another, saved sheet anywhere in the system. The sheet must normally have been saved starting at the upper left (i.e., cell A1) as would be the convention for using with PCGRAF (see PCG.DOC). With AnalytiCalc-PC, normally symbolically saved sheets can be accessed for values also, unless they were saved with formulae only (PPF command below). Numeric values MUST have been included in the save, so sheets saved with the PPF command (which only saves formulas) cannot have values linked. .P The command *XV filename V1 .BREAK will eXtract the Value of cell V1 (V1 is any variable name, e.g. .index Extract Saved Value .index XV Command C15, AA3, F9, B34, etc.) from the saved sheet saved in filename. The filename is any legal host system file specifier. Note that there may be as many files as desired here, but only one cell is returned. .P If it is desired to extract a formula from a saved sheet saved NON-NUMERICALLY (i.e., NOT saved with the PPN command), the command form is .skip 1 .BREAK *XF filename V1 .BREAK .skip 1 and this will cause the formula in "filename"'s cell V1 to overwrite the current physical sheet. To avoid this, one might write a formula like .SKIP 1 *P V2 _\*XF myfile.typ V1 .SKIP 1 which would cause current sheet variable V2 to have its' formula loaded from saved sheet "myfile.typ"'s variable V1. .P Note that filename syntax can be anything desired so that fully qualified device, directory, and nodename syntax is permitted. In a DECnet/VAX environment, any file anywhere on the net may be accessed in AnalytiCalc anywhere AnalytiCalc needs a filename. There is a limit in total length (usually to 80 characters) for the filename, but apart from that, the name is unconstrained. This is true of ALL places AnalyiCalc accesses filenames. .skip 1 .INDENT -1 3 EDIT ^? .LITERAL EDIT FORMULAS ED 'string1'string2' Replace string1 with string2 in current cell formula. Either string may be null if desired. .END LITERAL \? .P The ED command allows editing of formulas with some extra .index EDIT bells and whistles. Basically, the new string replaces the old one, EXCEPT that it is possible to do some limited argument replacement. .P The constructs _&1 through _&4 will be replaced by arguments .index EDIT, Special Constructs .index Command Arguments 1 through 4 as last entered by the "-" command (see below). These may be from 0 to 51 characters long each, and multiple _& constructs may appear in a substitution. No _& constructs may recurse, however. A second ED command can have the effect of the recursion in some cases however. .P The construct _&5 will evaluate accumulator Z and, if it is in a range where it may be so represented, take its integer part and convert it to a numeric string (up to 10 characters) in the place of the _&5. .P The construct _&6 will replace the cell with the contents of the integer part of accumulator Z provided that that number is between 1 and 256. Thus, any single non-null ASCII code can be entered. Accumulator Z is used to avoid conflicts with %, which is used too frequently to reserve for this purpose. To set up Z interactively to a constant, the command "TE#Z=nn." will set Z to the value nn. .P The EDited formula is re-entered into the cell after the edit. .P If the initial string is null, the EDit command appends the replacement string onto the contents of the cell. If the replacement string is null, the corresponding contents of the cell's formula are deleted. Note that ALL matching strings in the formula are replaced, not just the first. The strings may be delimited by any character that does not appear in either the original or the replacement string, so the quote character shown in the example is not special. Any delimiter can be used provided it won't be confused. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 FILE__LOADING ^? .LITERAL FILE LOADING F filename/nnnn Read filename, skipping nnnn lines if the "/nnnn" is there, and load contents onto the currently displayed screen, broken into columns as the current screen is set up. .END LITERAL \? .P This command is designed to make it easy to load document .Index Word Processing files into AnalytiCalc in quasi-image mode. Once loaded, the characters .index File Loading .index F Command are in formula cells and may be moved around the sheet. The display format must be reset to get them to be treated as non-text; this command will reset all loaded cells to text format display. It repaints the screen upon loading. This feature makes it easy to capture data in AnalytiCalc from other unrelated programs. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 RESTORING__SAVED__SHEET ^? .LITERAL RESTORING YOUR SPREADSHEET GD Reload sheet down/right onto display coordinates. GP Reload sheet down/right onto physical coordinates. GxR Reload saved sheet and relocate so that the cursor is treated as having been at A1 in the save operation. Permits mergers of multiple formulas. Gxx+ Add saved sheet (if default save) values to current values; enters Recalc Manual mode. Gxx- Subtract saved sheet (if default save) values from current values. Also enters Recalc Manual mode. .END LITERAL \? .P The GP/GD commands are the inverse of the PP/PD commands and load those files to potentially new locations. This is the .index Loading Saved Sheet .index G Command simple way to merge sheets. In these cases, you are separately asked for filenames and limits on what part of the sheets to load/save. Only cells that are marked in use are saved, so sparse sheets take less space than saving the direct access files. Note that on save or restore the ranges to restore are asked for. To restore the sheet starting at the cursor, specify the lowest row/column offset of 1 and the highest either 0 or a very large number. Any rectangular region can be restored by giving the X and Y coordinates of the lowest and highest offsets from the upper left to restore, counting from 1. .break REMEMBER: THE LOW OFFSET SHOULD BE 1 OR LARGER, NOT 0. .break In AnalytiCalc/PC, the logic to write to cells involves checks of the built in symbol table to ensure that cells are not previously there and needing to be replaced. This slows the Get operation considerably, and is normally bypassed. However, where a saved sheet is being merged into an existing sheet (rather than restoring into a previously empty region of the sheet), the full logic may be needed for correct operation. To get it, enter the filename followed by "/M" (so that to read SAVESHEET.PCC in the full-update mode you reply SAVESHEET.PCC/M to the "Enter#Filename>" prompt, rather than just SAVESHEET.PCC, as an example.) (M stands for Merge.) .P Note the R modifier as the 3rd character of the command (i.e., GPR or GDR) makes AnalytiCalc relocate formulas read in so that the origin of the area read becomes the current cell, rather than A1 as it ordinarily would be. This makes merging multiple sheets trivial. .P The + or - modifiers in the 4th character of the command allow you to add or subtract multiple saved sheet values. These require that the normal default save (which includes both numeric and formula data) have been done to save the sheets being added. The values in the sheet have the saved values either added (if +) or subtracted (if -) from the current values. The manual recalculation flag is set to prevent any automatic recalculations also, since formulas are loaded from the last sheet loaded and overwrite other formulas in the same cells. (This is generally not a problem.) To manipulate these values if there is a need to, the TEst command and the matrix math functions (which include multiply matrix by constant) allow two dimensional areas to be moved around or multiplied by constants without turning on the sheet recalculation. Thus, averaging 4 sheets could be done by a GP command, three GPx+ commands, and then a TE using the *U MMPYC function to multiply the whole area by 0.25. (One could use TE A=0.25 to get a "cell" A0 to use in the MMPYC function if no 0.25 value existed to use already.) .SKIP 2 .TEST PAGE 20 .INDENT -1 3 HELP ^? .LITERAL HELP Hn Display a screen of help. (n from 0 thru 9) .END LITERAL \? .P The H command will display a screenful of help giving a .index Help summary of many AnalytiCalc commands and syntax options. When you type a second return, it will redraw the screen. .P In most flavors of AnalytiCalc, the PF2 key also means 'Help'. .p There are multiple help pages. They are selected by commands H0 through H9, the number defaulting to 0 and selecting which help screen will appear. Where the "gold key" style commands are supported, Gold-PF2 is equivalent to H9 (which displays the keypad picture normally), and higher "gold" levels display later help pages. Later help pages only exist in AnalytiCalc-PC, where up to 99 may be provided. The intent is to make possible the construction of a more intelligent Help system as desired, using the keypad as the primary command input medium. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 INTERACTIVE__CALC ^? .LITERAL DROPPING INTO INTERACTIVE CALCULATOR K Drop into interactive Calculator .END LITERAL \? .P The K command gets you into Calc, described below, and lets you do computations. When you give the interactive .index Interactive Calculator Calc program the *E command to exit, you return to the spreadsheet. This may be useful where you want to do auxiliary computations not in the spread sheet or try out formulas that you may want to debug interactively before entering them onto the sheet. This calculator knows decimal, hex, and octal radices and can be used to debug indirect command files written for use within spreadsheet cells; the *V 3 command can be given and then the *@file can be given in Calc mode, providing a trace playback of the actions of a command file to see what it is doing. See HELP INT__CALC for further information about Calc mode. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 LOCATE__CURSOR ^? .LITERAL LOCATE CURSOR (GOTO somewhere on the sheet) L variable-name Position cursor at variable-name .END LITERAL \? .P The L command moves the current position to the variable named on the Physical sheet (and the display sheet if the variable .index L Command .index Moving .index Locate current .index GOTO (Locate) Command is on the display). Examples might be .SKIP 1 .INDENT 4 L B3 ###Move to cell B3 .INDENT 4 L D6 ###Move to cell D6 .SKIP 2 .TEST PAGE 20 .INDENT -1 3 MOTION__DIRECTION ^? .LITERAL MOTION DIRECTION (Set Default Direction to move after an Enter) THIS COMMAND SETS DIRECTIONS FOR AUTOMATIC MOTION AFTER ENTER ONLY. SEE BELOW FOR HOW TO MOVE THE CURSOR AT OTHER TIMES. M0 (Swap previous, current direction) M1 (Move up) M2 (Move down) M3 (Move left) M4 (Move right) M5 (No auto motion) .END LITERAL \? .P The M command causes automatic cursor motion after an E command .index Auto Motion .index M Command in the direction indicated. This only occurs after an E command. The default condition is not to move at all after an E command, and this may be reestablished by a command of form M5 (actually Mc, where c is any character other than 1 to 4.) At each command, the old direction is saved and may be recalled via the M0 command. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 FILE__INCLUSION ^? .LITERAL MS Macrocell Show (handles &% and &&% files) MH Macrocell Hide (no special & treatment) &%file,nskip,nshow overlay file on screen &&%file,snskip,nshow Include file for output .END LITERAL \? .P The MS and MH commands turn on or off the handling as print time .Index Word Processing .Index File Merging .Index Frame Editing macros of the _&% and _&_&% forms of filenames. These permit you to use AnalytiCalc for report generation or outline handling more .Index MS command .Index MH Command easily. In MS mode, if a cell has an _&%file form in it, that file is read when that cell is displayed. The first "nskip" records are skipped in the file, and up to "nshow-1" lines of the file are displayed on null cells of the spreadsheet. Up to 4 files may be open at a time here. The left margin of the file text is made to coincide with the location of the cell containing the reference. You can use the $ (spawn) command to edit these files with your favorite editor or word processor on the system and they will automatically be updated on screen. The _&_&% form is used to include (possibly lengthy) files in output. The files are included in spreadsheet output at the point they are seen, indented by the amount of the indenting of the _&_&% command form. Therefore, you can use AnalytiCalc to organize a multilevel hierarchy of printout of reports. If a _&_&% form is seen in one of the files being included, that file is opened and included. This nesting may go to a depth of 4 levels. This permits a real "frame editing" using AnalytiCalc and your favorite editor or word processor (WITHOUT requiring you to learn yet another editor.) .SKIP 2 .TEST PAGE 20 .INDENT -1 3 ORIGIN__RESET ^? .LITERAL ORIGIN RESET (Windows onto physical sheet) OA variable Reset origin of display to variable OR variable Reset display down and right to start with variable OAD variable Reset origin of display leaving mapping Displacements intact ORD variable Reset origin down and right of cursor leaving mapping Displacements intact. .END LITERAL \? .P The OA and OR commands let you do quick scrolls around the physical sheet by resetting the upper left corner of the display sheet to point .index Windows .index OR Command .index OA Command .INDEX OAD Command .Index ORD Command .index Origin Control Commands at any variable on the physical one and make the rest follow suit (OA), or will reset the display sheet starting at your current cursor location to point at the physical sheet variable and make all parts of the displayed sheet down and right from your current location correspond likewise. .P Thus, if you start with a normal initial display and execute the commands .SKIP 1 .INDENT 4 L C1 .INDENT 4 OR H1 .SKIP 1 you wind up with columns A and B still on screen, but now the remaining columns are H, I, J, K, L instead of C, D, E, F, and G. This happened because cell H1, down and right were pointed to by the display sheet starting where you were, which was cell C1, initially the 3rd column and first row. Had the command been OA H1, the column labels would be H-N rather than the initial A-G. .P If the character D is appended to the commands (so they are ORD or OAD instead of OA or OR), the mappings are adjusted by adding the displacement from the current origin cell (upper left cell on screen in OAD or cursor cell in ORD) to the new cell (the one in the command) to whatever is currently there. The effect is to move an entire display-full of mapped windows to a new location, leaving all relative mappings intact. (Some pathological cases can occur where one moves parts of the windows into nonexistent areas. Use an OR or OA command to correct these.) .P To see the difference, consider a virgin sheet. .Index OAD and ORD vs. OA and OR If you first move the cursor to C1 and use the command "OR#AA1" the screen will now show columns A, B, AA, AB, AC, and so on. The rows will be (still) their initial 1 to 20. Now if you move to cell A10 and use the command OR#A100, the lower half of the screen now contains columns A, B, C, D, E, and so on and rows 100, 101, 102, and so on. If you want to reset the mapping so that there are four regions on screen, you need to move to C100 and use an OR#AA100 command to get the four regions desired (A1:B9, A100:B110, AA1:AE9, and AA100:AE110). This is somewhat counter intuitive. Therefore, if you use the command ORD#A100 instead of the OR#A100 above, the previous mapping of columns is retained, and you don't need to move to the middle part of the screen to reset mappings inside as often. This makes for much easier-to-understand windowing. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 SAVING__SHEET ^? .LITERAL SAVING YOUR SPREADSHEET PD Put out current Display sheet (Formulas) PPA Put out current Physical sheet (Formulas and Nos.) PDN Put out current Display sheet (Numbers) PPN Put out current Physical sheet (Numbers) PPF Put our current Physical Sheet (Formulas only) PxxM Put out display to physical map as well as worksheet information. Saves displayed mapping only. PxxMA Put out display to physical map. Saves entire mapping, whether within DB command bounds or not. S Setup Global Items (In workfile versions, Saves workfile and allows you to use a new one.) .END LITERAL \? .P In current versions of AnalytiCalc, the S command will lead to questions being asked about whether to update the display mapping. If you reply Y, you will be able to reset the default display column width to whatever you like between 1 and 120 characters and to say whether to reset the display sheet to point to the upper left of the physical spreadsheet. In any case you will be able to reset the default format and the spreadsheet title. In AnalytiCalc-VM and AnalytiCalc-PC, this is all the S command does. In the older AnalytiCalcs, global column width is not resettable in this way. .P The S command also (on VAX) asks for the length of the screen. This allows AnalytiCalc to be set up for displays of lengths other than 24 lines length. Some PC-based terminal emulators, some long-page terminals, and some windowing environments are places where a short or long sheet display may be wanted. The length chosen determines the placement of the command prompt and the current formula display, normally on lines 23 and 24 respectively. The DB command should be used with this to reset the number of rows being displayed, as this is allowed to vary independently in order to print long pages. This part of the S command allows you to use whatever screen resources you like, however. .P The S command also allows you to reset the mapping used for cells out of the normal "physical sheet" range. When you move to the right of the "prime area" storage (on VAX, generally this means columns past 80 over and rows lower than 400), cells continue to be shown, but cells to the right of the right border of the "prime area" (i.e., the real storage available) are remapped to the left of the real area but down some number of rows. Cells below the "prime area" are remapped to an area starting at the top of the "prime area" again, but right several columns. You can select how many rows down or columns right successive groups of columns or rows are moved to here. This must ONLY be done if there are NO active cells in an extended region; otherwise you mess up the mapping. Also the mapping must be reset when using a sheet that was saved with a nonstandard mapping for the computations to work normally. The default values are 1/10 of the width and length, and will normally be adequate. If you reply that you do NOT want to reset the extended area mapping, the questions will not be asked that set it. A negative number reply sets up the default mapping. If you must alter the extended map while using extended cells, save the sheet, alter the map, and rerun AnalytiCalc and reload the saved sheet. .P When asked for a new title, a carriage return (or anything starting with 2 spaces) will leave the old title alone. .P In workfile versions (i.e., old ones) the S command just returns to the start of Calc to let .index SAVE .index P Command .index S Command you select a new work file. You may reselect the old one if you wish; this lets you change the title only. Otherwise you can use the direct access file as primary saved info on a sheet. The PP and PD commands (with the GP/GD commands described below) are intended to be the primary means of saving/restoring sheets, and allow more flexibility in saving, restoring, or mixing sheets than the S command. Thus, the S command is intended as a highly temporary form of saving data, and should NOT be used as an archival means of storing a spread sheet. .P The PD and PP commands write Display or Physical sheet cells that are active to a specially formatted sequential ASCII text file, always starting from the current position of the cursor and saving right and down. Some questions will be asked so you may enter a maximum displacement to save (so not all of a large sheet need be saved) in columns and rows. On reload (the GP/GD commands), these questions are also asked, and minimum displacements are asked also to allow you to enter basically any region of the saved sheets into the current sheet starting at the current location and moving down and right. This gives a large scale move capability and a sheet merge capability. .P The PPN and PDN commands save numbers instead of formats to permit loading of isolated numeric values from other sheets by using the GD or GP commands (below). They record only numbers and not formulas, but this allows any cell's numeric value from other sheets to be loaded into another sheet without loading all .index Graphics formulas and repeating calculations. Also, the PPN/PDN commands are needed to use the PCGRAF program to graph parts of a sheet if this form of output is desired. .P The PP/PD commands are suitable for archival storage of spread sheet data, or for its transportation to differently compiled versions of AnalytiCalc. .P The "extended area" mapping available on the PortaCalc-PC version of the program allows one to use the storage on the sheet as a very wide but shallow, or long but narrow, sheet. Real storage is not altered, but extended addresses are given aliases on the real sheet. The wide-storage case can look something like this: .test page 20 .SKIP 2 .LITERAL AAAAAAAABBBBBBBBCCCCCCCC........ BBBBBBBB CCCCCCCC ........ .END LITERAL .SKIP 1 where the AAAAAAAA section may represent the first 80 columns and 20 rows, the BBBBBBBB section, the second 80 columns and the CCCCCCCC section the third 80 columns across. The BBBBBBBB section will appear to be just columns 81-160 in rows 1 to 20 as it is used. However, it actually uses storage in columns 1 to 80 and rows 21-40 (if we have the row increment set to 20). The section shown as CCCCCCCC is similar but would be mapped to rows 41-60, and so on. Rows below the sheet are treated in a similar way. That is, rows 401-800 in columns A through L might actually use rows 1-400 in columns M through X in the physical storage. If you use addresses in the middle of the range, they will be mapped somewhere on the physical storage, but it's harder to follow the remapping unless only very wide or very long sheets are being used, the other dimension being correspondingly short. .P It is fairly simple to increase the storage possible in the real sheet, but this has been left undone because an attempt to make a spreadsheet that really will try to calculate hundreds of thousands of cells will page fault itself to death and harm system performance unduly. Several commercially sold VAX or PDP11 spreadsheets have this problem already, and AnalytiCalc will not join them. The program's working set is always reasonable now. If the amount of storage is too small, you probably need a different kind of tool, and should investigate writing a program to do the calculations you need in a compiled language, rather than trying to pound it through a giant interpreter like this one. You should also see if the ability to handle several equations per cell and do matrix math can help. Computing the sum of the products of two columns can be represented as the product of one matrix with the transpose of another, for example. This calculation is far faster than wasting another column for the individual products and then summing them somewhere. The system performance and the time you save may be your own. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 RECALCULATE ^? .LITERAL RECALCULATE R Recalculate all of the sheet. RE Recalculate Entries as made but nothing else until R command given. RI Recalculate Incremental - Calculate displayed cells only. RM Recalculate manually only until R command given RAF Recalculate sheet, without constant recalculation (same as R) RF Recalculate, Force constant recalculation. RR Recalculate, Force, but stay in RE or RI mode if in it already. .END LITERAL \? .P The R command forces a recalculation of the sheet. This will .index Recalculate evaluate all formulas on the sheet and update the display to show the new numbers. Normally, recalculation is done after each number is entered to update the new cell, but the R command forces total recalculation in case anything was missed. Use the raf command for most recalculations to avoid the extra time used by R. The standard keypad's Recalculate key generates the RAF command automatically for ease of use. .P Since these calculations can be time-consuming, you can suppress them while doing input by entering the RM command (Recalculate Manually) which suppresses recalculation until an R command is entered. This command's format is just .SKIP 1 RM .SKIP 1 .P To speed normal recalculation, AnalytiCalc only computes constants once. In PCC-VM only, the normal R command will force them to be recomputed also. This may be suppressed (for speed) by the command RAF. (Actually the second character may be anything except M.) In all other AnalytiCalc dialects the R command does not recompute constants but the RF command does force them to be re-evaluated also. .P For further speedups, AnalytiCalc can be put into RE or RI mode to recompute only the cells just entered after each entry, or to compute cells on the display only. It starts in RI (Recalculate Incremental) mode until an R command is given. After an R or RF command is given, AnalytiCalc goes into a mode where it will compute ALL cells that have anything in them at each sheet recomputation. Another RI or RE command will return to the previous mode. The RR command does a RF (Recalculate, Force constant recomputation) but stays in Incremental or Entry mode. Whenever a new sheet is loaded, a single R is done automatically regardless of the current mode. .P In R, RE, and RF modes, AnalytiCalc computes all cells in across, then down mode (like a television raster scan). This corresponds to storage order to give best performance in a virtual memory system. In RI mode, AnalytiCalc computes by going across, then down, the DISPLAY cells, so physical access can be in non-optimal order. However, the speedup is generally well worth while. Therefore, RI mode is the default. Note that when a sheet is loaded a full recalculation is performed initially even in RI mode, however. Also, RE mode is effective only in the "prime area" of the sheet (upper left part) for speed reasons. .P Notice that these Recalculate commands both perform recalculations and set modes of recalculation. If the third character of the command is I (e.g., RII in Recalc Incremental, or RXI in normal recalc mode), only the modes will be set. An extra recalculation will not occur as a result of an RxI command (where x is any letter). This feature can be used where it has been necessary to recompute the entire sheet, possibly via an R command, and it is desired to return to the normal Recalculate Incremental mode. The RI command will recompute the display, causing a short delay. The RII command, on the other hand, will simply reset the mode to Incremental and complete at once so that subsequent recalculations will be affected. .P The RE mode applies only in the prime (i.e., upper left) part of the sheet. In extended areas (normally, those outside the range A1:CA400), it fails and R mode or RI mode should be used. This is done because supporting this mode globally would impose a large speed penalty. If a large sheet is used and your display is entirely in the prime part of the sheet, you can re-enter RE mode by giving the RE command any time your display points entirely inside the prime (upper left) region of the sheet. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 RELOCATE_BDY ^? .LITERAL RELOCATE BOUNDARY RB* Set maximum row and col for relocation to end of sheet RB Var Set maximum row and col to be relocated to coords of Var (cell name) .END LITERAL \? .INDEX RB COMMAND .INDEX RELOCATE BOUNDARY .P The RB command affords a way to specify a lower right corner to the area relocated by any of the copy and relocate operations. This allows the AR operation to relocate only a finite maximum number of rows or columns, or permits cells moved beyond the boundary specified to be unrelocated. The upper left corner of the relocation area is defined by the cursor position, so this permits any rectangular area to be moved without relocation while the rest is relocated. Combination of this feature with the AR and CR commands permits moving rows or columns (or parts of them) via command files. For example, a rectangle could be moved away from the origin further by using the cursor and the RB command to delimit the area to move, then using a command file to cycle through a set of CR commands to copy all cells down the desired amount. The AA command could then be used to delete the undesired top cells and the area to be moved now moved into its new address, all other cells having been relocated. The functionality of moving cells is however much better served on AnalytiCalc by the OA, OR, and DL commands to reset the display mapping (possibly while logging keystrokes so the mapping can be easily reproduced) to effect the desired move. For simply reformatting the screen, DL affords control at the level of any regions desired. A command file should be devised for moving cells but only used when really needed badly, if such actions are needed for other reasons. There will be very little need for them under most circumstances however. Where cells must move closer to the origin, an AR command at the origin can be used to provide temporary space in which to move the cells; at the end, they will be moved back further. The IR command (Inplace Relocate) can be used to avoid major moving around the sheet. The *U#HERE function will return the current max column in accumulator W and the current max row in accumulator Y to facilitate this. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 TEST ^? .LITERAL TEST TE expression Evaluate expression, save in % .END LITERAL \? .P The TEst command allows command level calculations, for use in .index TE Command .index TEst Compute controlling loops. It evaluates the expression (up to 79 characters long) and stores in the % accumulator. Useful for *J type commands to control branching in AnalytiCalc. Any expression may be handled in a TE command, and forms of the sort Z=expression are allowed. NOTE however that it is frequently desirable from command files to add a \*C to the end of the formula since sometimes junk from preceding lines is not zeroed. The \*C causes it to be treated as a comment and ignored. .P The TEst command will calculate formulas even in restricted recalculation modes (RM mode, RE mode, or RI mode) since it ALWAYS evaluates the expression regardless of mode. The construct to evaluate a cell with a command like .skip 1 .indent 5 TE#V1=____{V1 .skip 1 (which sets a cell value to the computed value of its formula) is explicitly legal and can be used where it is desired to perform irregular partial recomputations while in RM mode. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 VIEWSCREEN__REFRESH ^? .LITERAL VIEWSCREEN UPDATE V Redraw screen with normal formats VF Redraw screen showing all formulas VM Don't redraw screen until a V or VF is given. .END LITERAL \? .P The V and VF commands redraw the display screen showing numerics as numerics in the selected format (V) or displaying whatever part of the formulas fits on screen in the column (VF). This is used wherever .index View Command .index Redraw Command the picture on the screen is damaged, e.g., by operating system broadcasts. VM is used to inhibit redraw while numerous changes may be made, to save time. A V or VF command will re enable display updates. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 WRITE ^? .LITERAL WRITING SCREEN TO HARDCOPY OR FILES W Write screen to file .END LITERAL \? .P The W command lets you write a hard copy of the screen as it exists on display to a file. AnalytiCalc will prompt you for .index W Command .index Writing Screen to File or Print the file name; the device specifier should be included. .P Note that if the filename you enter (or the last character after the device or file specifier) is a "/" character, AnalytiCalc will omit the column and row labels in the output file or printout so that you need not edit them out afterwards. They will always be displayed on the screen however. .P To output to the lineprinter on PDP11, the file specifiers to give are either "LP:" or "LP:/", then. The device name normally should be given on PDP11. On other systems (e.g., VAX), the device will default to disk unless otherwise specified. The output file in any case has no strange escape sequences and may be edited with any normal system editor. On VAX, use LPA0: for printer or NLA0: for junking anyxoutput you really don't want. If the character "_%" appears in the file specifier, the title will not be displayed on printout. This is designed to help those producing paste-together printouts from several sheet areas. .p The width and length of the file output may be considerably larger than a VTxxx screen. In fact, print widths are supported on VAX to 512 characters (normally up to 63 columns) and pages may be up to 75 rows long. Just set the size with the DB command to set numbers of columns and rows, and use DW commands to set the widths desired of displayed columns. While only 80 or 132 characters width and 20 rows length fit on a VTxxx screen, the size you set will be used for the printable file. It's up to you to figure out how to display a wide file if your lineprinter only has 132 columns of course. Other display page editing commands like OR or OA will work up to the bounds set by DB even if these exceed a physical screen's capacity. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 EXIT ^? .LITERAL EXIT X Exit to operating system. .END LITERAL \? .P The X command exits from AnalytiCalc to the operating system. In general, this is the ONLY way (short of an abort command to the .index X Command .index Exit operating system) to get out of AnalytiCalc, and is the ONLY WAY TO LEAVE GRACEFULLY. You should use the PP or PD command to save your sheet prior to X if you want to save your sheet; otherwise it will be lost. Be at least that cautious; the program will NOT keep track of whether you've saved the sheet or not (this may be the umpteenth time you've run it since creating that scratch file). .P .index SAVE The files created by PP/PD commands save the sheet, but only entries that were in use. The XD and X commands are identical in the VM and PC versions of AnalytiCalc since there is never a workfile created that can be saved or deleted. The scratch files for formulas and variables in AnalytiCalc-PC are created as temporaries and automatically deleted on exit. The XD command exists in older versions of AnalytiCalc and deletes the random access workfile they use for formulas, which is saved by the S (Save) command in those old versions. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 ZERO ^? .LITERAL ZERO VARIABLES ZA Zero whole sheet ZE V1:V2 Zero variables in a row or column in range from cell V1 to cell V2 (V1,V2 = names of cells) .END LITERAL \? .P The ZEro commands clear out a sheet. The ZA command will also ask if you mean it and needs a reply of Yes to actually clobber the whole .index ZAP Sheet Command .index ZEro Command sheet and return it to pristine purity. .P The ZA command occasionally takes a noticeable time to clear the workfile out; do not be alarmed at this. It will ask afterwards for a new title, new display format default for floating point, etc. .P If you give the ZA command, AnalytiCalc will ask you to confirm that you indeed want to zero the entire sheet. A reply of Y will proceed to execute the command; any other reply will abort the clearing operation. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 COMMAND__FILE__EXECUTION ^? .LITERAL EXECUTING COMMAND FILES @filespec Read filespec and execute commands as though typed in. .END LITERAL \? .index Command Files The @ command lets you treat a file as though it were your console input (returns on endfile) to let you execute saved sets of commands to set up your sheets. Note that if you issue the K command (below), those inputs come from a separate file on logical unit 1. As a special VAX feature, PortaCalc-VM will accept a reply beginning with @ in the title question of the first page of the sheet as indicating a command and begin using that command directly until it reaches EOF. This is done to permit auto-startup commands for particular users to be defined. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 JOURNALING ^? .LITERAL JOURNALING +J filename Opens filename as a journal file, recording commands to that file. (Note: auxiliary inputs are not so recorded, where asked for as separate questions.) +N Closes any open journal file .END LITERAL \? .P The journaling commands allow typed commands to be saved .index Command Files .index Journaling .index Keystroke Capture into a file later usable as an indirect command input to AnalytiCalc to allow recreation of screen formats, data, formulas, etc. Extra questions (e.g. those used for filename and areas to save or restore in P or G class commands) are NOT saved by the journal. They will be read by @ commands however and may be edited into a journal file with any editor. If this is desired inside a AnalytiCalc session, the Spawn command (below) is recommended after the +N command is used to close the file. The VM and RM commands are recommended inside @ files (with R and V commands at the ends) to suspend display updating and recalculation until all commands in the journal file are done. The Journal command is the way to get AnalytiCalc to remember your keystrokes when making up any command so that you can tell what you're doing. Later if you don't need to watch the screen update, use the VM command (View Manual) to turn display update off during the command files' operation, and the V (View) command to turn it back on at the end. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 SPAWN ^? .LITERAL $ command-line Spawn command line to the OS (minus the $ sign). May need extra CR to free console. } command-line Spawn command line (minus the }) and await a return on console before return to sheet. .END LITERAL \? .P The $ command permits the VAX/VMS version of AnalytiCalc to spawn DCL commands to VMS. The command is whatever follows the $ .index Subprocess Execution .index Temp. Escape to Monitor and results in that command being spawned to VMS. (Users may find an extra CR (Return key) is needed to allow terminal output). The command is executed in a VMS subprocess, and upon completion, the screen is redrawn. This permits use of other VMS utilities during a session with AnalytiCalc. This also is implemented for AnalytiCalc-PC for the PDP11 using the RSX Spawn command. The variant using the } character rather than the $ character will print the message ENTER RETURN TO REDRAW SPREADSHEET> at the bottom of the screen and will not repaint the screen until the return key is pressed. This allows you to examine the screen as long as needed before erasing and redrawing the sheet. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 FORMULA_SEARCH ^? .LITERAL SEARCH for formula substring >STRING Find cell whose formula contains STRING >>STRING Find cell whose formula starts with STRING .END LITERAL \? .P The > command (greater than sign) causes a search to be made from the current position down and right to the relocate boundary for a formula containing the string after the >. The cell found (the first one) will become the current cell. The origin is not moved, but the command OA P_#_# will cause the cell found to become the upper left cell on the .INDEX FORMULA SEARCH screen if desired. This is a handy tool for locating sections of a large sheet. The comparison is between the entered string and the formula, but terminates with the shorter. Therefore, aliasing occasionally occurs. Just skip past the offending cell and redo to continue to search. The >>STRING form anchors the search at the start of the string so this will not occur, though very short formulas whose beginnings match the search string will match. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 LOOPING__COMMAND__FILES ^? .LITERAL LOOPING COMMAND FILES < Rewind the current AnalytiCalc input file .END LITERAL \? .P This command will allow a command file to restart .index Looping itself from the beginning. It does so only if the % variable is positive (permitting some control over it). .P In the PortaCalc-PC version for VAX, an < found in a cell equation causes the cell equation to be re-evaluated from the start of the formula, PROVIDED that the "_<" is seen at the start of one of the cell's equations, AND that the % accumulator is greater than 0.0 at that time. This is provided to allow use in conjunction with *WF, *P, and *U XQTCM so that multi-equation formulas can loop, doing jobs like selecting rows from regions, entering sequences of numbers, and the like. This provides a compact and fast looping structure that does not depend on rewinding files externally. The looping is limited to at most 100 passes to prevent infinite loops. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 COMMENTS ^? .LITERAL COMMENTS * any text .END LITERAL \? .P Any line beginning with * is treated by AnalytiCalc as .index Comments a comment (except when in the *F mode when it is sought). This allows you to comment your indirect AnalytiCalc command files. It should be mentioned again that in the "Enter-Mostly" mode of operation, inputs beginning with the * character are treated as comments. Where it is desired to enter an equation that begins with * (as in function-commands like *U DBTRMFRM ...), use the command string "/EV#formula" to ensure the input is interpreted as an equation. In "Command-Mostly" mode this is not a problem. .SKIP 2 .TEST PAGE 20 .INDENT -1 3 PROMPTING__FOR__DATA .LITERAL READING ARGUMENTS OFF CONSOLE - Prompt .END LITERAL .P The "-" command will print the prompt text on the screen and await entry of a line of text. This text is stored as up to 4 arguments for possible later use in EDit commands. Spaces separate input arguments, and no argument may be longer than .index Console Arguments .index Command Files 51 characters. This facility is intended for use with indirect command files (@ files) which may want to be able to prompt for parts of formulas and then edit them into the command formulas for use, or to prompt for parts of later-used Calc commands. Note that Calc never sees any formulas that are given the A format, so they can be prepared in this way, to be used when they are given a numeric format. .INDENT 5 A suitable - command might be .SKIP 1 -Enter net pay> .INDENT 5 which would produce the printout (in row 23 of the screen) .BREAK Enter net pay> .INDENT 5 and to which one might reply with a number to be entered onto a "template" worksheet. .P NOTE: This is a somewhat obsolete construct; in general the _%_%_% construct is easier to use. It is recommended to use it instead since no subsequent EDit commands need be used to get the values into formulas again. .SKIP 3 .INDENT -1 2 APPLICATION NOTES .P NOTES: .P .index Notes .P In entering numbers, use a decimal (.) to get them to go in correctly. The parser doesn't seem to understand they are .index Number Format numeric otherwise (even integers). .P Note that the default format for numeric output is F9.2 and that it may be changed if desired. If you set up the format of a cell, that marks the cell valid and the format is not altered by input defaults, nor the numeric/text interpretation of the cell. To put in a lot of labels, then, set up format A using DF and then enter the labels. .P If the sheet's calculations contain forward references (down or right), you may need to give the R (Recalculate) command .index Recalculation .index Calculation Order a few times to get proper values. If the values on the sheet do not stabilize, you probably have a circular reference in your formulas and should examine the cells that do not stabilize for the circularity. .P If you enter numbers with exponentials, use +/- in front of the E so that AnalytiCalc can tell that the "E4" type strings .index Number Format in numbers like "1.3E4" are really exponents, not cell names. That is, .INDENT 5 Don't enter .INDENT 8 1.35E4 .INDENT 5 Enter .INDENT 8 1.35E+4 .BREAK to avoid confusion when cells are relocated. You may use lowercase E also (1.35e4) to avoid confusion in some versions. Because the cell relocation logic is somewhat stupid, filenames that look like cell names should be avoided too. That is, a sheet that contains a formula like .BREAK @D5.FRM .BREAK might, upon getting moved from D5 to F3, be changed to .BREAK @F3.FRM .BREAK and if this is not what is desired, it could cause confusion. .INDENT -1 .P When using relative cell names (the P_#col_#row forms) in formulas, you will often need to enclose them in parentheses to ensure correct evaluation. Thus, use a formula like .Break (P_#4_#2)+3.4 .skip 1 rather than simply "P_#4_#2+3.4". .p Inside multi argument functions an extra space should be used sometimes ahead of a range using P_#_# or D_#_# forms. Thus, .Index Special Considerations with P_# and D_# forms .Index Caveats on Relative Addressing "SUM[P_#3_#0:P_#7_#0]" will sometimes fail to evaluate correctly, but "SUM[#P_#3_#0:P_#7_#0]" will work as expected. These considerations apply to all naming types beginning in P_# or D_# as well. They arise from details of the parsing of these name forms. .P AnalytiCalc normally will keep track of the lowest and furthest right cells in use and only ever try to recompute cells that have active values there. This may occasionally be invalid where command files modify cell values and formulas in ways that are not caught (if there are any such; none have been encountered but they may exist). If problems are suspected, the command RS (for ReSet) will cause recalculation to go to the limits of the sheet. There is no command to bring back the old default since RS sets the maximum cell to be the last row and last column; save and rerun if this is a problem. Do not use this command in normal operation. .skip 1 2 INT__CALC .C THE CALC OPTION (K) and Functions Available: .P This describes the CALC option (K) of AnalytiCalc which is also the mathematical engine used for expression evaluation except for .index Interactive Calculator multi-argument functions and IF statements. .INDENT -1 3 OVERVIEW .P CALC is a calculator designed to evaluate arithmetic expressions. In its basic form, expression evaluation is similar to that used by ANSI FORTRAN with calculations performed on INTEGER*4 and REAL*8 constants. Variables may also be invoked but are limited to single alphabetic characters. It is assumed that the reader is familiar with FORTRAN data types, constants, expression syntax, operator precedence, and the syntax for assigning values to variables. Additional features include octal, hexadecimal, and multiple precision arithmetic capabilities. Commonly used commands and expressions can be placed in a file and executed when convenient. .skip 1 .INDENT -1 3 ENTERING .P To enter Calc, use the K command of AnalytiCalc. Calc will then prompt as follows: .SKIP 1 .INDENT 7 CALC> .SKIP 1 Try typing .SKIP 1 .INDENT 7 123+456 .SKIP 1 followed by a carriage return. CALC will evaluate the expression and output the answer .INDENT 7 579 .SKIP 1 It then prompts for further input. Try other expressions such as .LITERAL 12.0 - 99. (answer=-87.00000000000000) -(-32767+(6-2)**8-(512/(409-401))) (answer=-32705) 3*5/7 (answer=2) 3*(5/7) (answer=0) .END LITERAL .P Mixed mode is legal, for example .SKIP 1 .INDENT 7 1977/50. is evaluated as 39.54000000000000 .SKIP 2 Reals may be expressed using D or E format. For example .SKIP 1 .INDENT 7 1.2E10*2.D0**3-1.D-8 is evaluated as .SKIP 1 .INDENT 7 0.95999999999999992D+11 .INDENT -1 3 ACCUMULATORS .P Variables may also be used to retain values for later use. Variables may be the letters A through Z, or any AnalytiCalc physical sheet cell name. As in FORTRAN, variable A through H and O thru Z default to type real, I thru N to type integer. To set I to a value use the usual FORTRAN syntax, for example: .SKIP 1 .INDENT 7 I=2**10-1 .SKIP 1 Try typing the single character 'I'. CALC will respond with its value. We can now use I in various expressions such as .SKIP 1 .INDENT 7 J=I-I/3*3 .P % is a special variable that retains the value of the last expression evaluated. For example, to successively add up the numbers 1, 2, 3, 4, 5, .index Special Accumulators and 6 we could enter .LITERAL 1 %+2 %+3 %+4 %+5 %+6 .END LITERAL .P Note that you can examine the value of the variables by typing the appropriate single character followed by a carriage return. Such an examination does not change the value of %. .skip 1 .INDENT -1 3 EXITING .P To exit from CALC, type .SKIP 1 .INDENT 7 *E (or *EXIT) .INDENT 4 or *S (or *STOP) .SKIP 1 This will return you to AnalytiCalc. (To exit AnalytiCalc, use the X command.) .INDENT -1 3 FUNCTIONS .C -SPECIAL FUNCTIONS- .P CALC recognizes a variety of special functions. For example, to calculate the square root of 2, we can type .SKIP 1 .INDENT 7 SQRT(2.) .SKIP 1 CALC responds with the value 1.41421356237310 .P Each function may have an expression for its argument. For example, .P A=2.0*SQRT(ALOG(9.)+3.) .SKIP 1 sets A to 4.55948443459838 .P The following special functions are available: .SKIP 1 .index Functions ^? .LITERAL FUNCT NAME ARG TYPE FUNCT VALUE DESCRIPTION ------------------------------------------------------- ABS REAL REAL absolute value DABS REAL REAL absolute value IABS INTEGER INTEGER absolute value IFIX REAL INTEGER REAL to INT conv. AINT REAL REAL REAL truncation INT REAL INTEGER REAL to INT conv. IDINT REAL INTEGER REAL to INT conv. EXP REAL REAL e**X DEXP REAL REAL e**X ALOG REAL REAL natural logarithm DLOG REAL REAL natural logarithm ALOG10 REAL REAL logarithm base 10 DLOG10 REAL REAL logarithm base 10 SQRT REAL REAL square root DSQRT REAL REAL square root SIN REAL REAL trigonometric sine DSIN REAL REAL trigonometric sine COS REAL REAL trig. cosine DCOS REAL REAL trig. cosine TANH REAL REAL hyperbolic tangent DTANH REAL REAL hyperbolic tangent ATAN REAL REAL arc tangent DATAN REAL REAL arc tangent .END LITERAL \? .skip 1 .INDENT -1 3 OCTAL__OR__HEX .C -WORKING IN OCTAL AND HEXADECIMAL- .P You may change the base used to specify constants by using the .index Octal .index Hexadecimal *B command. Legal forms are .SKIP 1 .LITERAL command action ------- ------ *B displays current default base *B 8 changes default base to octal *B 10 changes default base to 10 *B 16 changes default base to 16 .END LITERAL .P Suppose we have changed the default base to octal. Then adding .SKIP 1 .INDENT 7 7 + 1 .SKIP 1 we obtain the result .SKIP 1 .INDENT 7 00000000010 (BASE 8) .SKIP 1 If the default base is hexadecimal, we can enter .SKIP 1 .INDENT 7 9 + 1 .SKIP 1 which is evaluated as .SKIP 1 .INDENT 7 0000000A (BASE 16) .SKIP 1 Suppose we have assigned .INDENT 7 A=1 .BREAK then .INDENT 7 1+A .BREAK gives .INDENT 7 2.000000000000000 .SKIP 1 even when the default base is 16. If we wish to add the hexadecimal digit 'A' to 1, enter .SKIP 1 .INDENT 7 1+0A .SKIP 1 We now obtain the desired .SKIP 1 .INDENT 7 0000000B (BASE 16) .P This leading 0 is only necessary when the first hexadecimal digit is greater than 9. .P If constants are entered with digits that are not legal for the base being used, the entire number is converted using a more appropriate base. For example, if we have set the default base to octal and type .INDENT 7 1+9 .P the 9 is not an octal number so it is converted to base 10. If a base 16 number is involved, the result will be in base 16. .P You may temporarily change the base for a single integer constant by preceeding it with .SKIP 1 .INDENT 7 _^8 for octal .INDENT 7 _^10 for base 10 .INDENT 7 _^16 for base 16 .SKIP 1 For example, if the default base is 10, .INDENT 7 100+_^840 .BREAK gives .INDENT 7 132 .SKIP 1 a base 10 integer. .SKIP 1 .INDENT 7 I=100+_^1610 .SKIP 1 gives .INDENT 7 116 .SKIP 1 also a base 10 integer. .P Note that the '_^' can only be used to specify the base of constants and that expressions such as _^16I are illegal. .P To declare variables to be integers of a specific base, we can use the commands .LITERAL *INTEGER (base 10) *OCTAL (base 8) *HEX (base 16) .END LITERAL .index Octal .index Hexadecimal for example, .LITERAL *INTEGER A declares variable A to be a base 10 integer. *HEX B,Z,F declares variables B, Z, and F to be base 16 integers. *DECIMAL lists all the variables that have been declared to be of type DECIMAL. .END LITERAL .SKIP 1 .P To summarize, there are three distinct ways of making base declarations when using CALC. The first is to use the *B command to designate the base default value. This is used to determine the base for constants when they occur in expressions. It does not in any way influence the type of any variables found in an expression. The only way to change the type of a variable is with a specific CALC command such as .INDENT 7 *INTEGER A,B .P Note that the *INTEGER command can be used to set types for AnalytiCalc cells. However, exercise care in doing so that your display formats match the new type. .BREAK Suppose for example that the default base is 10 and we enter .INDENT 7 *OCTAL A .INDENT 7 A=100 .SKIP 1 then CALC responds with .INDENT 7 00000000144 (BASE 8) .P Finally, the last way to change a base is to use the explicit base specifiers for a constant, for example .SKIP 1 .INDENT 5 _^10 123 .INDENT 5 _^8 777 .INDENT 5 _^16 AB .INDENT -1 3 MULTI__PREC .C -MULTIPLE PRECISION- .P Normally integer arithmetic (base 8, 10, and 16) is done internally with INTEGER*4 variables. To allow for larger numbers, CALC has multiple precision .index Multiple Precision capabilities that allow numbers up to 99 digits (20 in AnalytiCalc-PC) to be manipulated. Constants are converted to a multiple precision data type when the number of digits specified exceeds a certain value. This value depends upon the specified base. Leading zeroes are included in this count and can be used to force constants to be of type multiple precision. .SKIP 1 .LITERAL base max. number of digits before conversion ---- --------------------------------------- 8 10 10 9 16 7 .END LITERAL .P Suppose we type (with the default base of 10) the number .INDENT 7 1234567890 .BREAK then CALC echoes with .INDENT 7 1,234,567,890 .INDENT 7 (BASE 10) .SKIP 1 The commas indicate that % now has type multiple precision base 10. Similarly, typing .INDENT 7 1234ABCD .SKIP 1 results in .SKIP 1 .INDENT 7 1234,ABCD .INDENT 7 (BASE 16) .SKIP 1 Notice that base 16 multiple precision numbers are separated by commas every 4 digits, octal and base 10 numbers every 3 digits. .P You may perform the usual operations of addition, subtraction, multipli- cation, division, and exponentiation. As of version 1.0, exponentiation of a multiple precision number may only be to a non-negative integral power. To declare variables of type multiple precision, use .LITERAL *M8 (multiple precision base 8) *M10 (multiple precision base 10) *M16 (multiple precision base 16) .END LITERAL .SKIP 1 for example, .INDENT 7 *M8 A,B ####declares A and B to be multiple precision .BREAK ##############octal variables. .SKIP 1 Then typing .INDENT 7 A=32768 .SKIP 1 results in CALC responding with .SKIP 1 .INDENT 7 100,000 .INDENT 7 (BASE 8) .P The accumulators in Calc (variables A-Z and %) all may take on or use multiple precision values. However, the spreadsheet cells may not; they must fit in 8 bytes (double precision real) or 4 bytes if integer. Accumulators may however be used globally in a sheet for large numbers. Note however that certain accumulators have special purposes. Accumulator Z is used in some substitution commands. Accumulators X and Y get current cell locations at each command (column, row+1). Accumulators T, U, and V are used to return year, month, and day in the *U IDATE function. Also the % accumulator is the value cell for all operations and should not be treated globally. Other accumulators may have meanings for user modifications of the program as well, though by convention the early ones should be left alone. .skip 1 .INDENT -1 3 CALC__COMMANDS .C -ADDITIONAL COMMANDS- .P All commands to CALC (as distinguished from expressions to be evaluated) .index Other Functions begin with an asterisk. To obtain a list of all possible commands, type a question mark followed by a carriage return. Most of the commands have already been described. The following section gives an explanation of the remaining commands. (Some additional ones are described in the AnalytiCalc manual.) .TEST PAGE 20 .SKIP 1 .LITERAL COMMAND DESCRIPTION ------- ----------- .END LITERAL .FILL .LEFT MARGIN 15 .INDENT -13 *@filename ####Where filename is the name of a file of CALC commands. CALC reads the file and executes the commands. Up to 5 nested calls can be made. Recursive calls are not allowed. CALC prompts with CALC before each command line is executed, where n is the calling level. You may optionally follow the file name with a blank followed by a single variable name (a single alphabetic character or %). CALC will then execute the file until the value of that variable is zero or negative. The test of this variable is made before the file is executed and not during execution of commands within the file. If the variable's value is not positive when the command is initially encountered, the file will not be opened for execution. See the section on command file examples for ways to use this option. .INDENT -13 *ASCII ####Declares a list of variables to be of type ASCII. Useful when decoding ASCII characters. For example, if we set A to be of type ASCII, then typing A=77 results in the character 'M' being output. The inverse operation is the single quote. It allows us to specify a single ASCII constant. For example, if we type .BREAK 'M .BREAK then the character 'M' is echoed and indicates that % holds that character and has data type ASCII. Suppose that the variable I has data type INTEGER. Then we can output the base 10 code for the ASCII character 'M' by entering .BREAK I='M .BREAK which results in 77 being output. Notice that you may not be able to enter certain control characters that are intercepted by your operating system. Characters whose value is less than 32. are output by printing the character '_^' followed by the equivalent ASCII character of that number plus 32. For example, .BREAK A=10 .BREAK results in .BREAK _^* .BREAK being output since 42 is the ASCII code for the character '*'. See Appendix A for a table of the characters output by CALC to represent such non-printable characters. .INDENT -13 *C ####COMMENT line. The characters that follow are ignored by CALC. This is useful when documenting files containing CALC commands. .INDENT -13 *N ####NOVIEW. Prevents CALC from outputting the value of the expressions evaluated. This is especially useful when executing files containing CALC commands that initialize .index Functions .index Other Functions variables to special values. Equivalent to *V 1 .INDENT -13 *V ####VIEW. Controls CALC's printing options: .SKIP 1 .LITERAL command output class -------- -------------- *V 0 error messages *V 1 error messages command lines read from files *V 2 error messages value of expressions evaluated *V 3 error messages command lines read from a file value of expressions evaluated *V same as *V 3 .END LITERAL .index View Control .SKIP 1 The default setting is *V 3. Notice that other legal forms are *VIEW 1 and *V2. You may want to include a command *V 0 somewhere before using any command files to avoid diagnostic printouts if you use indirect cell files much. .INDENT -13 *R ####READ. Allows a single line to be read from the terminal. Useful in files of CALC commands to allow additional commands to be entered (like *S to exit from that file) or simply as a way to halt terminal output until the carriage return key is pressed. .INDENT -13 *REAL ####declares specified variables to be REAL*8. When the value of such variables are output, FORTRAN's D format is used. .INDENT -13 *DECIMAL ####Declares specified variables to be REAL*8. When the value of such variables are output, FORTRAN's F format is used. Variables A-H and O-Z default to type DECIMAL. .INDENT -13 *S ####STOP. Same as *E .INDENT -13 *E ####EXIT. Terminates CALC session unless it is used within a file of CALC commands. In this case, CALC closes the file and continues with the next command. .INDENT -13 *Z ####ZERO. Zeroes all variables except %. Data types are not changed. .INDENT -13 *G ######*G V1,V2 (where V1 and V2 are cell or accumulator names) .index Indirect Addressing will evaluate V1 and V2 as the column and row numbers, on the physical sheet, of the desired cell. The addressed cell's value is retrieved and used as the resulting number. This is used for lookup tables. .INDENT -13 *W ###### Takes the value at the current cell and writes it out to the formula as a numeric (floating) .index Freeze value. The current cell may have been modified temporarily by the *P command. This will overwrite the formula at that cell. The *WF command stores the cell similarly, but uses the format of the current cell instead of the D32.25 format used for *W. This makes it possible to make the cell contents match the display exactly. Extra spaces introduced may be removed via the ED#/#// command. It is a good idea to use a command like "E#_%=P_#_#\*WF" rather than just E#*WF to ensure the % accumulator REALLY is the current cell. .INDENT -13 *P ######The *P command resets the current cell coordinate .index Temporary Move from within a cell (until the next cell is evaluated only). It has several forms: .INDENT -2 *P - By itself, *P causes Calc to prompt for the new physical column and row number. .INDENT -2 *P V1 - This moves the current location to the named cell where V1 is the cell name (e.g. A5, H2) .INDENT -2 *P@ V1,V2 - This uses V1 and V2 (cell names) as column and row numbers and changes the current physical cell position to that defined by the contents of cells V1 and V2. This gives complete addressing of the sheet from within any cell. .INDENT -13 *F #######*F Label - If the value in % is positive and nonzero this command rewinds the input file for the .index Command Files .index Looping .index Conditional Motion AnalytiCalc @ command (not the Calc @ command) and seeks a line beginning with the characters *CLabel (where "label" is what you put after the *F command). This allows Calc commands inside a cell to direct outside command entry. .INDENT -13 *J #######*J Label - This command behaves as the *F command but .index Command Files .index Looping .index Conditional Motion operates on the file used by the Calc @ command rather than the AnalytiCalc one. Thus, conditions in Calc program files may be implemented. .INDENT -13 *QF .INDENT -13 *QW #######The *QF (Float) or *QW (write) commands are used to .index Command Files .index Data Base Access examine sequential files created outside AnalytiCalc and return values or formulas. Their syntax is .INDENT -4 *QF filename _?key1_? _?key2_? .INDENT -7 or *QW filename _?key1_? _?key2_? .BREAK where _?key2_? is optional .BREAK l and m are delimiter characters for start and end of the parts of the selected records to extract (defaults to first part of the record) filename is just the file specifier in the host OS. operation is that the file is searched from the beginning for records containing key1 (and key2 if specified) and then the part of the record between character l and character m (delimiter characters, which may be the same as for example 2 commas) is extracted. That part of the record is then either Floated by converting to a floating point number using a wide Floating Point format specifier (in *QF) or read in and made the current cell's formula between those delimiters (in the case of *QW). Records may not be over 128 characters long. This command would be used to extract data from a database or word processing files. .P The first key will begin at the start of the line for each file if it's first character is the _` (accent grave) character. Then the key searched for is sought always at the start of the line, minus the _` character. .P The delimiters may contain 3 characters to specify positional fields. In this case, the first delimiter character is _` (again) and the second 2 are encoded start location and length fields. They are just the binary values of these + 32 (starting from 1) to turn them to printable ASCII. .P Variant forms are *QFK, *QWK (which keep the file open after opening it so that subsequent *QFN or *QWN or *QFC or *QWC commands can read sequentially down the file), or the mentioned *QFN and *QWN commands, which read the file from the Next record (leaving it open for more Next searches) and the *QFC or *QWC variants which perform the *QFN type action but close the file on completion. The file spec must be present in *QFN, *QWN, *QFC, and *QWC commands, but is ignored there. If the search fails, the % accumulator is returned as -999999. and on *QW type operations where there is no failure, the % accumulator returns a value of 1.0 to indicate success. In the *QF commands, the value returned is in the file searched. These return values occur regardless of the variant. Note that the same logical unit (4) is used for all *Q class operations, so a subsequent *QF or *QW will close the unit after a string of *QN searches of indeterminate length. A request that searches the null device is a simple way to ensure the unit is closed. It is possible to leave it open and interfere with some other operations, so the user is cautioned to pay attention to this aspect of program operation when designing a sheet that uses it. .INDENT -13 *U funct args #####The *U command is a means to allow easy user addition to the AnalytiCalc function repertoire. It .index Other Functions .index Matrix Algebra passes the command line to the USRFCT subroutine which is set up to recognize up to 5-letter function names (edit it to add what you need) and to process the functions called. The parsing is up to you. Note that the VARSCN routine may be called to convert variable names into coordinates in the XVBLS array. .P Functions supplied include: .INDENT -5 DATE functions operating on dates: IDATE, YRMOD, JDATE, JTOCH, and DATE which all return or convert between Julian dates (day since a fixed date) and year/month/day binary, and ASCII dates. The auxiliary functions WKDYS and WKDIN also give weekdays (Monday through Friday) between two Julian dates, or the end Julian date given a start date and a number of weekdays. .INDENT -5 MATRIX functions which handle matrix math: MTXEQ, MOVEV, MDET, MPROD, MADDV, MSUBV, MMPYT, and MMPYC. These handle all variants of normal matrix algebra. MMPYT is particularly handy for producing the dot product of 2 rows or columns (sum of products of corresponding elements). Note that matrices must reside in the prime area in the AnalytiCalc-PC version of PortaCalc/AnalytiCalc. That limits them to columns A through CA and rows 1 to 400 on VAX if built the default way. (Not all matrix routines are so limited, but MTXEQ is.) .INDENT -5 EQUATION SOLUTION via the VARY function, which allows up to 8 accumulators to vary to iteratively search for solutions to equations anywhere on the sheet. .INDENT -5 UTILITY functions, including STRVL, which converts formula text to numeric values, XQTCM which executes commands from inside formulas, and HERE which returns current location and some extra sheet status information. Also, the FFTFW and FFTRV functions perform forward and reverse FFT (Fast Fourier Transforms) on data, and the LINEF function fits a straight line to a given data range, returning slope, intercept, and fit error. .SKIP 2 DETAILS: .P A version of USRFCT is supplied which can call the system to return the system month, day, and year in accumulators T, U, and V respectively. The % returns with a value of yymmdd to permit easier sorting too. However, any functions desired may be added in this way and the results extracted in whatever way is convenient. The yymmdd value returned is a Julian date based on 1/1/1980, in the % accumulator. This is the IDATE() function. .P There are 4 other date functions supported in AnalytiCalc. These permit conversion between ASCII dates displayed as YY/MM/DD and Julian dates, or back. .P The call .SKIP 1 *U YRMOD VY,VM,VD .SKIP 1 returns the Julian date (in %) computed from the Year (in VY), the month (in VM) and the day (in VD), where VY, VM, and VD are sheet cells. These may be the result of date arithmetic. .P The call .SKIP 1 *U JDATE Var .SKIP 1 assumes the formula in cell Var (any spreadsheet cell name) contains a date string in the format YY/MM/DD. It reads this formula and converts the date to a Julian date, returning it in the % accumulator. .P The call .SKIP 1 *U JTOCH Jul,Var .SKIP 1 assumes that variable Jul (any spreadsheet cell) contains a Julian date and changes it into an ASCII string in the cell whose name is in the Var position here. This wipes out any previous formula in that cell, though it does not alter display format or type information. The T, U, and V accumulators return with the month, day, and year on return. .P The call .SKIP 1 *U DATE VY,VM,VD,Var .SKIP 1 uses VY, VM, and VD as year, month and day, and computes a Julian date from them. It then composes an ASCII string of form YY/MM/DD for that date and stores in the formula for Var. .P The use of Julian dates is made because the difference of two Julian dates is precisely the number of days between the two dates. These functions are designed to make date labels easier to do. .P The call .SKIP 1 *U WKDYS D1,D2 .SKIP 1 computes the number of workdays between Julian dates D1 and D2 just as taking the difference of two Julian dates gives differences between calendar dates in days. .P The call .SKIP 1 *U WKDIN D1,N1 .SKIP 1 returns a Julian date that is N1 work days after the date in D1, which must be a start Julian date. The WKDIN function is in a sense a partial "inverse" of WKDYS since it allows one to go from workday intervals back to Julian (i.e., calendar) dates. Only the VAX version of AnalytiCalc-PC supports WKDYS and WKDIN functions at this point for reasons of space. .P There are actually 4 supplied USRFCT routines. The larger of these are also able to solve matrix equations (this demonstrates how other programs may be integrated with the package). The function solves the matrix equation AX=B where A is a square matrix and X and B are rectangular ones, A being n by n and X, B being n by m. .P The call formats for IDATE and MTXEQU are .SKIP 1 *U IDATE() .SKIP 1 *U MTXEQ(AA:AA,XX:XX,BB:BB) .SKIP 1 where the notation AA:AA means two cells at the upper left and lower right edges of matrix A (e.g. B2:C3 for the 2 X 2 matrix so defined), and the XX:XX and BB:BB notation means the same for the X and B matrices. This capability is used to solve systems of linear simultaneous equations and does so with extreme speed. Note however that errors can occur if the A matrix is singular. The cell returns 0 if the matrix was singular and does not solve the equation then; 1 is returned if the equation was solved. .P Note that matrix A is modified by the call, so a reasonable precaution is to ensure that the matrix is reset by AnalytiCalc prior to each computation. This may be done by: .INDENT -4 1. Placing the MTXEQ call in a cell left and down from the A matrix and .INDENT -4 2. Ensuring there are some alphas in each entry in matrix A. This may be done by placing a \*C#FRC#RECALC into each cell. This is a comment and will not affect the number. However because it contains alphas, AnalytiCalc will then re-compute each number whenever the sheet is computed. .P or .P Using the MOVEV function to copy the real A matrix onto the working one before the MTXEQU call every time. (This is the efficient way to do it, as recalculating the constants every time wastes resources.) .P To have the X matrix cells displayed without being modified, it is necessary to have the cells' formulas contain a self-reference. The easiest way to achieve this is to place the "formula" P#0#0 into each cell. This effectively will cause display of whatever number is there. A similar technique may be used to set up matrix A, where the real matrix is elsewhere and formulas in A are just the P#0#0 type. The real matrix may contain formulas like "34.65\D12=%" to set up the desired contents here AND to reset cell D12 (in the work area) to the entered value. The B matrix is not modified by the MTXEQ routine. A simpler way to handle the problem is to use the MOVEV function (below) to copy the desired cells to a scratch A matrix from wherever it was, so the scratch matrix may be destroyed without impact on display. If this is done, the source of the A matrix need not be specially bollixed up. .SKIP 1 *U MOVEV mtxa,mtxb .SKIP 1 where mtxa and mtxb are matrix specifiers. This command moves values from mtxa to mtxb (useful prior to calling MTXEQ). .SKIP 1 *U MDET mtx .SKIP 1 This function computes and returns the determinant of matrix mtx (specified as v1:v2 where v1 and v2 are upper left and lower right corners of the matrix). .SKIP 1 .index Matrix Algebra .SKIP 1 *U MPROD A,B,C .SKIP 1 This function will multiply matrix A by matrix B giving matrix C, provided that their dimensions are compatible. .SKIP 1 *U MADDV A,B,C .SKIP 1 This function adds matrix A to matrix B and stores in matrix C. All matrices must have the same dimensions. It can be used for adding values in any pairs of rectangular regions much faster than a series of sum functions would permit. .SKIP 1 *U MSUBV A,B,C .SKIP 1 This function subtracts matrix B from matrix A leaving the result in matrix C; as above, matrix dimensions must be the same. It also is far faster in subtracting rectangular regions than numerous separate equations would be. .SKIP 1 *U MMPYT A,B,C .SKIP 1 This function multiplies matrix A-transpose by matrix B and stores the result in matrix C; dimensions must be compatible. Also, as in MPROD, matrix C must not be the same as either A or B. In ordinary use, this can be handy for dot products. That is, suppose you have two column parts, G10:G50 and R20:R60 and you want to form the sum (G10*R20 + G11*R21 + G12*R22 + ... + G50*R60) for later use. In many systems, you need to make another column of the G10*R20, etc. terms and add it up. Here, you can use the MMPYT function as .break *U#MMPYT#G10:G50,R20:R60,G51:G51 .break to form the sum and store it in cell G51. (It can be stored anywhere; G51 is chosen just for illustration.) If you have a row and a column to multiply, you use the MPROD function instead of MMPYT for this. Since this is a built in function, it can be orders of magnitude faster than the separate - column approach. .SKIP 1 *U MMPYC A,B,K .SKIP 1 This function multiplies every element of matrix A by constant K (a cell or accumulator) and stores the result in matrix B. This function is FAR faster than separately multiplying many cells. If you want to scale a rectangular region of the sheet by some constant, this function can be used to quickly do so, multiplying each cell in the region by the constant in cell or accumulator K (K can be ANY cell or accumulator). Wherever you need to adjust data by some fraction, this function should be used as the fastest way of doing it. .SKIP 2 *U VARY X,A,W,I,P;Q;R;S;T;U;V;W .SKIP 1 (Equation Solving by Iterative Search) .SKIP 1 This function allows AnalytiCalc to automatically search for solutions to equations over up to 8 dimensions. The operation .index Equation Solving .index Goal Seeking .index Solving For Variables is that the accumulators named in the fields shown as P;Q;R;S;T;U;V;W (one to 8 may be specified, only one is required) are varied by a fraction W about their initial values (later scaled down by the gradient of the .index VARY change in X) to attempt to get accumulator or cell X to equal accumulator or cell A. This is done for I iterations, where I is another accumulator. Care should be taken that I is not initialized in every pass of the spreadsheet, but at most 20 iterations will be done in any one pass as a safeguard in any case. The accumulators given must be independent variables; set dependent ones or normalization conditions elsewhere on the sheet for use with calculations. Any function or set of functions can be entered and the program will step the accumulators to attempt to find a (local) minimum of the value of (X-A) where X and A may be either accumulators or cells. The other arguments must be accumulators (i.e., named A through Z, though prior automatic use of X, Y, and Z may conflict if these are used). This function will allow iterative solutions to be found for situations not soluble directly, with stops for inspection every several iterations. The TE command may be used conveniently to set the accumulator designated as I here without need to modify a cell to do so. .P The VARY function is initialized by a negative or 0 value in the I accumulator (the LOGICAL one, not I itself). The equations controlling the variation may appear anywhere in the sheet, and variation begins at the initial values set into the varying ACs (P-W in the illustration). Both the logical X and A accumulators may vary, as well. .P As an example, let us suppose we want to solve the equation A=SQRT(B) for B, given A. Humans would of course just square both sides, but in an iterative solution, we would vary B until we found A. The method used here performs the variations intelligently so that we actually approach the correct value asymptotically; the signal we have a solution is that the variation stops. To set this up, we might enter the following equations in a row or column (or anywhere actually; order doesn't matter) in the sheet: .SKIP 1 I=-1._\A=55._\P=12._\*C Set up to initialize .BREAK ############with negative I, initial guess .BREAK ############12., and desired value 55. .BREAK W=1._\*C Set "step scale" .BREAK P+0._\*C Display P accumulator on screen .BREAK B=SQRT(P)_\*C Enter equation relating B, P .BREAK *U VARY B,A,W,I,P .SKIP 1 Now we go back to the first equation, since the desired value in A (55.) has been set and the initial guess for SQRT(55.) has been entered (12.) and we may now set the number of iterations desired to drive the calculations to solve the equation .BREAK B=A (which amounts to B=55.) .BREAK (which is what the VARY function does), by varying P to control B. The idea here is that we can control P, but B is an ARBITRARY function of P (and possibly other AC's) and we will vary the independent AC's like P to find what THEY need to be to arrive at the desired dependent "goal" values. Here we are solving B=A, or B=55., or SQRT(P)=55. and finding P in this way. .P In the first equation we now enter .SKIP 1 I=10._\*C Enter some number of iterations .BREAK ##########to search for between displays. .SKIP 1 and for every display, we will see how P varies since we are displaying P in one of the cells. It will converge on the square root of 55. (which is 7.416) after some iterations. We may just use the TE command instead to set the I accumulator to avoid some of the complexity of messing with cells on the sheet. .P Note that we could have more than just accumulator P varying and could have much more complex functions. Also, both A and B could be functions of any or all of these accumulators. Matrix computations may be used, or any other functions available through the spreadsheet, and the equations may be entered anywhere on the sheet. In this way, some quite powerful sorts of solutions to equations may be found. The philosophy of this is that if you know enough algebra to set up the equations for a problem (the hard part), you can set them up so the spreadsheet can solve them directly yourself, if there is a simple way to do so. If there isn't, and if you can express the desired result as an equation, the AnalytiCalc program can do iterative searching to try and solve the problem for you, varying up to 8 accumulators to do so. If you really want to search for a situation in which several cells are close to several others, just make up an additional cell that is the "summed distance" between the desired targets. For example, if you want to arrive at a solution where cell B20 should approach B30, D25 should approach D35, and cell X15 should approach cell AQ5, make 2 new cells. One should be zero, and the other will have a formula that looks like .SKIP 1 .indent -12 (B20-B30)*(B20-B30)+(D25-D35)*(D25*D35)+(X15-AQ5)*(X15-AQ5) .SKIP 1 or a simple variation, perhaps using **2 instead of multiplying as was done here. This will produce the desired results, PROVIDED that the cells depend somehow on the accumulator values you are varying. .INDENT -4 There are 2 more functions for the USRFCT.F40 sources which permit access .index Indirect Command Execution to formulae and allow more flexible command procedures. These functions exist only in a variant of AnalytiCalc-VM, not in the versions of AnalytiCalc using work files. This is because support in the XQTCMD module was needed for the XQTCM functions. .P The function *U#XQTCM#command will execute the command (terminated by the end-of-line), with any command except X or K permitted, from inside a cell. This allows command files driven from cells to control moving data, etc. It is suggested that cells containing these references in command files have the last command in the file set the cell format to [A] so that the command execution will be once only, unless repeated commands are desired. This function may not be present on overlaid versions of PortaCalc. .P The function "*U#STRVL#V1,start;len" will return a value that is made from up to 8 characters in the FORMULA of cell V1 (where V1 is .index Formula Value Access .index Sorting .index Sorting, by ASCII any cell name), starting at character "start" and for "len" characters. The value is computed such that a numeric sort on these values is equivalent to an alpha sort on the formulas; the characters are multiplied from the left by 128 and the next ASCII value is added. This function may be combined with the DS commands to sort on text, or with the XQTCM functionality to drive a slower but more thorough sort on values. .P The function "*U#HERE" will return the current location on the matrix. The normal result is a hash-coded address of the physical cell pointed to, in the % accumulator, and the column and row in accumulators T and U respectively. The row number is up by 1 (as the X,Y accumulators are .index Self Location at start of cell evaluation) to account for accumulator storage. Also, the flags for manual display update and manual recalculate are returned in accumulator V. The 4 bit being set means manual view is set on, and the 2 bit means manual recalculate is on. The W and Y accumulators return the current maximum column and row used also. These are designed to make it easy to use the IR command (Inplace Relocate) to go over only cells in use. .P The function *U FFTFW and the function *U FFTRV perform Fast Fourier Transforms in the forward and reverse (inverse) directions on the given range of data. The largest power of 2 of data points less than or equal to the given range is used and a one-dimensional real FFT is performed. This is useful for digital filters and the like. The input values are replaced by their FFT so it is best to work with values copied from the real inputs (use the *U MOVEV function to move the values before use). .P The function *U LINEF Vy:Vy,Vx:Vx (with the Vx range optional) fits a line to the input range. It will use the Vx range as the X coordinate if supplied or will compute a range if none is supplied using the cell coordinates. It computes the line equation Y=mX+B and returns the slope m in accumulator U and the intercept B in accumulator T. The value returned in accumulator % from the function is the Y fit error of the line fit. Accumulator W returns the correlation coefficient of the X and Y values also. .INDENT -13 *XV filename V1 .INDENT -13 *XF filename V1 #######The *X class commands are for sheet linkages. .BREAK *XF loads a Formula from another saved spreadsheet, while *XV loads a Value (normally from a NUMERICALLY saved sheet). They look in the given file for the named variable in the saved sheet and place the formula or value in the current position of the current sheet. Note the *P commands .index Access to Saved Sheets may be used to reset the position if it is desired not to overwrite the current formula in the case of the *XF command; the *XV command assumes the sheet was saved numerically and does not modify the formula. Note that each *X class command gets 1 number or formula. .FILL .LEFT MARGIN 1 .SKIP 2 .C -ADDITIONAL FEATURES- .P CALC is similar to FORTRAN with respect to operator precedence. Blanks may occur anywhere on a command line without effect except after a single quote mark used to specify a single ASCII character constant. CALC extends the ANSI FORTRAN syntax by allowing the following: .index Other Features .SKIP 2 .LEFT MARGIN 10 .INDENT -3 1. multiple assignments on one line, for example .SKIP 1 I=J=K=812 .INDENT -3 2. Unary + and unary - are allowed, for example .BREAK 2*-3 .BREAK +2+-7 .BREAK -2**4 .BREAK are all legal. The last expression evaluates to 16 because the unary - has a higher precedence than exponentiation. .INDENT -3 3. exponentiation may be indicated by using ! as well as ** .LEFT MARGIN 1 .P If any of the declarations are entered (such as *INTEGER or *M8) and no argument to this command is given, then CALC will print out the variables that have been assigned that data type. Note that a variable can be assigned to different data types using such commands and still not be assigned a value. If you attempt to output the value of such a variable, an error message will result. .SKIP 2 .C USAGE NOTES .LEFT MARGIN 10 .INDENT -7 1. When you iterate on a file by a call such as .INDENT 2 *@REPEAT X .INDENT -6 then note that .INDENT -5 A) X must have been set to a positive value when the command is executed or else the file will not be executed. .INDENT -5 B) If the file of commands does not change the value of the variable X you will enter an infinite loop. You can explicitly set X to a non-positive value, use the *Z command to zero it (if it is not %), or include a .BREAK *R .BREAK command to give you a chance to reset the variable and get out of the loop. .INDENT -5 C) *E and *S will allow you to exit from the command file REPEAT but will not of themselves prevent repetitions. .INDENT -5 D) Entering constants echo on the terminal (assuming *V is properly set) and can change the value and type of the variable %. This is important to remember when using % to control the iteration of a file. .INDENT -7 2. In practice, multiple precision arithmetic may be limited to less than 99 digits because of your terminal's inability to print that many characters. .INDENT-7 3. No implicit conversion is made to multiple precision when operations with reals or integers cause an overflow. This was done in version 1.0 in case the multiple precision routines have to be removed when creating a small task image for some operating system. .INDENT -7 6. In FORTRAN, .BREAK -A**2 is the same as -(A**2) .INDENT -5 with CALC, .BREAK -A**2 is the same as (-A)**2 (just like SNOBOL!) .INDENT -7 5. If R and A are positive reals and I is a positive integer, some compilers like RSX-11M's F4P won't allow (at run time) evaluation of .BREAK (-I)**R .BREAK (-A)**R .INDENT -7 6. Under RSX-11M F4P you will find .BREAK 2**.5 to have value 1 .INDENT -5 while .BREAK 2.**.5 has value 1.41421356237310 .INDENT -7 7. 10E10 is a hexadecimal constant (integer) while 10.E10 is a real. .LEFT MARGIN 1 .PAGE .C APPENDIX A .SKIP 1 .LITERAL ASCII CALC ASCII CALC ASCII CALC ASCII CALC CODE PRINTS CODES PRINTS CODE PRINTS CODE PRINTS ---- ------ ----- ------ ---- ------ ---- ------ 0 ^ 32 64 @ 96 _` 1 ^! 33 ! 65 A 97 a 2 ^" 34 " 66 B 98 b 3 ^# 35 # 67 C 99 c 4 ^$ 36 $ 68 D 100 d 5 ^% 37 % 69 E 101 e 6 ^& 38 & 70 F 102 f 7 ^' 39 ' 71 G 103 g 8 ^( 40 ( 72 H 104 h 9 ^) 41 ) 73 I 105 i 10 ^* 42 * 74 J 106 j 11 ^+ 43 + 75 K 107 k 12 ^, 44 , 76 L 108 l 13 ^- 45 - 77 M 109 m 14 ^. 46 . 78 N 110 n 15 ^/ 47 / 79 O 111 o 16 ^0 48 0 80 P 112 p 17 ^1 49 1 81 Q 113 q 18 ^2 50 2 82 R 114 r 19 ^3 51 3 83 S 115 s 20 ^4 52 4 84 T 116 t 21 ^5 53 5 85 U 117 u 22 ^6 54 6 86 V 118 v 23 ^7 55 7 87 W 119 w 24 ^8 56 8 88 X 120 x 25 ^9 57 9 89 Y 121 y 26 ^: 58 : 90 Z 122 Z 27 ^; 59 ; 91 [ 123 { 28 ^< 60 < 92 \ 124 \ 29 ^= 61 = 93 ] 125 } 30 ^> 62 > 94 ^ 126 ^ 31 ^_? 63 _? 95 _ 127 .END LITERAL .SKIP 3 .C Interactive Calc in the AnalytiCalc environment .P Calc runs as part of AnalytiCalc to do much of the math. The K command drops into straight Calc and it works as described here. There are many additions however. .P One immediate difference is that you need to issue the *V#3 command upon entry to the Calc mode to have it print anything. It defaults to the *V#0 mode in AnalytiCalc (to speed it up slightly). .P Calc can access all the variables on the sheet (names A1 and up), which may be up to 8 bytes long. However, while it can examine .index Cell Precision or set any of these, the spreadsheet recomputes them from its disk based formula file when re-entered by the *E command. To modify this file, the "current position" in the physical display sheet may be set by answering the prompts after giving the *P command. Then the current display value (contents of the "%" variable) may be entered into the disk file by executing the *W command. Numerous other manipulations are possible, and by setting the view level to 3 (*V 3) it is possible to debug a command file that drives a spreadsheet cell from interactive mode (by tracing through its' operation to see what it is doing). All interactive Calc commands work also from indirect files. The physical location is clamped to legal values. Note too that any unused cells of the sheet may be used as scratch accumulators. However, they may not assume any types of multiple precision numbers, as they are all 8 bytes long. In the case of AnalytiCalc-PC, the multiple precision numbers are at most 20 digits long (to save space). The internal expression stack is 40 tokens deep, so very complex expressions may have to be split into pieces to work. Error messages will be shown if this happens; they are placed on the top line of the screen. .P It should be noted that until any cell is flagged as having something in it (either by an Enter command or implicit enter, or by giving it a format with the DF command, or by loading or copying something into it), it does not really exist in AnalytiCalc-PC and always reads as having value 0.0 and formula P#0#0. It must be set up from the spreadsheet environment before it can be used. The accumulators all pre-exist and do not need this initialization however. This is a difference of AnalytiCalc-PC from older versions, in which the storage was always present whether needed or not. The current versions allocate storage only as needed, and CALC routines generally do not call these allocators. .SKIP 4 .INDENT -1 2 GRAPHICS ^^ .C PCC GRAF .SKIP 1 .C GRAPHICS INTERFACE AND OUTPUT FROM PCC SPREADSHEET .C GLENN EVERHART, 28-FEB-86 .SKIP 1 .SKIP 2 .C Introduction .P The AnalytiCalc system uses a separate program to provide its .index Graphics graphics output, permitting easy tailoring to different graphics devices. The routine supplied uses a character graphics subroutine (GHASP) to produce histograms and scatter plots from any rows or columns of a saved sheet which has been saved via the PPX or PDX or PPN or PDN commands. The output is printed normally. However, users with other devices may easily modify this program to insert their own favorite graphics output device output into the program. There are several options to govern plotting, and one plot per command is produced. Once a saved sheet is generated, many plots can be made from it without reentering the sheet. .P An advantage of this approach is that the address space consumed by the graphical routines is not taken from the spreadsheet; since the sheet permits reentry keeping the random access file it uses, graphics may be handled with a fair degree of transparency by command files, or even by spawned commands. .P In the 8088 versions of AnalytiCalc, some extra graphics output routines are supplied for other higher resolution graphs. Also, by using the DTR-32 interface to AnalytiCalc-PC and using DTR graphics, much more powerful on-screen graphs can be handled on a ReGis terminal. This package is however universal and adapted to data analysis. It is intended for analysis, NOT as a generator of fancy presentation graphics. Accordingly, it makes few assumptions about the display so it will work on almost any display available, even on hardcopy devices. .SKIP 2 .P Getting Started: .P Run AnalytiCalc (PCC is sometimes used to call it, from the other name PortaCalc) and create your spread sheet to your liking. When it is set, use the following commands: .SKIP 1 .LITERAL L A1 go to cell A1 (top left of sheet PPX Put out physical sheet. (PPN may be used if desired.) .END LITERAL When AnalytiCalc asks for a filename, give one which describes your file well (with a file type) followed by return. Example: Myfile.pcc .P When AnalytiCalc asks you for maximum displacements, enter 0 in both cases (equivalent to telling it to save everything). .P When done, you may use the X command to exit PCC (AnalytiCalc). .BREAK Now run PCG (on PDP11, type PCG; on VAX, MCR PCGRAF). .BREAK When PCG first starts, it asks for an output dataset. This may be any file or device on the system. If TT: or TI: is used as output (the terminal), the graph will be scaled to fit on a terminal screen. Otherwise it will be sized to fit a sheet of (normally 132 column) printer paper and will have some extra statistical information about the plot. (The program assumes if the first character of the output name is T and the 3rd character is a ":", it's a terminal and acts accordingly.) When PCG runs, it will ask for a command line. A typical command to give a scaled plot of column H from row 1 to row 30 would be .SKIP 1 Enter plot command>NN myfile.pcc H1:H30 [S] .SKIP 1 .P Note that the rows and columns are referred to exactly s on the sheet itself. The initial NN could be LL or LN or PP or other letters, but L in column 1 takes the logarithm of the numbers in the first (in the example the only) range of numbers selected, and L in column 2 takes the log of the numbers in the second range. A P is used instead of an N where the values displayed should start from 0. rather than from the lowest value in the region selected. .P Should the range to be plotted include only POSITIVE numbers, make the first 2 letters P's. This will ensure the scale starts at 0 rather than at the minimum positive value selected. The command line would then look like: .SKIP 1 Enter plot command>PP myfile.pcc H1:H30 [S] .SKIP 1 .P Scatter plots plot entries in the first range against corresponding entries in the second range selected. One dimensional .index Scatter Plots .index Histograms plots are up to 100 bins wide and scatter plots are up to 50 bins by 50 bins. Height of histograms is Scaled to fit a page if the [S] form is used and will Vary to whatever is needed if the [V] character is used. Widths of plots are less than 100 (or 50) if the number of entries plotted are less than those dimensions; if the number of entries plotted is greater, it will be scaled to the 50 or 100 bin maxima (which derive from paper size mainly). If the option [H] is chosen, the plot will be Hacked off at one page, but scaled as if the [V] Vary option were specified. .SKIP 1 .P SYNTAX AND USAGE: .P This program is designed to allow an interactive user to enter a single command line to the program which it will parse (using the special version of VARSCN in GVARSCN) and allow graphic output from AnalytiCalc saved spread sheets. The assumption made is that the sheet has been saved with the PPN or PDN command. The filename must appear in the command line and variables in the file (named as though the cursor had been in cell A1 when the PPN / PDN was done) may be histogrammed or scatterplotted against each other. .SKIP 1 The GHASP routine (a FORTRAN plot package for ordinary printers) will be used for this version. Other routines may be readily used as replacements for specific graphics output devices. There is a document supplied PCSAVFMT.TXT which will give the format used to save AnalytiCalc/PortaCalc files to simplify reading them in. The popular VisiCalc (tm) DIF format was NOT used in this program because it cannot encode the variety of display formats available. The format chosen was rather a straight ASCII format permitting almost any language to read the saved files with a minimum of grief, and which permits editing saved sheets with a normal text editor. .SKIP 1 Input syntax: .BREAK PP or NN or LL filename.ext V1:V2 [c] V3:V4 +switches .BREAK where .P an L in columns 1 or 2 takes log of 1st or 2nd range numbers (base 10), a P indicates Positive numbers (so 0 is included in the range to be plotted and the plot starts at 0. and increases rather than starting at the minimum observed value for an initialized cell in the saved sheet), and N means Normal, i.e., neither of the above; the minimum and maximum coordinates are taken as min and max values in the set of values to be plotted, .P filename.ext appears at the start of the command line after a space and with a space following it and is a valid RSX or VMS file specification (the same as was given to AnalytiCalc in the PP or PD command that saved the sheet normally). .P V1:V2 and V3:V4 are ranges. V3:V4 is optional and its presence implies a scatter plot. These ranges must be either a row or a column or part of them. If only range V1:V2 is present, a histogram will be done using the Scale option of GHASP to fit the plot onto a page. The plot will be set up for 100 bins horizontal, 50 vertical, or the number of entries to be plotted, whichever is less. .P If the V3:V4 range exists, the character Q in the [c] position (the [] are required) will result in a "density" plot in which the program will attempt to print darker in filled bins. This is crude and the default is to use a 2 digit number. Again, plot size will be scaled to 50 by 50 bins. For histograms, the character S implies Scale the plot to fit one sheet of paper, the character H implies Hack the plot off at one sheet, and the character V implies Vary height, using as many sheets of paper as needed to plot the data. The character S should be used for "normal" scatter plots (in which number of entries in a scatter plot "bin" is represented as a number or character). .P SWITCHES: .P The following switches may be added after the rest of the command line: .skip 1 .indent 12 +hnnn Height nnn characters .indent 12 +wnnn Width nnn characters. .P If both are used, use the specification +Hnnn+Wmmm (e.g., +H20+W25 for 20 high and 25 wide). .P NOTE: (V1B): .BREAK Command format errors are well diagnosed, but parsing is fairly inflexible. Multiple ranges are not presently implemented, though it would be a minor change to do so. It is expected that the source for PCGRAF will always be available. .P To use PCGRAF from inside AnalytiCalc, use the $ command to pass the command line to the system; this will allow graphics to be done without leaving the AnalytiCalc environment. This can be done from an indirect file driving AnalytiCalc also, without special intervention. Note that AnalytiCalc-VM for VAX or AnalytiCalc-PC for VAX or PDP11 have the $ spawning capability. Creation of a few command files to allow passing desired parameters to PCGRAF is simple but left to the reader; the program reads unit 5 and writes command prompts to 4 and the graph to Fortran unit 6. .Page .C APPENDIX B .C ANALYTICALC SHEET USAGE .P The AnalytiCalc spreadsheet provides a large, but finite, number of rows and columns to compute with. .P In the 8088 version, there is a "prime" computing area of 60 columns and 300 rows, or 18,000 cells, which may be filled at any one time. .P Because some applications need different shaped storage, AnalytiCalc has been extended to allow this storage to be used as if it were shaped in almost any way desired. .P Assuming your "physical sheet" is compiled to support 80 columns and 400 rows (standard on VAX versions), the method used is that when you specify a column greater than 80, a second strip of the sheet is used as an alias for columns 81-160, a third strip for 181-260, and so on. The depth of this strip is set in the S command; initially the strips are 40 rows down each. Similarly, when you use rows 401-800, a second vertical strip of the sheet (initially 8 columns across) is used as if it were the first 8 (initially) columns in rows 401-800. Other strips further right are used further down. .test page 40 .Skip 1 This can be shown pictorially like this: .LITERAL C o l u m n N u m b e r 0 00 11 2 0 88 66 4 1 01 01 0 AAAAAAAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCCCCCCCCC BBBBBBBBBBBBBBBB CCCCCCCCCCCCCCCC .End Literal .P Note that the cells labelled AAAAAAAAAAAa are in the "prime" area. The cells labelled BBBBBBBBBBB are in the extended area and appear to all uses as though they were really part of a wide but shallow sheet. Likewise the cells labelled CCCCCCCCCCC. They also are shown in their aliased locations in the "prime area" however, to show how the organization is done. .P In the S command you will be asked if you want to reset the extended area mapping. If you reply Y, you can enter the number of ROWS to add when moving over to an extended COLUMN group as shown in the picture, or the number of COLUMNS to add when going to an extended ROW group as shown in the picture below: .test page 20 .Literal Row no. 001 ABC ABC ABC 400 ABC 401 B B B 800 B 801 C C C 1200 C .End Literal .P You will note that the extended region here goes to make the spreadsheet appear long but narrow. .P The redefinitions allow you to specify how "thick" the A, B, or C regions are here; the length depends on how far out you need to go. Thus, if you need a 3000 row sheet, you might allow only the default 6 .Index S command columns width. If you don't intend to use EVERY cell in your range you can of course use still longer or wider sheets. This redefinition is done recursively so that you can use ANY region in this way, not just the top or the left edges. But the cell redefinition still maps storage in this way to the "prime area". The insert or delete row or column commands only work in the "prime area" since they can cause considerable confusion in an extended sheet. The copy commands are not so constrained however, and can be used as desired. .P This sort of area redefinition is different from other spreadsheet programs only in that aliases are provided to storage; overall storage use works similarly in many packages. .P Consider 1-2-3 and Symphony (both tm) for a moment. These programs allocate a rectangular array of 4 bytes per active cell, plus a scratch area containing all cell contents for cells that are non empty. Thus, if one has 200K of memory above the (hefty) requirements for those programs, one can have 50K of totally empty cells. If cells contain one value (6 bytes) each, the total available storage allows only 20K cells with only values in them. If cells have 10 character formulas in each (plus a value), only 10K cells can be held in this much memory. (In actual practice, far fewer than 10,000 formulas can be entered.) .P In 1-2-3, a sheet with 10,000 cells storage can be organized in 2000 rows by 5 columns, 250 columns by 40 rows, 100 columns by 100 rows, or any other way in which (rows used) * (columns used) is less than 10,000. While you can display a screen showing cell IA2000, however, you CANNOT use it. In fact, the area you can use is bounded by a hyperbola whose exact position depends on your memory size and the needs of the product for memory for itself (typically 256K or 320K for these, at a minimum). Since some "lower" memory is used in even the newest releases of these products, this problem still exists with lesser impact even with memory expander cards. .P With AnalytiCalc, you also have a fixed maximum storage available, but it can be used anywhere in your address space and can be remapped to a physical sheet any way you like. When an extended address is found, its column number and row number are remapped in turn until both fit within the prime area. This makes the remapping somewhat hard to follow, but at least a cell that is addressed can conceivably ALWAYS be used. Where the need is for a wide but shallow sheet, or a high but narrow one, the remapping provides the same flexibility of shape as in other products, but you can control its action to achieve the results YOU need. You will not suddenly be told you are out of memory, but can plan your usage. Dimensions like 32000 by 1 or 1 by 32000 can be readily handled in extreme cases. The only caution is that the mapping MUST NOT be altered if any extended address cells are in use. Save the sheet, alter the map, and reload it to vary the mapping. NOTE: ONLY set up the map while the sheet has nothing in it in an extended area. Save your sheet, alter the map, and then reload if you have an active extended area (i.e., any cell with row number greater than 400 or column number greater than 80.) You have great flexibility here, but can still only access the storage available. The total amount of such storage is quite large, since all 32,000 cells can have up to 100 characters in them at once, plus an 8 byte value and multiple equations per cell. This is far more storage than 1-2-3 (tm) or Symphony (tm) can handle on even a 640K PC or AT, and is comparable to the most they can permit even with extended memory boards. It is in fact as much storage as can be used without excessive page thrashing on a VAX, making it one of the most efficient packages you can use. .P In addition, you can link sheets efficiently in AnalytiCalc, so your computations can be "bite-sized" pieces linked with use of GPX+ commands or *X cells or both. The ability to do automatic links in AnalytiCalc is the thing that 1-2-3 lacks which has made its users interested in giant spreadsheets in the first place. A giant summary sheet is a stopgap solution to summarizing many activities, since physical memory will always run out with a large enough summary. A sheet that finds its inputs on disk will succeed in summarizing far larger systems of sheets, as its storage is limited only by disk capacity, not memory. .skip 1 .c New Features - V19.01A .p A modified command structure is supported now. If you type the command /; then the commands to AnalytiCalc are modified as follows: .skip 1 .list 1 .le; Any command beginning with a digit (except single digits standing alone) is treated as an EV followed by the text. .le; Any command beginning with / has the / stripped off and the rest is treated as a command. .le; Any command beginning with " is treated as an E" command (enter text) with the " stripped out. .le; Anything not starting with a digit, a " character, or a / is treated as an Enter command and is prefixed with "EN " and used. .end list .p The old (default) command mode is restored with the command "//" so that /; and // switch between the two. These commands may be given in ACINIT.PRM, other command files, or from the console. They introduce incompatibilities in that in the new version commands like "DF range [format]" must be entered as "/DF range [format]" (for example) to work. .p To facilitate writing command files that work in both modes the command /# switches the mode with a save cell. A sequence of commands: .tab stops 15,25,35,45 .skip 1 .literal /# (save current command mode in save cell) // (enter old command mode) ... (do all of command file) /# (restore saved user command mode) .end literal .skip 1 will allow a command file to operate and be written to run predictably in either user environment choice. .p Please NOTE that special characters in the first character are interpreted as commands in /; mode. The * character is handled as a comment. To enter formulas with functions starting with *, use the COMMAND form, e.g. /EV *U IDATE. This always works and disambiguates syntax. .p When the system is in /; mode, the cell prompt at the 23rd line of the screen ends with : so that it appears like .skip 1 AB 21: .p When the system is in // mode (initial default) the prompt ends with the > character so it appears like .skip 1 AB 21> .skip 1 This should aid in distinguishing modes during use. .c New Features of V19.2 .p In V19.2, AnalytiCalc adds the OAD and ORD commands. These are like the OA and OR commands except they leave the relative mappings of the screen alone. Thus, if you already split your screen into 3 parts and use the command "OAD cell" to reset the mapping, the resultant screen still has 3 regions at the same relative positions as before. If you use the ORD command, then only the part of the screen right and down from the cursor is affected, but any screen partitioning is maintained. If these commands leave some areas pointing to nonexistent areas, use a command OR or OA to reset the areas desired to something real again. V19.2 added the change from > to : at the end of the prompt depending on // or /; modes also. .test page 45 .p The difference between OA, OAD, OR, and ORD may be illustrated in the following figures, which represent the screen mapping after a command sequence .test page 20 .skip 1 .literal OA A1 L C1 OR AA1 L A11 OR A100 .END LITERAL .skip 1 which produces a screen mapping like this: (note only part of the map is reproduced...) .test page 20 .skip 1 .literal A B AA AB AC 1> A1 B1 AA1 AB1 AC1 2> A2 B2 AA2 AB2 AC2 3> . . . . . 4> . . . . . 5> . . . . . 6> 7> 8> 9> 10> A10 B10 AA10 AB10 AC10 100> A100 B100 C100 D100 E100 101> A101 B101 C101 D101 E101 102> 103> 104> and so forth. Note that columns 105> AA, AB, and AC are now mapped 106> for only 10 rows. Thus we have 107> 3 screen regions, not 4. .end literal .test page 40 .skip 1 While after a sequence like: .skip 1 .literal OA A1 L C1 OR AA1 L A11 ORD A100 .END LITERAL .skip 1 the resulting screen mapping looks more like this: .test page 20 .skip 1 .literal A B AA AB AC 1> A1 B1 AA1 AB1 AC1 2> A2 B2 AA2 AB2 AC2 3> . . . . . 4> . . . . . 5> . . . . . 6> 7> 8> 9> 10> A10 B10 AA10 AB10 AC10 100> A100 B100 AA100 AB100 AC100 101> A101 B101 AA101 AB101 AC101 102> 103> 104> and so forth. Note that columns 105> AA, AB, and AC now extend to 106> the full screen. This gives 107> 4 screen regions. .end literal .skip 1 .p These figures illustrate the usefulness of the OAD and ORD commands. .Page .C Appendix C .C Variant Versions of AnalytiCalc .SKIP 1 .C Variant Versions .P There are several variants of AnalytiCalc. Some PDP11 versions, and some VAX versions, use a random access file to hold formulae. These will ask whether there is a work file (the random access file) and of its characteristics. The VAX version using memory instead (called .INDEX MEMORY USE .INDEX SAVE AnalytiCalc-VM) uses a memory array for formulas and does not ask about workfiles, since it has none. (It also requires a confirm on exit to ensure you saved the sheet with a PP class command.) Finally, the PC versions of AnalytiCalc use memory arrays backed by temporary disk files for values and formulas. These do not ask about work files, but .INDEX SCRATCH FILES ask how many K (bytes) to reserve on disk for the value file and the formula file. Generally there should be somewhat more formula space than value space if many long formulae are used; otherwise pick roughly equal values. These scratch files are deleted on exit from AnalytiCalc-PC, but the sheet will NOT run out of room provided sufficient file space is allocated. If it runs out due to lack of room, a message on screen will tell which file is out. Save the sheet and restart then with a bigger file. Be aware that AnalytiCalc-PC is slower loading and running than AnalytiCalc-VM, but more comparable to PDP11 or workfile versions. The best debugged and most capable versions are AnalytiCalc-VM for Vax, and AnalytiCalc-PC for PDP11 (including DEC PRO 300 series). AnalytiCalc-PC also has a VAX build file, and that version is the only one which supports huge cell addresses and Datatrieve interfacing. It is now the recommended VAX implementation, though AnalytiCalc-VM still works. .P The Datatrieve (DTR) interface is described in DTRIF.DOC and adds not only a full bidirectional link to DTR for all DTR functionality, but adds optionally a "Super-AnalytiCalc" capability which permits you to define an input and an output area of the spreadsheet and use AnalytiCalc as a smart data filter. The input and output areas can be handled either as sequential or as random access (128 byte record) files and are constructed so the sequential mode is useful for mailbox, pipe, or communications line processing as well as simple files. Also the FILFMTOUT#range command allows you to "freeze" a two dimensional area as values and write to an output file if one is defined. The input and output areas can be any (possibly overlapping) two dimensional areas of the sheet. Control can be from within the sheet template or from interactive commands. The random access input is structured so that it can also be used (by opening the file for read only) to provide protected cells which have un-modifiable formulae as well as to act as a communications mechanism. The Datatrieve .Index Datatrieve .Index Input areas .index Output areas .Index protection access mechanism provides additional communications channels and is structured to allow FMS and graphics commands to be includable, and controllable from within AnalytiCalc procedures if desired, as well as normal interactive DTR commands. .P The sequential interface is designed to make it simple to "connect" AnalytiCalc to any application by running the application in a separate process with input and output set as mailboxes, to which the sheet output and input areas can be logically assigned. This can be done completely from within AnalytiCalc if desired (with a few pieces done via the "$dcl-command" feature). It should also be mentioned that as an aid to parsing text coming from .Index Connecting generic programs generic applications using the sequential interface to mailboxes, the DTR interface package implements formula string compare, substring search, and formula string length functions. These can supplement the other string functions and greatly facilitate parsing text coming from a generic application. .P AnalytiCalc-PC for VAX also supports output files up to 512 characters wide, save/restore of complete attributes of a sheet (including mappings and column widths if desired), and some other novel features, and will be the only version able to support the upcoming extended DBMS interface which will allow some cell address ranges to automatically access a DBMS file or files with extended DBMS operations permitted. It is now the recommended implementation across the board. .P AnalytiCalc-88 (for Rainbow and IBM PC) functions similarly to the PDP11 and DEC PRO versions but has fewer overlays (some variants have none), and thus has no limitations. If you use AnalytiCalc-PC, the storage needed per cell in the workfile is 10 bytes per cell, and for formulas, 12 bytes of formula go into every 16 bytes of workfile (the remainder is for accounting overhead). Thus, for a 32,000 cell sheet, 320K bytes is the maximum useful value file size, and 512K bytes would permit a 12 character formula for each cell, while 4600K bytes would give every cell 108 characters and is the maximum useful size. Since a symbol table algorithm is used, sizes may be as small as desired. If the size chosen is less than the memory allocation built in (1K is guaranteed to be), no files will be opened and cells will be stored in memory only. Note that if value and formula file sizes are given negative, a slower but sometimes more efficient packing will be done of the file. The workfiles are opened in one's default device at the time of running the program. The "slow" algorithm picks a diskfile page to use by taking the cell number modulo the number of pages in the file. The "fast" one picks a diskfile page to use by taking the position in the total sheet (columns increasing fastest) and making the number of cells in a diskfile page vary as number in the sheet divided by the size of the diskfile. Thus, cells close to one another on the sheet are kept close on the disk file. This can overflow a disk page if too many cells for a page are used close to each other. Therefore, the program will ask you how many rows and columns you propose to use for purposes of disk clustering. If the "fast" algorithm is used, the disk page will be chosen as (cell address)*(number of disk pages total)/(size of the total sheet you said you'd use, clamped to the max physical size). If you say you'll use a small area, cells will be scattered better. If you use beyond the area you said, disk pages are chosen in modular fashion. Therefore, if you run out of room in a file, try either varying the size for allocation, or adding space to the files. If you give the exact size you're really using, the "fast" algorithm will equally divide disk pages among cells on the screen you're using for rectangular use. The size question is ignored if the "slow" algorithm is used, since that algorithm equipartitions without needing to know the size used. .NOTE If you run AnalytiCalc-PC on a VAX, the workfile issues may be ignored. Demand-zero pages are used instead of disk files for speed, and the default storage size should be ample. .END NOTE There are two effects of importance here. First, if you don't allocate enough space, scratch files may overflow and you'll have to save the sheet and rerun with bigger files. Second, if the scratch files are TOO big, the program will waste time switching pages in memory unnecessarily. Therefore, when you tell AnalytiCalc how much space you intend to use, it prints out the sizes of files needed ASSUMING that you will fill in EVERY cell in the range indicated, and that formulas are 12 or less characters long. If you use less cells, both files may be shorter. If formulas are longer, the formula file needs to be made bigger. The program won't actually go out to disk unless the files are bigger than its in memory buffers, so don't worry about that condition. The suggested sizes are usually a good guess. .P A version of AnalytiCalc now built standardly on PDP11 (on PRO 3XX the PCCPRON.COM file is used) has two in-memory pages instead of one. The one memory-page system could be made to thrash fairly easily since copies from one area to another required continual reloads of the appropriate pages. The two-page algorithm makes each page half as large but allows LRU paging to swap the oldest page first so that copies from one area to another tend to have the page contents follow along the regions copied. In large sheets the speedup can be enormous. (The WRKFIL.FIV and WSHEET.F40 files are used for this on PDP11.) .page .P REMEMBER: If you are using a "workfile" version of AnalytiCalc, it is obsolete. AnalytiCalc-Pc and AnalytiCalc-VM are the most current and most capable versions and should be the ones used unless there is a compelling reason to use an older one. IF you have a more current version of AnalytiCalc, skip to the "Calculation Screen" section. .P Now back to the workfile (obsolete) version. .P The next question is whether there is already a work file on disk to use or reuse. If you have such a file, you can let AnalytiCalc just reuse it. AnalytiCalc will create one if none exists, but one already in existence can be used as a way to continue a computation somewhat faster than loading a saved sheet, or to continue after a crash. Reply N if there is no file and one must be made. The reply Y will cause AnalytiCalc to read the old file and find out what format entries are valid over the whole sheet, so that an old sheet's workfile can be used to continue; formulas and format information is still there. To start quickly, you can type Q, which means AnalytiCalc does not read the whole file, but only the default display window part. If you choose this option, all cells will start with 0 until the first R (Recalculate)command is given, when the values in the display window will reappear. Other cells' values will not be set up however, so large sheets may need the Y option if the old cells are to be used outside the immediate display area. Ordinarily it's a good idea to use the Y or N options only, not the Q option. However, when re-using a small sheet that all appears in the display window, or reusing a workfile that you intend to Zero All of (see the ZA command), the Q option is a good time saver. Normally it is better practice to exit AnalytiCalc .INDEX EXIT .INDEX X Command with the XD option to delete the workfile (assuming you used the PP option to save it if you need it) rather than to leave multiple random access files around. AnalytiCalc's workfile has space for all cells possible in your sheet, while the save files only contain data on cells that are in use; hence retention of workfiles represents a waste of disk space. .P Note that the Q option is likely NOT to work if you have used integer formats. In that case, ALWAYS use the P and G commands to save and load sheets. These are a good idea anyway. They permit sheets to be loaded across AnalytiCalc versions, and some variants permit graphing the entries. A workfile is only usable as long as the physical sheet AnalytiCalc is compiled for is identical to that which created the workfile. .P The last question of this setup phase is the filename. A standard filename, either that of the old file, or the name to use for a new one, is required. Limit it to the max supported by your system for names (on DEC, 9 character names max). A full system file specifier may be entered (including directory, etc.) at this time, provided the specifier is a file that you may legally open for update (read AND write) access. AnalytiCalc has no such thing as an INSPECT mode. .P The workfile that is set up may be of considerable size and could be much larger than is actually needed. However, if you know that you will be using fewer rows of your sheet than the maximum, you can specify a smaller maximum and have the workfile made smaller on disk (this is true of the VAX version and the PDP11 XL version) by specifying a "/" character after the filename. If this is done, the program will ask for the number of rows to use. This will be clamped to at least the number on the initial display, and at most the number for the maximum sized generated sheet. .P If you try to use more rows than this during a session, the results are UNPREDICTABLE and will possibly be wrong or could crash the program (leaving the random file, so a restart is possible). However, this permits a "large" version of the program to be used even where one's disk quotas or space is smaller than the full-sized workfile. The number of COLUMNS is NOT variable in this way. Note the sheet file is organized in a fashion that has columns varying quickly, rows slowly. The calculations are done going across columns, then down rows, so the file is accessed nearly sequentially during a recalculation (and the memory array is also). This was done deliberately to avoid paging slowdowns or disk thrashing and is part of the reason why the order is not variable. By recalculating (or auto recalculation), the correct results are achieved anyway with one or two more recomputations even where order dependencies exist. .P If the Q option is not given, AnalytiCalc displays the directory page (0) of its help file while initializing the file or reading it, then goes into the sheet proper. .page .C APPENDIX D .skip 1 .left margin 1 .right margin 100 .C AnalytiCalc Function Summary .Index Function Summary .SKIP 1 .TEST PAGE 12 .P The available multiple argument functions are: .index SUM function .index MAX function .index MIN function .index AVG function .index STD (Std Deviation) function .index IF conditional .index Boolean Functions .index IRR function (Internal Rate of Return) .index NPV (Net Present Value) Function .INDEX PMT Function .Index AVE Function .INDEX FVL (Future Value) function .index MOD Modulo function .index LKP, LKN, LKE Lookup Functions .TEST PAGE 20 ^? .LITERAL SUM[variables] Sum of all arguments MAX[variables] Max of arguments MIN[variables] Min of arguments AVG[variables] Average of arguments AVE[variables] Average of arguments excluding zero args STD[variables] Standard deviation squared AND[variables] Boolean AND of all variables in list IOR[variables] Boolean inclusive OR of variables NOT[variable] Boolean complement of variable XOR[v1,v2] Boolean exclusive OR of v1,v2 EQV[V1,V2] Boolean "equivalence" of V1,V2 (complement of exclusive OR, true if bits have the SAME value) CNT[variables] Number of nonzero variables in list MOD[V1,V2] Returns V1 modulo V2 (i.e., remainder of V1/V2 division.) SGN[v1] Returns 1.0 times sign of V1 LKP[var,variables] Lookup variable in "variables" range greater or equal to var, return its index (starting with 0) into variables range. LKN[var,variables] Lookup variable in "variables" range less than or equal to var, return its index (starting with 0) into variables range. LKE[var,variables] Lookup variable in "variables" range strictly equal to var, return its index (starting with 0) into range. Note all LKP, LKN, LKE return the last variable index if no satisfactory value found. NPV[disc,vars] Net Present Value of vars (equal time interval numbers), at discount rate disc where disc is a fraction (e.g., .12 for 12%) IRR[PV,FV,returns] Internal Rate of Return. Will compute internal rate of return on up to 20 periods, returning rate per period. The returns are expected to be at equal time intervals. PV and FV are initial and final values of investment and the result is computed via Newton approximation. PMT[princ,inter,nper] Payment (mortgage payment per period) function. Will compute payment per period for principal amount "princ" with interest per period as "inter" and number of periods as "nper". All arguments must be cells. The formula is the standard ordinary annuity formula. Interest rate must be a fraction so that 14% would be 0.14, for example. PVL[payment,inter,nper] Present Value formula. Computes present value of an annuity given "payment", the payment per period, interest rate per period (as a fraction, so 12% is 0.12) in "inter", and number of periods as "nper". All arguments must be in cells. RND[DUM] Generates a random number between 0. and 1.0. An argument is needed but it is NOT touched by this function. CHS[IDX,Range] Choose cell from range based on value of cell IDX. If cell used as IDX is 1, first element of range is chosen and so on. Zero is returned for out of range cases. IF [V1.rel.V2] statement | else-statement Compares two variables and executes either "statement" (if the relation is true) or "else-statement" (if the relation is false). Valid relations (in the place of the .rel. above) are: .EQ. Equal .NE. Not Equal .GT. Greater than (V1 greater than V2) .LT. Less than (V1 less than V2) .GE. Greater than or Equal to (V1 >= V2) .LE. Less than or Equal to (V1 =< V2) .END LITERAL \? .INDEX Random numbers .Index RND function .LEFT MARGIN 1 .INDENT -1 .P The following single argument functions are available: .SKIP 1 .index Functions ^? .LITERAL FUNCT NAME ARG TYPE FUNCT VALUE DESCRIPTION ------------------------------------------------------- ABS REAL REAL absolute value DABS REAL REAL absolute value IABS INTEGER INTEGER absolute value IFIX REAL INTEGER REAL to INT conv. AINT REAL REAL REAL truncation INT REAL INTEGER REAL to INT conv. IDINT REAL INTEGER REAL to INT conv. EXP REAL REAL e**X DEXP REAL REAL e**X ALOG REAL REAL natural logarithm DLOG REAL REAL natural logarithm ALOG10 REAL REAL logarithm base 10 DLOG10 REAL REAL logarithm base 10 SQRT REAL REAL square root DSQRT REAL REAL square root SIN REAL REAL trigonometric sine DSIN REAL REAL trigonometric sine COS REAL REAL trig. cosine DCOS REAL REAL trig. cosine TANH REAL REAL hyperbolic tangent DTANH REAL REAL hyperbolic tangent ATAN REAL REAL arc tangent DATAN REAL REAL arc tangent .END LITERAL .SKIP 1 \? .SKIP 1 .P The following special constructs in a formula act as functions: .LEFT MARGIN 15 .index Command Files .index Formulas .index Cell Names .INDENT -5 __@V1,V2 Means get the values stored in V1 and V2 and use them as column and row locations pointing at some cell in the sheet. Replace the construct with the name of that cell. .INDENT -5 ___#V1 Means take the real number in cell V1 and unpack it as if it had been a packed value from a formula with 8 characters packed; then convert it back into ASCII and place in the formula in place of this construct. This construct is intended to be used with the *U#STRVL function to allow retrieval and edit of formulas. The *U#XQTCM function permits use of the EDit command within a cell for string manipulation. .LEFT MARGIN 1 .P The following "equation commands" also act as functions with the effects described: .FILL .LEFT MARGIN 15 .INDENT -13 *@filename ####Where filename is the name of a file of CALC commands. CALC reads the file and executes the commands. .INDENT -13 *ASCII ####Declares a list of variables to be of type ASCII. .INDENT -13 *C ####COMMENT line. .INDENT -13 *N ####NOVIEW. .INDENT -13 *V ####VIEW. Controls printing options in K mode .INDENT -13 *R ####READ. Allows a single line to be read from the terminal. .INDENT -13 *REAL ####declares specified variables to be REAL*8. .INDENT -13 *DECIMAL ####Declares specified variables to be REAL*8. .INDENT -13 *S ####STOP. Same as *E. Goes back to spreadsheet. .INDENT -13 *E ####EXIT. Gets out of K mode, back to spreadsheet mode. .INDENT -13 *Z ####ZERO. Zeroes all accumulators. .INDENT -13 *G ######*G V1,V2 (where V1 and V2 are cell or accumulator names) .index Indirect Addressing will evaluate V1 and V2 as the column and row numbers, on the physical sheet, of the desired cell. The addressed cell's value is retrieved and used as the resulting number. .INDENT -13 *W ###### Takes the value at the current cell and writes it out to the formula as a numeric (floating) .index Freeze value. The *WF command stores the cell similarly, but uses the format of the current cell instead of the D32.25 format used for *W. .INDENT -13 *P ######The *P command resets the current cell coordinate .index Temporary Move from within a cell (until the next cell is evaluated only). It has several forms: .INDENT -2 *P - By itself, *P causes Calc to prompt for the new physical column and row number. .INDENT -2 *P V1 - This moves the current location to the named cell where V1 is the cell name (e.g. A5, H2) .INDENT -2 *P@ V1,V2 - This uses V1 and V2 (cell names) as column and row numbers and changes the current physical cell position to that defined by the contents of cells V1 and V2. This gives complete addressing of the sheet from within any cell. .INDENT -13 *F #######*F Label - If the value in % is positive and nonzero this command rewinds the input file for the .index Command Files .index Looping .index Conditional Motion AnalytiCalc @ command and seeks a line beginning with the characters *CLabel (where "label" is what you put after the *F command). .INDENT -13 *J #######*J Label - This command behaves as the *F command but .index Command Files .index Looping .index Conditional Motion operates on the file used by the Calc *@ command rather than the AnalytiCalc one. .INDENT -13 *QF .INDENT -13 *QW #######The *QF (Float) or *QW (write) commands are used to .index Command Files .index Data Base Access examine sequential files created outside AnalytiCalc and return values or formulas. Their syntax is .INDENT -4 *QF filename _?key1_? _?key2_? .INDENT -7 or *QW filename _?key1_? _?key2_? .BREAK where _?key2_? is optional .BREAK l and m are delimiter characters for start and end of the parts of the selected records to extract (defaults to first part of the record) filename is just the file specifier in the host OS. The *QF command gets a part of a record containing the keys specified and turns it into a number ("floats" it). The *QW command Writes that part of the record to a formula. The special characters in the part of the command are delimiters of the area to be picked out. Variant forms allow such choosing to be by column number instead of key character if needed. .SKIP 1 .INDENT -13 *U YRMOD VY,VM,VD .SKIP 1 returns the Julian date (in %) computed from the Year (in VY), the month (in VM) and the day (in VD), where VY, VM, and VD are sheet cells. These may be the result of date arithmetic. .SKIP 1 .INDENT -13 *U JDATE Var .SKIP 1 assumes the formula in cell Var (any spreadsheet cell name) contains a date string in the format YY/MM/DD. It reads this formula and converts the date to a Julian date, returning it in the % accumulator. .SKIP 1 .INDENT -13 *U JTOCH Jul,Var .SKIP 1 assumes that variable Jul (any spreadsheet cell) contains a Julian date and changes it into an ASCII string in the cell whose name is in the Var position here. .SKIP 1 .INDENT -13 *U DATE VY,VM,VD,Var .SKIP 1 uses VY, VM, and VD as year, month and day, and computes a Julian date from them. It then composes an ASCII string of form YY/MM/DD for that date and stores in the formula for Var. .SKIP 1 .INDENT -13 *U WKDYS D1,D2 .SKIP 1 computes the number of workdays between Julian dates D1 and D2 just as taking the difference of two Julian dates gives differences between calendar dates in days. .SKIP 1 .INDENT -13 *U WKDIN D1,N1 .SKIP 1 returns a Julian date that is N1 work days after the date in D1. .SKIP 1 .INDENT -13 *U IDATE() .SKIP 1 returns the current date as a Julian day. .SKIP 1 .INDENT -13 *U MTXEQ(AA:AA,XX:XX,BB:BB) .SKIP 1 solves equation AX=B where A, X, and B are matrices, and where the notation AA:AA means two cells at the upper left and lower right edges of matrix A (e.g. B2:C3 for the 2 X 2 matrix so defined), and the XX:XX and BB:BB notation means the same for the X and B matrices. .SKIP 1 .INDENT -13 *U MOVEV mtxa,mtxb .SKIP 1 moves values from mtxa to mtxb (useful prior to calling MTXEQ). .SKIP 1 .INDENT -13 *U MDET mtx .SKIP 1 This function computes and returns the determinant of matrix mtx. .SKIP 1 .INDENT -13 *U MPROD A,B,C .SKIP 1 This function will multiply matrix A by matrix B giving matrix C, provided that their dimensions are compatible. .SKIP 1 .INDENT -13 *U MADDV A,B,C .SKIP 1 This function adds matrix A to matrix B and stores in matrix C. All matrices must have the same dimensions. .SKIP 1 .INDENT -13 *U MSUBV A,B,C .SKIP 1 This function subtracts matrix B from matrix A leaving the result in matrix C. .SKIP 1 .INDENT -13 *U MMPYT A,B,C .SKIP 1 This function multiplies matrix A-transpose by matrix B and stores the result in matrix C; dimensions must be compatible. .SKIP 1 .INDENT -13 *U MMPYC A,B,K .SKIP 1 This function multiplies every element of matrix A by constant K. .SKIP 2 .INDENT -13 *U VARY X,A,W,I,P;Q;R;S;T;U;V;W .SKIP 1 (Equation Solving by Iterative Search) .SKIP 1 This function allows AnalytiCalc to automatically search for solutions to equations over up to 8 dimensions. The operation .index Equation Solving .index Goal Seeking .index Solving For Variables is that the accumulators named in the fields shown as P;Q;R;S;T;U;V;W (one to 8 may be specified, only one is required) are varied by a fraction W about their initial values (later scaled down by the gradient of the .index VARY change in X) to attempt to get accumulator or cell X to equal accumulator or cell A. This is done for I iterations, where I is another accumulator. .skip 1 .INDENT -13 *U#XQTCM#command will execute the command (terminated by the end-of-line), with any command except X or K permitted, from inside a cell. This allows command files driven from cells to control moving data, etc. .skip 1 .INDENT -13 *U#STRVL#V1,start;len .skip 1 will return a value that is made from up to 8 characters in the FORMULA of cell V1 (where V1 is .index Formula Value Access .index Sorting .index Sorting, by ASCII any cell name), starting at character "start" and for "len" characters. .skip 1 .INDENT -13 *U#HERE .skip 1 will return the current location on the matrix and the current maximum row and column used. Curr. col, row in T,U and max col, row used in W,Y. .skip 1 .INDENT -13 *U FFTFW and *U FFTRV perform Fast Fourier Transforms in the forward and reverse (inverse) directions on the given range of data. .skip 1 .INDENT -13 *U LINEF Vy:Vy,Vx:Vx (with the Vx range optional) fits a line to the input range. Eqn: y=Ux+T. Err in %. Cor.Coef. in W. .INDENT -13 *XV filename V1 .INDENT -13 *XF filename V1 #######The *X class commands are for sheet linkages. .BREAK *XF loads a Formula from another saved spreadsheet, while *XV loads a Value. .left margin 1 .skip 2 .P The following *U DBxxxxxx functions also exist as commands of form FILxxxxxx with the same results. .skip 2 .left margin 15 .skip 1 .indent -13 *U DBOPINS range filename Open input sequential on filename for cells in range When the input file is open and any operation causes a read of the cell, the FORMULA will be taken from the file and used. If the file is opened with the OPINU option (for Update), then when the FORMULA of the cell is written, it will also write to the file. The OPINU option applies only to random access files. Initially both input and output reads are disabled (ENAINP and ENAOUT enable them). When a sequential file (or device such as a mailbox, pipe, or communications line) is used for input, it is advantageous to read data into a range once, then disable input/output again, to allow it to be handled between these commands. The EDTINP and FMTOUT commands are designed to do this to make it easier to use AnalytiCalc for a filter between sequential files. .skip 1 .indent -13 *U DBOPINR range filename Open input random on filename for cells in range .skip 1 .indent -13 *U DBOPINU range filename Open range for update on filename for read and write as random access. skip 1 .indent -13 *U DBCLSINP Close input .skip 1 .indent -13 *U DBCLSOUT Close output .skip 1 .indent -13 *U DBOPOUTS range filename Open output sequential from range cells to filename .skip 1 .indent -13 *U DBOPOUTR range filename Open output random from range on filename .skip 1 .indent -13 *U DBENAINP Enable input file readin (initially disabled) .skip 1 .indent -13 *U DBENAOUT Enable output write (initially disabled) .skip 1 .indent -13 *U DBDISINP Disable input area readin .skip 1 .indent -13 *U DBDISOUT Disable output write .skip 1 .indent -13 *U DBEDTINP range Enables input and output and, for each cell in the given range, reads and writes the cell, allowing the file read/writes to take effect. Each cell is flagged as valid but of text type; the DF command must be used to reset any that should be treated as computable. Input and output are disabled on completion of the command. .skip 1 .indent -13 *U DBFMTOUT range .indent -13 *U DBVALOUT range Enables input and output and for each cell of the range takes the VALUE of the cell, reads the cell, sets it of text type, and writes the text equivalent of its value to the cell. In the FMTOUT command the cell's display format is used for the conversion. In the VALOUT command a large builtin format is used to preserve all significant digits. Spaces are discarded prior to output. Cells are left containing textual data corresponding to their numeric values, stored in the formulae. The DF command may be used to reset these cells to numeric types if desired. Conversion errors are ignored. Input and output are disabled on completion of the command. .skip 1 .indent -13 *U DBCMPFRM V1:V2[,V3:V4] Compares two formulas. It returns, in the % accumulator, the index of the formula in cell V2 in the formula in cell V1. Lengths used are those of both formulas UNLESS the V3 and V4 cell arguments are seen. In that case the value of V3 will be used as the length of the formula for V1 and the value of V4 will be used as the length of cell V2. If either value in V3 or V4 is outside the range 1 to 109 both values in V3 and V4 will be ignored. Also on output the W accumulator will be set to -1. if V1 is lexically earlier than V2, 0. if they are lexically equal, and +1. if V1 is lexically later than V2. .skip 1 .indent -13 *U DBLENFRM V1:V2 returns the length of the formula for cell V1 in the % accumulator and in cell V2 IF CELL V2 IS VALID. Otherwise the cell specified in V2 is ignored, though it must be present in the command or function. .skip 1 .indent -13 *U DBTRMFRM V1:V2,V3,V4 Reads the formula in V1 and uses V3 and V4 as start and end byte numbers within it. It returns to V2 the formula that is between the start and end bytes, trimming the V1 formula into V2 by chopping out the undesired parts. The find substring function CMPFRM can be used to find delimiter bytes if absolute columnar formatting is not desired. As in all these functions, CMPFRM and LENFRM have the forms .LEFT MARGIN 1 .page .C APPENDIX E .C AUTOMATIC INITIALIZATION .P AnalytiCalc will read SYS$INPUT during setup phases on VAX and then read SYS$COMMAND: for spreadsheet commands ordinarily. It can continue reading SYS$INPUT however, in the "//" mode command entry mode. To get it to do so, just include a _~ character in your title somewhere. It will be replaced by space before use, but flags to stay in SYS$INPUT so your command file can do initializations. .P A prime use of these initializations is to set initial command mode (either a // or a /; command), and to set "accumulator formulas". The formulas A0 through Z0 are scratch formulas, but if special characters are entered as commands, they are transformed modulo 32 into valid codes. A fudge factor is subtracted if the result is over Z. The ASCII code is modified so that the "=" character gets mapped into the T accumulator. By entering the text "L" (without the quotes) into T0, the = key becomes equivalent to the L command (so =C5 as a command goes to cell C5). This sort of thing can allow an installation to tailor some keys to have the same effects as on your favorite CP/M or MS-DOS spreadsheet (assuming you're not already using AnalytiCalc on PC; it has a similar feature and also now has dual modes.) .P The dual modes (// command going to the "mostly command" one, /; to the "mostly entry" one) allow you to enter numbers and text conveniently where that's mostly what you're doing, and to give commands faster (by avoiding the /) where you're mostly issuing commands. The /# command is there to let command procedures use a known environment and work in both cases. This can be convenient. On the PC version, if you're in /; mode and type a command beginning with the / character, a short help message flashes onto the bottom line. On VAX this isn't done. However, on VAX the usual solution is to use the function keys for common commands, so letter commands won't be used often in situations like that. Since each installation controls the keypad definitions (except that PF2 is hardwired as a HELP command), a built-in message seems inappropriate. And the single-character I/O that would be needed to support it is hard on the system. (Be aware that Gold PF2 is also hardwired to be a keypad picture (H9).) .P All told, you'll be able to configure the command language of AnalytiCalc considerably by tailoring the .CMD files called by keypad keys and by setting up the A0 to Z0 formulas to match desired special keys or letters to functions of your choice. (Letters not otherwise used can also be remapped. Thus, for example, Y is not a command starter so if the Y0 accumulator gets some text, that text will be inserted at the front of the command line and the command executed (if legal). Several letters like B, Q, and Y exist that are free. Other accumulators can be used via special characters like the = sign. A bit of experimentation will allow you to find which are which. .P For communication to other programs, consider the DIFDB or DIFRW programs also. These convert between saved AnalytiCalc files and DIF files, or DTR-usable data files, and DIFDB can be used for some exotic sheet combine and re-sort applications. If the DIF format is inconvenient, the format of an AnalytiCalc saved sheet is described in another document in the AnalytiCalc kit. .P I hope you enjoy AnalytiCalc. If anyone makes a modification and/or improvement to it, or moves it to a new system, the author would appreciate a machine readable copy. Send to Glenn Everhart, 409 High St., Mt. Holly, NJ 08060. Thanks. .page .c INDEX .print index .page \~