PortaCalc (AnalytiCalc) Tutorial Using a spreadsheet is not always easy the first time, and the AnalytiCalc spreadsheet is no exception to this. With a little practice, however, it's possible to become proficient in using its basic commands. This tutorial is dedicated to giving you some practice with a simple problem of wage calculations using AnalytiCalc which will lead to some facility using it. We will assume AnalytiCalc is already installed on your computer and that it may be started by giving a command "PC" at a terminal. We will also assume the version of AnalytiCalc that is run in this way is appropriate to the kind of terminal you have. Since the display can vary a little, we'll assume a VT100 terminal in the example following, but other sorts of terminals can be used. You should be aware, however, that while the arrow keys work correctly on VT100 and VT52 (or Z19/Z89) terminals, they may not on others and you'll have to use the commands 1-4 for cursor motion there. Now let's consider the problem: Assume you're a group leader in a company and want to be able to print out your total labor costs per week for a group of a dozen or so employees. You know the labor costs per hour for each employee and the number of hours worked on this particular group's work by that employee that week. You want to have a total cost for each employee, and an overall total cost per week. You'll enter the hours worked, and the labor cost, and get the total. Then you'll print it out. To generate this figure, we'll have to design a simple sheet and print it when filled in. So let's get into the spreadsheet now to do so. Remember that in all commands (except direction arrows) you must type a RETURN after the command to complete it. This is not specially illustrated in the examples here but is always necessary, just as it is for most other commands you give to the computer. Until you press RETURN, you can use the DEL key to wipe out characters or the Control-U key to erase the line (standard line editing characters). You type: PC (or whatever starts AnalytiCalc up) The sheet will load and print its first screen, announcing its presence and authors, and will ask a few preliminary questions. The first of these questions is: Enter new numeric format default [Y/N]: The default format is F9.2, which is FORTRAN-ese for floating point numbers with 9 total digits displayed and 2 decimal points (appropriate to use for dollars and cents). This is likely to be OK for this project. If we wanted, let us say, 10 digits total (counting the decimal point) with one number to the right of the decimal, a format like F10.1 could be used. But we won't do that here. (Numbers are kept to 17 digits precision internally; we're only talking about how much is shown of that.) So we reply. Type: N AnalytiCalc will then ask for a title: Enter Title of Spreadsheet> This is just a title, any 80 characters or less. You can put in any desired text here and it will appear at the top line of the screen and of any printouts of the screen you make later. Just enter a descriptive phrase: Weekly Labor Expenses Summary The PDP11 or PC version of AnalytiCalc will now ask some questions about storage allocation. Tell the program you expect to use about 10 columns and 20 rows and, when it asks for sizes of disk files to use, use its recommended numbers (or a bit more) on the PDP11. On the PC version you can tell it to use 1K disk files (which will keep it from allocating disk storage) for this tutorial. The VAX version will not need these inputs. You now have a screen which displays something like 7 columns and 20 rows, with the columns labelled (initially) A, B, C, D, etc., and the rows labelled 1 through 20. Your sheet is normally larger and not all of it fits on the display at once. Thus, you can move around it and see parts initially not obvious to you. In each cell (row-column intersection) of the sheet (and the screen), you can put a formula, a number, or text. A cursor (a reverse video block) will move around the screen indicating the present active location. When you enter this information, it goes into the cell pointed to by this cursor. Move the cursor around by using the arrow keys. Note the cursor moves in the direction of the arrow keys so long as it can while staying on the screen. If you want to move past the edge of the screen, you do it with a different command. The screen cells are called by the column letter and row number, using names like A1, B5, R3, A18, or others. The next column after Z is AA, then AB, and so on. There is no logical limit to the number of columns, but there is an installed limit, generally 10000 for PDP11, 18,000 for PC, and 32,000 for VAX. If you want to see, let us say, columns L through R, you use the command: OA L1 which resets the screen to make L1 appear at its upper right. Any cell can be made the upper right. (Actually, every cell displayed can point to an independent part of the worksheet, but we won't do that here.) Now to return the display to the initial one (the upper left part of the entire sheet), issue the command OA A1 and things will be replaced. To move the cursor to the upper left cell, also issue the command L A1 which moves the cursor to cell A1 (and this command can move the cursor directly to any named cell, EVEN IF THAT CELL IS NOT CURRENTLY BEING DISPLAYED, though if it isn't displayed you can't see its' value). You'll note the commands are always entered on the next to last line on the screen, and the last line has some mysterious contents so far. The last line actually always displays the formula or text in the current cell. Now that you've seen the way we move a cursor around, we must design the spreadsheet screen we'll use to work your problem. Let's have 8 columns which we'll label EMP NO, RATE, MON, TUE, WED, THU, FRI, and TOTAL. The "EMP-NO" columnn will just have and employee number (for identification), the RATE colunm will have rate per hour for this employee, and the MON-FRI entries will have hours worked those days. The TOTAL column will then be the product RATE*(MON+TUE+WED+THU+FRI). To enter this information, we need to set our screen up to display 8 columns, 20 rows. We also want (let's say) only 8 characters wide in column 1 and only 8 in column 2, 3, and 4, and the rest stay as they are (default width 10). First set up for 8 columns, 20 rows: DB 8,20 Now set up the columns to all have 8 characters. Type S The program will reply Alter Display Windows [Y/N]: Reply Y since we want to change widths for all columns. The program says ENTER NEW GLOBAL COLUMN WIDTH, 1-120: We enter 8 We could set the widths individually with the DW command. For instance, to set the third display column to a width of 9, the command is DW 3,9 The program now asks: Reset display to Upper Left of sheet [Y/N]: We reply N to skip that step. The program now asks whether we want a different default format. Since the old default, F9.2, is 9 characters wide, we do want to change it, so the question and our reply look like this: Enter new floating numeric format default [Y/N]:Y The program now asks for a new format default. We will use a display of 7 digits wide, 2 decimal places, which is expressed as F7.2 here. The question and answer look like this: Enter new format. Suggest F10.2>F7.2 (Note that we could use the DF command to set the default format. The command to set cells D2 through D14 to the F7.2 format would be: DF D2:D14 [F7.2] but that is unnecessary now.) The program now asks us for the title again. Enter the title as before. Now the screen has the widths we want. Enter the labels. Since we're already at the top left, just start: Type: E EMP NO which will leave column A1 showing the text EMP NO and this will appear at the bottom of page. Now use the right arrow to go to cell A2 and type: E RATE which should leave cell B1 containing the text RATE Now move the cursor to cell C1 with the arrow keys (you can use the 3 command instead if need be). Moving the cursor this way is tedious where there's a lot to enter, so let's set the program to do it automatically. Since the commands 1, 2, 3, and 4 mean also to move up, down, left, or right (which makes sense on a VT100 keypad since the layout of the arrow keys is in that order there), we'll use the command M4 to set the program to move right automatically after an enter. Type the command: M4 To avoid scrolling off the screen type the command also NS Now go ahead and type commands: E MON E TUE E WED E THU E FRI E TOTAL You notice the top row is now full of label information and the cursor should now be sitting at cell H1 on the TOTAL column (since the auto move can't change the settings of what is to be displayed on the screen). At this point, we can move down and enter the one formula we need for each employee. Type the command: L H2 to move to cell H2 (which will be the first numeric total area below the label). Enter the desired formula now. We use normal parenthesized expressions, with cell names representing values there. Thus, the formula will look like this: Type: E B2*(C2+D2+E2+F2+G2) Notice that a 0.00 appears rather than the formula, though the last line shows the formula. This means that AnalytiCalc knows it was a formula or number rather than text. Its' rule for this is that if what's entered contains any of the characters ".", "+", "-", "(", or "[", it's numeric and gets displayed with the default format (unless the format is changed with the DF command) and otherwise it's text. If what you enter has any of these characters in it, you can force it to be text by including a '"' character in the text somewhere (usually after a lot of spaces so it won't show on a display). (This formula could be written as B2*SUM[C2:G2] also.) You now have the formula on the first of the individual total lines, but you need to enter one like it on lines H3 through H14 (since there are a dozen names on the list). Fortunately, you needn't retype the formula. We'll copy it and relocate all entries. Since entries aren't relocated above or to the left of the cursor, do it while at A1 so all numbers get relocated. Type the following commands: L A1 CR H2 H3:H14 V This moves you to A1, then copies H2 to the range H3 through H14 inclusive with Relocation (changes all B2, C2, D2, ... to B3, C3, D3, ... and so on). The V command redraws the screen, since AnalytiCalc will avoid redrawing cells whose value didn't change (and these cells' values didn't just yet). Now you need a total for all of them. Let's make cell A15 be the label for the grand total and put the text "ALL" in it, and make cell H15 have the sum of H2 through H14. Type the following to arrange this: L A15 E ALL L H15 E SUM[H2:H14] Note that the SUM function greatly simplifies entering the sum of a whole column (potentially, it simplifies sums of rows too). We could have used it in the initial formula by making a multiple statement formula in row 2 which would have been like this: SUM[C2:G2]\%*B2 in which the "%" refers to "the result of the previous computation". This style of multiple statement formulas can save numerous cells and is the easy way to write formulas. The "\" character delimits statements. We can also express this thought as a formula like SUM[C2:G2]*B2, but often formulas will be clearer when expressed as several computations in sequence. Now we have a complete set of formulas on the screen and are ready to start entering data. Enter a few dummy employees information to see how the computation goes. Notice that the totals are updated at every entry. (From this point, it's simple). Enter commands as follows: (NOT the parenthesized comments) L A2 E 11111 E 12.55 ($12.55/hr) E 7.5 (hrs Monday) E 8.0 (Hrs Tuesday. Note the required ".".) E 8.0 E 8.3 (Hrs Thursday) E 8.0 (Hrs Friday) L A3 E 12222 (Emp # 12222) E 17.50 E 8.0 E 8.0 E 8.0 E 7.5 E 8.0 By now, you notice something: most of the hours worked are 8.0 per day, with occasional exceptions. Your life would be easier if you could just fix the exceptions and enter the 8.0 entries en masse. This isn't too hard. Use the following commands to enter 8.0 in all remaining hour fields (columns C through G, rows 3 through 14): L C4 (Move to cell C4, the first to set) E 8.0 (Enter desired value) CA C4 D4:G4 (Copy so now C4 through G4 have 8.0) It isn't necessary to fill in the entire region by hand. Type PF1, then keypad 9 to activate the copy cell to region command. It asks for the start cell of the row. Reply C4. It then asks for the end cell of the row. We're copying C4 to a region of which it is the top left entry here, and the top row is defined as C4 to G4. Therefore the end cell of the top row is G4. Reply G4. The program now asks for the Bottom Left of Left Column. We want to enter 8.00 in all cells down to C14 through G14, so the bottom of the left column of the region is C14. Reply C14. The program will now copy the cell to the whole region while you watch. Now the cells all contain the 8.0 entries desired and we can fill in the rest of the desired data. Since we can do this moving vertically, enter a command to move down on enter: M2 Now go to cell A4 and enter the remaining employee numbers: L A4 E 13300 E 14400 E 15500 E 16600 E 17700 E 18800 E 19900 E 19911 E 19922 E 19933 E 19944 Now these cells are set up. We need only fill in rates and the entire sheet will be set up properly: L B4 E 11.56 E 12.0 E 21.4 E 8.55 E 15.32 E 16.0 E 17. E 6.78 E 17.35 E 22.50 E 24.35 We now have a full screen and the TOTAL column shows labor costs as desired. Suppose the last employee only worked 7 hours on the Thursday: We now just go to that cell and change the value: L E14 E 7.0 Now the sheet is updated. You now will probably want to print this to get a hard copy. To do so, just type W AnalytiCalc will reply with the request: Enter print file spec., / after to omit borders> Give the name of a suitable file on disk or a printer that your system understands. A suitable reply for PDP11 would be just LP: which will print the sheet. For VAX try LPA0: (or whatever your printer is called). The program will churn for a few seconds and your printout will be on the printer, a copy of what's on the screen (with some extensions: if on VAX you tell it to display 50 rows, they won't be able to be on the screen, but they'll print). Since you may need this next week too, with some mods for hours, it's a good idea to save the sheet. Here's how that would look to save the sheet all in a file called WKLYHRS.PCC L A1 PPX Enter filename>WKLYHRS.PCC Enter max displ down to save or 0>0 Enter max displ right to save or 0>0 (This includes AnalytiCalc prompts too: you enter the filename and the zeroes (meaning the whole sheet) to save it all.) Now just for fun, let's try this again. Use the X command to exit. (Reply Y to the question that asks if you really mean it.) X Now run through the initial PCC load again and get another blank spreadsheet screen again. We'll load the saved one in. Now we will assume you are sitting with the cursor on cell A1. First we have to set up the screen as before: L A1 DB 8,20 DW 1,8 DW 2,8 DW 3,8 DW 4,8 Now we load the saved sheet into memory. GP Enter filename>WKLYHRS.PCC Enter max displ down to restore or 0>0 Enter max displ right to restore or 0>0 Enter min displ down>1 Enter min displ right>1 The program will churn awhile and your original screen will reappear. Note the prompts allow you to save or restore any rectangular region. Saving and restoring are done relative to the cursor, so start from A1 always unless you are merging multiple sheets into one larger one. In that case, beware of formula changes too. (There is another way to write formulas, using relocatable cell numbers of form P#col#row or D#col#row which can be freely moved; see the manual for its use.) Notice the display formats were saved and restored. Now that you have your saved sheet in memory, suppose someone has been hired into your group and you need to add another line to your list. This isn't too hard. You use the AR command to add 1 row with formula relocation. If we want the line to go in above row 14, the way the commands look is thus: L A14 AR 1R Now you'll notice that row 14 and row 15 are identical and the same as the old row 14. What's happened is that row 14 was moved down, so what was row 14 is now row 15, and row 14 is free to use. However, since it still contains its' old contents, we can use the fact that all the 8.0 entries and formula entries are there and correct, and just set up the new employee number and rate, and we're done. The commands to do this might look like: L A14 E 23541 L B14 E 12.75 ($12.75/hr for this employee) so now the sheet is again correct (apart from changes from the 8 hour daily hours anywhere). If this sheet is to be saved, another PP is needed. To exit, type X which exits from the sheet. Additional pre-exit operation: Suppose you want a report that won't show the RATE column directly. This can be arranged by just setting up a screen display that does not contain the B column. This is easiest to set up with the OR command, which sets up what part of the screen is displayed from the cursor down and right. We have to reset column widths of column 2 also, so it will be 10 again. The commands to set the screen up are like these: OA A1 DB 7,20 (We only need 7 columns) L B1 (Move to 2nd column) OR C1 (Set so we see column C there instead) The screen now shows colunns A, C, D, E, F, G, and H and may be printed with the W command as it appears. Note that 20 rows will appear. Had we wanted to see only the 15 or 16 rows filled in, we would have used a command like DB 7,16 above. Had we wanted not to have row and column letters and numbers on the printout, using a / after the name of the file in the W command does this. The file, if it goes to disk, may be edited by any system editor or word processor, however. For further instruction and commands, the system help command is invoked by typing H (optionally followed by a digit 0 through 9). The PF2 key on VT100 (or grey on VT52) is also equivalent to the Help 0 command. Most commands are briefly described in help pages. The system manual is in a form to be easily turned into a system help file for VMS or RSX and is likely to be available as a help command. It contains further descriptions of commands available. You will find that PF1 is in general treated as a "GOLD" key (a shift key) and Gold PF2 will display a keypad diagram for the auxiliary keypad of VT100. There is an alternate keypad function set which should be examined. If your version of AnalytiCalc supports it, the H9 command will display a diagram of the functions available via the auxiliary keypad on the screen. Just type H9 and the picture will appear if available. If it isn't, and you have a VT52 or VT100, let your system manager know you want it. For other terminals, it isn't always available. GLOSSARY The following commands are used here: Command Means L cell Locate cursor at cell OA cell Origin Absolute - make cell be upper left corner of display OR cell Origin Relative - make cell be where cursor is (i.e., relative to cursor) DB ncol,nrow Display Bounds - make display have ncol columns and nrow rows on screen DW col,width Display Width - Set display column "col" to width characters wide. Use the numeric display column numbers at top of screen to specify column on display. DF cell-range [format] - Display Format - set cell range to have display format for numbers. Any FORTRAN format is legal (up to 9 characters of format spec.) and if just [A] is specified, cell displays formula text entered in it, not number. Cell range can be 1 cell name or 2 cells separated by colon (e.g., B2:G2). Ranges must lie in a row or column. E text Enter - Enters text into a spreadsheet cell. If the text includes ", or does not contain one or more of ".", "(", "+", "-", or "[", then it is treated as TEXT and the text is displayed. Otherwise it is treated as numeric and the numeric value is displayed. The DF command changes which is shown. Numbers MUST contain . characters to be handled correctly. V View - Redraws screen, forcing display to be correct. R Recalculate - recomputes sheet. (Normally not needed since recomputation is automatic. Best to issue this command as RXF to speed it up.) Mn Auto Move in direction n, where n=1,2,3, or 4 for up, down, left, or right (M5 means no auto motion), AFTER ENTER. This sets up automatic motion after Enter commands. 1,2,3, or 4 Move cursor immediately: or arrow keys Move immediately in the arrow direction or in direction up, down, left, or right respectively for 1 through 4. W Write - Writes out screen contents to a file or device (e.g., the printer) on your system. Produces human readable files, suitable for editing into documents. PPX Put Physical Symbolic - Saves spreadsheet info in a special format for later read-in, saving all formulas. (Note PPN saves numbers only (for graphs) and throws out formulas.) Saves down and right from cursor, amount saved depends on your command. Files are ASCII but not intended to be read by humans. PDX saves display sheet within bounds, not taking bounds or save order from physical sheet but from how it's rearranged on display screen. Either form can be restored either way. GP Get Physical - Reloads special file from a Put command into current sheet starting at cursor and going down and right. An offset from original save may be specified in both horizontal and vertical directions and partial restores are possible. This permits merging sheets. Hn Help - Puts up help pages. There are 10 pages of online help, numbered 0 through 9. H8 brings up page 8, H0 (or just H) brings up page 0 which is an index into the rest. PF2 on VT100's acts as a H command. You may issue further Help commands once in the help system. A return will return you to the sheet. X Exit from the sheet.