	PortaCalc

	Brought to you courtesy of

	Glenn Everhart
	409 High St.
	Mt. Holly, NJ. 08060 USA
	609-261-3709

ABSTRACT:
	The PortaCalc spreadsheet is a FORTRAN written program able to
perform the usual "what if" types of calculations for anyone with a
compiler, 31KW of task space (more or less), and (in the present
version) an ANSI 3.64 terminal (e.g. VT100). The program is easily
recustomized for other terminals and designed for portability and
functionality. A data management system interface is built in, permitting
spreadsheets to access a potentially unlimited number of files and
records or parts of records in those files for user defined functions,
numbers, formulas, text, or whatnot. In fact it has many of the attributes
of a language.
	Three versions are provided, with complete source code for
all: a PDP11 version for I/D space machines that builds flat under
RSX11M+, an overlaid version for other mapped PDP11's under regular
RSX (11M or 11D/IAS), and a version for VAX that builds (flat of
course) under VMS. I assume the F77 compiler but the program is in
Fortran 66 (I use the /NOF77 switch). It is expected only minor changes
would be needed for the DEC Fortran IV compiler however.
	A separate graphics output task is documented in PCG.DOC
and provides histograms or scatterplots of any areas of the saved
spread sheets with a simple command syntax.

RESTRICTION:
	The overlaid version provides only a rather small spreadsheet,
though it is large enough to be useful in many applications. There are
some overlay tricks I haven't tried to increase the size.

BUILD:
	There are 4 build files.
	COMPIL.COM	Build for Vax/vms...only compiles. Concatinate
			the objects and link.
	MAKE.CMD	Non-overlay I/D space build for RSX11M+ V2
			(uses F77 Compiler in non-F77 mode)
	OMAKE.CMD	Overlay build. Medium sized overlay, small
			sheet. For 11M systems, any 11.
	SOMAKE.CMD	More compact overlay structure, bigger sheet.
			OK for any 11, RSX11M/M+.
Note: THERE ARE COMPILER WARNINGS (ABOUT FUNCTION "INDEX") WHICH SHOULD
	BE IGNORED DURING THE BUILDS.
		I ASSUME FORTRAN 77 IS INSTALLED AS ...F4P.
WRITEUP:


	This is a spreadsheet written in Fortran (the only universal
assembler) for portability. Its functions are described in the separate
document file; it assumes VT100, but the UVT100 routines are the
only places the VT100 is actually handled in screen mode, and may be
altered for other machines.
	The spreadsheet sizes may be defined by editing the parameter
file Vklugprm.ftn (caveats and restrictions are listed there). There
are 2 sheets -- a big physical sheet and a small display sheet which
is what's really shown on screen. Sheets may be saved/merged/restored/
linked (via saved files)/printed or hardcopy made onto files. Numerous
other functions exist. The thing is built with I/D space here but
ought to be able to be overlaid. Specifically, CALC and its routines
can be diskbased overlays, and DSPSHT should be able to be another leaf.
However this is not tested. You can tailor the size by editing physical sheet
size.

	WHEN BUILDING PORTACALC, YOU MAY ENCOUNTER FORTRAN WARNINGS
ABOUT THE INDEX FUNCTION BEING ASSUMED USER SUPPLIED. IGNORE THESE;
THERE IS AN INDEX FUNCTION SUPPLIED HERE, AND THE WARNINGS ARE OF
NO CONSEQUENCE, EITHER ON PDP11 OR VAX.

	The program has been tried overlaid. However, if you use the
module OXQTCMD instead of XQTCMD and OSPREDSHT instead of SPREDSHT, an
overlay structure could be used roughly like this:

	Root: Spredsht,Index, all commons, UVT100, VARSCN
		Leaf 1: XQTCMD
		Leaf 2: RECALC, CALC, and all subroutines of CALC
		Leaf 3: DSPSHT

	The subroutines of Calc may be possible to overlay so that
Leaf 2 (which will likely be the largest) can be shrunk. You will want
to edit Vklugprm.ftn to make a sheet the size you like. If it gets
bigger than rather small, you will possibly have to use virtual arrays
or some other trick. By the next DECUS symposium there may be a better
version or one that will work on smaller systems completely defined,
but you may be able to fit this on a small system by overlays. On a
VAX of course it all builds flat with as large a sheet as you like.

	REVISION:
	There are 2 ODL files, either of which can build a reduced
version when the fortran files are compiled with OVKLUGPRM.FTN
renamed to VKLUGPRM.FTN, included. There is a bit of extra space
so the parameters in that file can be enlarged somewhat. They use a
very overlain FCS and F4P OTS. You may be able to do similar things
clustering an FCSRES and a F4PRES together too. However, the overlay
versions (made with the OMAKE.CMD file) do work, though more slowly
than the I/D space one. This at least gets you something on a machine
with only normal 11/34 type resources. I assume the F4P or F77 compiler
here for the OTS part. You will need to tailor to other Fortran
compilers on PDP11's yourself.

		NOTE:
	If you get this program working on a non-PDP11, non-
VAX, the author would appreciate a (machine readable) copy of
the modified version.

BUGS:
	The functions here are mostly tested, but some bugs may remain.
	Fortran formats are used and any format entered will be used.
If you put something in that Fortran can't understand, you lose.
Conversely, you can use things like O or Z formats for octal/hex
or whatever you like. Formats A and L by themselves mean "display the
formula itself"; anything else means "display the number". On entering
numbers, any formula containing the characters ".","[","+", or "-" is
treated as a numeric; anything else is treated as a formula. The DF
command can fix up this if it's not what you want. Note too that the
multi-argument functions:
	SUM[args]	Sum
	MAX[args]	Maximum
	MIN[args]	Minimum
	AVG[args]	Average
	STD[args]	Standard Deviation
and the statement
	IF [v1.RL.v2]true-statement|false-statement
must appear at the start of a formula or formula substatement (substate-
ments are delimited by \ characters) and the value goes into the
current variable cell (which is universally named P## if you want something
location independent). It's a good idea to include an else statement in
IFs since something gets put in otherwise.
			Glenn Everhart
