Prec.Bas prec.BasNiv. sup.

10.3 Further notes 

This section contains further information about certain functions or function groups.
FAC works for negative values, also. FAC(n) is defined as n(n - 1)(n - 2) . . . 1 for positive, and n(n + 1)(n + 2) . . . (-1) for negative integers. FAC(0) is 1, as usual.
RANDOM If you invoke RANDOM without arguments, ie. something like
 ASET A=RANDOM
it will return a real value in the interval [0.0,1.0]. If you invoke it with an integer number n as parameter, as in
 ASET A=RANDOM(1000)
several cases are possible:

n <= 0 RANDOM always returns zero
0 < n < 65536RANDOM returns a pseudo random number in the integer interval [0,65534]
n > 65535 RANDOM works as if RANDOM(65535) were invoked
DIR, DFREE, DSIZE, LABEL do all accept a drive specification as their argument. They are implemented in a rather tolerant way. Each of them accepts not only arguments like 'a', 'B', or 'C:', but also paths, like 'E:\FOO\SILLY.DAT'.
UNIQUE generates a non-existing filename for a given directory. The name does have the format

dddddddd.TMP

where each d is a randomly chosen decimal digit. That means that

61524212.TMP

is one possible unique name. After one name is created, UNIQUE checks if it already exists (by trying to open it for reading). If it fails, the name is ok. Otherwise the procedure is repeated. If UNIQUE fails to generate a non-existing file name 10 times, it aborts and returns '?'.

BUFFERS, COUNTRY, DEVICE, FCBX, FCBY, FILES, LASTDRIVE, SHELL, STACKX, STACKY read CONFIG.SYS, as you probably already know. The question is, how they find it. First they determine the boot drive by a DOS operation. This requires DOS 4.0 or above. If they fail to find CONFIG.SYS there (eg. because DOS 3.3 is used), they give 'C:\CONFIG.SYS' a try (because most systems boot from C:). If this also fails, they abort and return a default value, which is as follows (from my DOS 3.30 manual):

BUFFERS 15 if memory>521k, which is assumed
COUNTRY 001
DEVICE returns 0 if failure or device not found
FCBX 4
FCBY 0
FILES 8
LASTDRIVEE
SHELL see below
STACKY 9
STACKY 128
SHELL This function is treated separately to explain its algorithm. SHELL does first, as any other CONFIG.SYS function, try to locate a SHELL= line in CONFIG.SYS (see above for details). If it fails, it determines the boot drive (which needs DOS 4.0 or above). If it succeeds, 'd:\COMMAND.COM' is returned (with d being the boot drive), otherwise '?:\COMMAND.COM' is returned.
CONCAT You might ask yourself, why this function is implemented where the '+' operator performs the same task. The answer is that '+' cannot be used to concat string which represent numbers. In this special case the arguments are interpreted as numbers and ADDED, not concatenated! CONCAT however does interpret its aruments never as numbers.
GETKEY can also read function keys, because they are passed to ASET as two keystrokes, ascii 0 + ascii code. GETKEY simply ignores the 0, because it cannot belong to the key set, and interprets code as if it had been entered alone. This implies, that you can install GETKEY so that it can react on function keys, using the following replacements:

Key Char after #0Code of char
F1 ; 59
F2 < 60 *
F3 = 61
F4 > 62 *
F5 ? 63
F6 @ 64
F7 A 65
F8 B 66
F9 C 67
F10 D 68
LEFT K 75
RIGHT M 77
UP H 72
DOWN P 80
PAGE UP I 73
PAGE DOWNQ 81
INS R 82
DEL S 83
POS 1 G 71
END O 79

There's a problem with the two codes marked with '*', because the chars '>' and '<' are interpreted by DOS. You will be able to use these only if your shell has a possibility to pass them to programs.

Example: The following call

 ASET A = GETKEY('KMHPIQ')
does not only accept they keys K, M, H, P, I, and Q themselves, but also the cursor keys and PageUp and PageDown.
GETSTRING, GETNUMBER These functions understand the following control keys:

Cursor Left Back one character
Cursor Right Forward one character
Delete Delete character under the cursor
End Goto the last character
Pos 1 Goto the first character
Ins Toggle insert (default) and overwrite mode
Return Terminate input
Ctrl/H (Backspace)Delete character before the cursor
Ctrl/Y Delete the whole string and start again
LINE This function returns a line from standard input or a certain file. It returns '?' if the line does not exist in the file.
DAY, MONTH, YEAR, DOY, WDAY, WDAYN, MONTHN do all accept a date as argument. Currently, there are these valid formats for dates:

Format Example
dd.mm.yyyy 4.12.1963
mm-dd-yyyy 12-4-1963
mm/dd/yyyy12/4/1963
BOOTDRIVE needs DOS 4.0 or above to operate.
ENVCOUNT, ENVUSED compute their results without accounting for the environment modification caused by the very call of ASET.
MAX, MIN These functions use the following algorithm. In a first run they try to consider all arguments as numbers and compute their maximum/minimum. If they encounter the first non-number, they switch to string mode and rescan the arguments, looking at them as strings.
RAMFREE A call to this function returns the current amount of free memory. The value has been affected by ASET before it was computed and might be affected even after the computation (if ASET has some more functions to evaluate). It is therefore to be taken as a circa value.
IF, AIF The functions IF and AIF can be a powerful help if (but not only if) you use ASET in file mode, ie., if you invoke ASET with the /f option to read a file containing several assignments. IF and AIF can be used in most cases where the DOS IF statement could have been used (which is not possible in ASET files).
Prec.Bas prec.HautNiv. sup.