^^ .TITLE AnalytiCalc (PortaCalc) Reference Manual .COMMENT .PAPER SIZE 60,60 .PAPER SIZE 80,80 .SPACING 1 ^^ .LEFT MARGIN 1 .RIGHT MARGIN 80 .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 72 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.) .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. .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. .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 .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-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. .P 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.) .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. .P Now back to the workfile (old) 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. .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> .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. .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. .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. .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 suppresss 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 .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 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 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. RND[DUM] Generates a random number between 0. and 1.0. An argument is needed but it is NOT touched by this function. .INDEX Random numbers .Index RND function .END LITERAL In the first 5 cases, 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 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 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. 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. 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. 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. Note that other financial functions like PMT may be easily obtained by simple cell programs. 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. 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 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. .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 +. .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. .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.) .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. .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. .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 .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. .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 NUMERICALLY (see PPN command below) starting at the upper left (i.e., cell A1) as would be the convention for using with PCGRAF (see PCG.DOC). .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, the command form is .BREAK *XF filename V1 .BREAK 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. .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. .INDENT -1 3 RECALCULATE .LITERAL RECALCULATE R Recalculate all of the sheet. RM Recalculate manually only until R command given RAF Recalculate sheet, without constant recalculation RF Recalculate, Force constant recalculation. .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. 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.) 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. .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. .INDENT -1 3 EXIT .LITERAL EXIT X Exit to operating system. XD Exit to operating system after deleting random access scratch file used to hold spreadsheet formulas/numbers/formats .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. The XD command cleans the random access file up first, but does not ask a confirmation. You should use the PP or PD command to save your sheet prior to XD 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 In general, the larger your maximum sheet size, the more useful the XD command is; the random file has your sheet, but (likely) a .index SAVE lot of blank entries. The files created by PP/PD commands also have the sheet, but only entries that were in use. They are usually much shorter than the random file was. 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. .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 1 .INDENT -1 3 FORMULA_SEARCH .INDENT -1 .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 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. .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.) 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 @KYP, @KYR, and @KYS commands, which will use 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 OA 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. .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. .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. .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 .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 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. .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. .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. .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. BE SURE YOU DO THE REPOSITION IF YOU USE THE CR COMMAND!!!!!!! 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. .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. .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 1 .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. .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). .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 and OR 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. .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. .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 about 60 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. .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. .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. .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. .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. .INDENT -1 3 SAVING__SHEET .LITERAL SAVING YOUR SPREADSHEET PD Put out current Display sheet (Formulas) PP Put out current Physical sheet (Formulas) PDN Put out current Display sheet (Numbers) PPN Put out current Physical sheet (Numbers) S Save work file, allow you to use a new one (in nonworkfile versions, S allows reset of title without disturbing the sheet.) .END LITERAL .P 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 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 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. .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. .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. .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. REMEMBER: THE LOW OFFSET SHOULD BE 1 OR LARGER, NOT 0. 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. .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. .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). .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. .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. .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. .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" 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.) .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 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 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. 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. .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 %. .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 .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. .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. .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). .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. .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 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 the most capable AnalytiCalcs. 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 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. Several additional functions exist in the larger versions of USRFCT, the largest of which is designed for use with VAX due to space limitations on PDP11. .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 The next functions are implemented in the largest of the USRFCT routines, and presently are limited to VAX implementations, in which they are .index Matrix Algebra present by default unless the build files are changed. .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. Note this and later functions may be available only on VAX versions of AnalytiCalc. .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. .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. .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. .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. .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 (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. .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 VERSION 1.0 .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 a few additions however. .P First, 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. .SKIP 4 .INDENT -1 2 GRAPHICS ^^ .C PCC GRAF .SKIP 1 .C GRAPHICS INTERFACE AND OUTPUT FROM PCC SPREADSHEET .C GLENN EVERHART, 23-JUL-84 .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 (numerically saved, that is) sheet which has been saved via the 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. .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 PPN Put out physical sheet numerically. .END LITERAL When AnalytiCalc asks for a filename, give one which describes your file well (with a file type) followed by return. Example: Myfile.num .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.num 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.num 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 speciciation (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 NOTE: (V1B): .BREAK No switches are currently implemented. 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 INDEX .print index