Formula.spl contains functions for writing Worksheet formulae, labels, and comments to ASCII text files, as well as reading them from one of these files back into a Worksheet.
READ AND WRITE FORMULAS
FORMREAD - Reads one Worksheet formula from file
FORMREADALL - Reads all Worksheet formulae from file
FORMWRITE - Writes Worksheet formulae to file
READ AND WRITE FORMULAS, LABELS, AND COMMENTS
WINREAD - Reads one Worksheet formula and label from file
WINREADALL - Reads all formulae and labels from file
WINWRITE - Writes Worksheet formulae and labels to file
Reads one of the formulae from an ASCII file into a Window in the current Worksheet.
FORMREAD(fname, fln, dwn)
fname - A string. The source filename.
fln - Optional. An integer, the line number in the file from which to retrieve formula. Defaults to 1.
dwn - Optional. An integer, the destination window number. Defaults to current Window.
Nothing.
formread('wrksht.for',5,3)
retrieves the formula from the 5th line of wrksht.for and puts into Window 3.
Due to limitations in the SETWFORM function, no Dataset references can be read into a Worksheet. The file must be in a format similar to that produced by FORMWRITE, where the line to be read in has a label, followed by a space, followed by the Window formula.
FORMREADALL
FORMWRITE
WINREAD
WINREADALL
WINWRITE
Reads as many of the formulae from an ASCII file as possible into Windows in the current Worksheet.
FORMREADALL(fname, fln)
fname - A string. The source filename.
tnl - An integer. The total number of formulas in the file.
Nothing.
formreadall('wrksht.for',5)
retrieves the five formulae from wrksht.for and puts into five Windows in the Worksheet.
FORMREADALL reads in as many lines as there are windows in the Worksheet. Due to limitations in the SETWFORM function, no Dataset references can be read into a Worksheet. The file must be in a format similar to that produced by FORMWRITE, where the line to be read in has a label, followed by a space, followed by the Window formula. The first line in the file must contain the first Window formula.
If comments have been added to the top of the file, you can use the file line offset parameter with a value of greater than 1. If the file is unmodified from a FORMWRITE, or if the first formula is on the first line, the file line offset should be used with a value of 1.
FORMREAD
FORMWRITE
WINREAD
WINREADALL
WINWRITE
Writes all the formulas of the current Worksheet to a file.
FORMWRITE("fname")
fname - A string. The destination filename.
Nothing.
formwrite("mywork.for")
writes all the formula from the current Worksheet into the ASCII file: mywork.for.
In the file, each formula is on a separate line and is preceded by its Window number. If a file already exists with same name, FORMWRITE overwrites the file without warning.
FORMREAD
FORMREADALL
WINREAD
WINREADALL
WINWRITE
Reads a formula, label, and comment from an ASCII file into a Window in the current Worksheet.
WINREAD(fname, fln, dwn)
fname - A string. The source filename.
fln - An integer. The line number in the file at which to start reading.
dwn - The destination window number.
Nothing.
winread('wrksht.win',15,3)
retrieves the formula from the 15th line of wrksht.win and puts into Window 3. Then it reads the label from the 16th line and sets it (on Window 3), then reads the comment from the 17th line, and sets it.
WINREAD reads the formula, label, and comment from a file and puts them into a Window. Due to limitations in the SETWFORM function, no Dataset references can be read into the formula. The file must be in a format similar to that produced by WINWRITE, where the block of three lines to be read in has the following Syntax: the first line has a label, followed by a space, followed by the Window formula; the second line has 4 spaces, followed by the Window label; and the third line has 4 spaces, followed by the Window comment.
FORMREAD
FORMREADALL
FORMWRITE
WINREADALL
WINWRITE
Reads as many of the formulae from an ASCII file as possible into the current Worksheet.
WINREADALL(fname, fln, nforms)
fname - A string. The source filename.
fln - An integer. The starting line number in the file from which to retrieve formulas.
nforms - An integer. The total number of Window formulas in the file.
Nothing.
winreadall('wrksht.for',1,5)
retrieves the five formulae from wrksht.for starting from the first line in the file, and puts into five Windows in the Worksheet.
WINREADALL reads enough formulas, labels, and comments from a file to fill up the current Worksheet. Due to limitations in the SETWFORM function, no Dataset references can be read into the formula.
The file must be in a format similar to that produced by WINWRITE, where each block of three lines to be read in has the following Syntax: the first line has a label, followed by a space, followed by the Window formula; the second line has 4 spaces, followed by the Window label; and the third line has 4 spaces, followed by the Window comment.
If comments have been added to the top of the file, use the file line offset parameter with a value of greater than 1; if the file is unmodified from a WINWRITE or if the first formula is on the first line, the file line offset should be used with a value of 1.
WINREADALL reads in as many blocks of three lines as there are Windows in the Worksheet.
FORMREAD
FORMREADALL
FORMWRITE
WINREAD
WINWRITE
Writes all the Window formulas, labels, and comments from the current Worksheet to a file.
WINWRITE("fname")
fname - A string. The destination filename.
Nothing.
winwrite("mywork.for")
writes all the formula from the current Worksheet into the ASCII file: mywork.for.
WINWRITE writes the formula, label, and comment of all the Windows of the current worksheet to a file. In the file, three lines are output for each window. The first line contains the window number and the formula. The second line contains the Window's label. The third line contains the Window's comment.
If a file already exists with same name before WINWRITE, it is overwritten without warning.
FORMREAD
FORMREADALL
FORMWRITE
WINREAD
WINREADALL