SD Core Solo for Linux LS2.0-0

SD Basic - Syntax

Every statement and function, alphabetically, with its syntax and nothing else.

A lookup card, and nothing else. If you know what you want and have forgotten how to spell it, it is here. If you want to know what it does, the other seventeen documents in this set are where that lives.

Italics mark something you supply, bold a word typed as it stands, and braces an optional part. SD folds case, so any of this may be written in either case.

This page lists every statement and function an application may use. The shapes that an argument count cannot express — every statement, and about twenty functions — are described in full in documents 01 to 17.

What is not here, and where it went. Everything on this card is something an application may use. Names that an ordinary program cannot compile are on the SD Basic - Restricted Commands page (96): the restricted statements, the internal-only functions, and the one name that is in the compiler's table with nothing behind it. If you are looking for something and it is not here, that is where to look before concluding it does not exist.

ONE THING IS MARKED, AND IT IS THE ONE THAT WASTES TIME.

(clause word) not a statement — a word that belongs inside another one's syntax

A#

abort abort {message}
abs abs(a)
abss abss(a)
accept.socket.connection accept.socket.connection(a, b)
account.path account.path(account)
acos acos(a)
alpha alpha(a)
ands ands(a, b)
append clause of openseq, and of edit (clause word)
arg arg(a)
arg.count arg.count()
arg.present arg.present(name) — name is an argument of this subroutine or function; true if the caller passed it
as ins value as c{path} — a reserved word, ends the value of that form of ins (clause word)
ascii ascii(a)
asin asin(a)
assigned assigned(a)
atan atan(a)

B#

before clause of ins: ins value before arr<f> (clause word)
begin begin case … end case · begin transaction … end transaction
bindkey bindkey(a, b)
bitand bitand(a, b)
bitnot bitnot(a)
bitor bitor(a, b)
bitreset bitreset(a, b)
bitset bitset(a, b)
bittest bittest(a, b)
bitxor bitxor(a, b)
bool bool(a)
break break on · break off · break n
by clause of locate and sselect — by 'AL', 'AR', 'DL', 'DR' (clause word)

C#

call call name(arg, …) · call @var(arg, …)
capturing clause of execute and os.execute — take the output (clause word)
case case condition, inside begin case … end case
casing casing on · casing off · casing expression
catalogued catalogued(a)
catch try {statement} … catch exception {qualifiers} {, exception …} … {catch …} end — see page 02
cats cats(a, b)
caught caught(exception {, modes}) — see page 02
ccall ccall(a, b)
ceil ceil(a)
chain chain command
change change(string, from, to {, occurrences {, start}})
char char(a)
checksum checksum(a)
chgphant chgphant()
child child(user.no)
class class name
clear clear — zeroes every variable
clearcommon clearcommon {name}
cleardata cleardata
clearfile clearfile file.var {on error …}
clearinput clearinput
clearselect clearselect {list.no}
close close file.var {on error …} — closes any file variable, sequential or not
close.socket close.socket socket
col1 col1()
col2 col2()
collection collection() · collection(c)
commit commit, inside begin transaction … end transaction
common common /name/ var, matrix(n), …
compare compare(a, b {, justification})
compares compares(a, b {, justification})
config config(a)
continue continue — next iteration of the enclosing loop or for
convert convert chars to replacements in var · convert(chars, replacements, string)
cos cos(a)
count count(a, b)
counts counts(a, b)
create create file.var then … else …
create.file create.file name {directory} {on error …}
create.server.socket create.server.socket(addr, port {, flags})
creating openseq path, id creating to file.var then … else … (clause word)
crop crop(a)
crt crt expr {: …} {:}
csv.mode csv.mode mode {, delimiter {, quote {, escape}}}
csvbuild csvbuild(data {, mode {, dialect}})
csvdq csvdq(line {, delimiter {, quote {, escape}}})
csvopen csvopen(line {, delimiter {, quote {, escape}}})
csvparse csvparse(text {, mode {, dialect}})
current.level clause of execute — run at the current command level (clause word)

D#

data data expr, …
date date()
dcount dcount(a, b)
debug debug — needs basic file record debugging
deffun deffun name(arg, …) {calling "cat.name"} {local}
del del arr<f {, v {, sv}}>
delete delete file.var, id {on error …}
deletelist deletelist name then … else …
deleteseq deleteseq path {on error …} then … else …
deleteu deleteu file.var, id {on error …}
delimiter for each var in string {delimiter d} … next var; also a clause of readcsv, matreadcsv, writecsv and matwritecsv (clause word)
digest digest(string, is.file, mode) — mode MD5, SHA1, SHA256, SHA384 or SHA512; a file outside the account's own directory needs the account's os switch
dim dim name(rows {, cols}), …
dir dir(a)
disinherit disinherit object
display display expr {: …} {:}
div div(a, b)
do loop … do … repeat
downcase downcase(a)
dparse dparse string, delimiter, var, …
dparse.csv dparse.csv line, delimiter, var, …
dtx dtx(n {, digits})

E#

ebcdic ebcdic(a)
echo echo on · echo off · echo expr
edit clause of keyedit, and the edit verb at the command prompt (clause word)
element.exists element.exists(c, path)
else clause of if, and of every statement that has a then
end end — closes a program, a then, an else, a case, a transaction
enumerate enumerate(c)
env env(a)
epoch epoch()
eqs eqs(a, b)
equate equate name to value {, name to value} …
execute execute cmd {capturing v or silent} {returning v} {passlist l} {rtnlist v} {stacklist}
exit exit — leave the enclosing loop or for
exp exp(a)
expand expand(c{path} {, file.var})

F#

fcontrol fcontrol(file.var, action {, qualifier}) — action FC$SYNC 1 (forced writes: qualifier 1 on, 0 off, -1 only asks; gives the earlier state), FC$SET.SEQ.KEY 2 and FC$GET.SEQ.KEY 3 (the counter of write … creating.seqkey), FC$CRLF 4 (line terminator mode of a directory or sequential file, qualifier 0 to 3, -1 only asks), 5 (field access, always 1), FC$VALID.ID 6, FC$MINMOD 7 (File Handling)
field field(string, delimiter, occurrence {, count})
fields fields(arr, delimiter, occurrence {, count})
fieldstore fieldstore(a, b, c, d, e)
file file name — names a file at compile time
fileinfo fileinfo(file.var, key)
filelock filelock file.var {locked …} {on error …} — no then/else
fileunlock fileunlock file.var {on error …}
findstr findstr x in arr {, occ} setting f {, v {, sv}} then … else …
fix fix(number {, precision {, mode}})
floor floor(a)
flush flush file.var then … else …
flush.dh.cache flush.dh.cache {local | no.wait}
fmt fmt(a, b)
fmts fmts(a, b)
fold fold(string, width {, delimiter})
folds folds(arr, width {, delimiter})
footing footing expr
for for var = start to end {step n} … next var
formlist formlist arr {, delimiter} {to list.no}
formlistv formlistv array to var
from clause of read, readnext, matbuild, matparse, remove, readcsv (clause word)
function function name(arg, …)

G#

ges ges(a, b)
get get var {, length} {setting count} from file.var {until terminator} {returning last} {waiting seconds} {then … else …} (Sequential Files) · in a class module, get name … end declares a property (Modern Program Structure)
get.messages get.messages()
get.port.params get.port.params(a)
getlist getlist name {to list.no} then … else — the then/else is not optional
getlistv getlistv name to var {setting count} then … else …
getnls getnls(a)
getpu getpu(a, b)
getrem getrem(a)
gosub gosub label {, arg, …}
goto goto label
groupstore groupstore new in var using i, n {, delimiter}
gts gts(a, b)

H#

heading heading expr
hidden clause of input — do not echo what is typed (clause word)
hush hush on · hush off · hush expr

I#

iconv iconv(a, b)
iconvs iconvs(a, b)
idiv idiv(a, b)
if if condition then … else …
ifs ifs(a, b, c)
in clause of find, findstr and locate
include $include record · $include file record
index index(a, b, c)
indexs indexs(a, b, c)
indices indices(file.var {, index})
inherit inherit object
inmat inmat() · inmat(matrix)
input input var {, length {, fill}} {:} {_} {hidden} {no.echo} {raw} {overlay} {upcase} {waiting n} — a fill cannot be used with hidden
inputblk inputblk(a)
inputcsv inputcsv var, …
inputerr inputerr message
inputfield inputfield var, length {, mask}
inputif inputif var {, length {, fill}} {:} {_} {hidden} {no.echo} {upcase} then … else … — a fill cannot be used with hidden
inputnull inputnull char
inputtrap inputtrap chars goto label {, label …} · inputtrap chars gosub label {, label …}
ins ins value before arr<f {, v {, sv}}>
int int(a)
is.null is.null(a)
itype itype(compiled.i.type)

J#

jboolean jboolean(x)
jbuild jbuild(c {, mode {, indent}})
jmerge jmerge(target, patch)
jnull jnull()
jparse jparse(text {, mode})
jpatch jpatch(document, operations)
jpath jpath(document, query)
jtype jtype(value)
jvalidate jvalidate(document, schema)

K#

keycode keycode({timeout})
keyedit keyedit key, action
keyexit keyexit key, action
keyin keyin({timeout})
keyinc keyinc({timeout})
keyinr keyinr({timeout})
keyready keyready()
keytrap keytrap key, action

L#

last last(string, delimiter)
lasts lasts(array, delimiter)
len len(a)
lens lens(a)
les les(a, b)
listindex listindex(a, b, c)
ln ln(a)
local local var, … — inside a deffun declared local
locate locate x in arr<f {, v}> {by order} setting pos then … else …
lock lock n then … else … — with no else it retries for ever
locked clause of readu, readl, readvu, readvl, matreadu, matreadl, filelock, recordlocku, recordlockl (clause word)
logmsg logmsg text
loop loop … {while c} {until c} … repeat
lower lower(a)
lts lts(a, b)

M#

mark.mapping mark.mapping file.var, state
mat mat matrix = value · mat a = mat b
matbuild matbuild var from matrix {, start {, end}} — no using
matchess matchess(array, template)
matchfield matchfield(a, b, c)
matchfields matchfields(array, template, n)
matparse matparse matrix from string {, delimiter}
matread matread matrix from file.var, id {on error …} then … else …
matreadcsv matreadcsv matrix from file.var {delimiter d} {quote q} {escape e} then … else …
matreadl matreadl matrix from file.var, id {locked …} then … else …
matreadu matreadu matrix from file.var, id {locked …} then … else …
matstr matstr(matrix)
matwrite matwrite matrix to file.var, id {on error …}
matwritecsv matwritecsv matrix to file.var {delimiter d} {quote q} {escape e} then … else … — no encoding, no on error
matwriteu matwriteu matrix to file.var, id {on error …}
max max(a, b)
maximum maximum(a)
mergelist mergelist(list1, list2, modes)
min min(a, b)
minimum minimum(a)
mod mod(a, b)
mods mods(a, b)
movelist movelist n to m {keep}
movelistv movelistv n to var {keep}
mvdate mvdate(epoch)
mvdate.time mvdate.time(epoch)
mvepoch mvepoch(date_time) · mvepoch(date, time)
mvtime mvtime(epoch)

N#

nap nap milliseconds
neg neg(a)
negs negs(a)
nes nes(a, b)
next next var — closes a for
no.echo clause of input and input @ — show nothing of what is typed (clause word)
nobuf nobuf file.var then … else …
non.transactional open name non.transactional {readonly} to file.var … · openpath path non.transactional {readonly} to file.var … (clause word)
not not(a)
nots nots(a)
ns ns(array)
null null — does nothing; the empty statement
num num(a)
numeric numeric(a)
nums nums(a)
nv nv(array {, repeat})

O#

object object(class {, arg, …})
objinfo objinfo(a, b)
oconv oconv(a, b)
oconvs oconvs(a, b)
on on n goto label, … — clamps, it does not fall through
open open {dict,} name {readonly} {non.transactional} {sync} to file.var {on error …} then … else … — the three words come before to, in any order; sync writes every write and delete of the file to disk
open.socket open.socket(addr, port, flags {, context})
openpath openpath path {readonly} {non.transactional} {sync} to file.var {on error …} then … else … — the three words come before to, in any order
openseq openseq path to file.var {append} {overwrite} {readonly} then … else … — then = it existed, else = it was created
opentemp opentemp {path} {non.transactional} to file.var {on error …} then … else … — a path outside the account's own directory, and the temporary file SD names itself, need the account's os switch
ors ors(a, b)
os.error os.error()
os.execute os.execute command {capturing var or silent}
osdelete osdelete path — a path outside the account's own directory needs the account's os switch
ospath ospath(path, key {, qualifier}) — keys 0 to 18, see Status and the Machine; an internal program's own ospath() has other numbers
osread osread var from path then … else … — a path outside the account's own directory needs the account's os switch
oswrite oswrite expr to path — a path outside the account's own directory needs the account's os switch
outerjoin outerjoin(a, b, c)
overlay clause of input — type over what is already there (clause word)
overwrite clause of openseq (clause word)

P#

page page {n}
panning clause of input — pan a field wider than the screen (clause word)
parse parse(string, pattern, delimiter)
passlist clause of execute — the select list held in a variable becomes the command's default list (clause word)
pause pause {seconds}
pdump pdump
precision precision n
print print expr {: …} {:} · print on unit expr
printcsv printcsv {on unit} value, … {:}
printer printer on · printer off · printer close · printer file on unit file, record
printer.setting printer.setting(a, b, c)
private private var, …
program program name
public public var, …
pwr pwr(a, b)

Q#

quote quote(a)
quotes quotes(a)

R#

raise raise(a)
randomize randomize · randomize(seed)
raw clause of input — read exactly length characters as they arrive (clause word)
rdiv rdiv(a, b)
read read var from file.var, id {on error …} then … else …
read.socket read.socket(a, b, c, d)
readblk readblk var from file.var, length then … else …
readcsv readcsv from file.var {delimiter d} {quote q} {escape e} to var, … then … else …
readjson readjson var from file.var then … else … — else is end of file or a line that is not JSON
readl readl var from file.var, id {locked …} {on error …} then … else …
readlist readlist var {from list.no} then … else …
readnext readnext id {, vm} {from list.no} {on error …} then … else …
readonly clause of open, openpath and openseq (clause word)
readseq readseq var from file.var {on error …} then … else … — else is end of file
readu readu var from file.var, id {locked …} {on error …} then … else …
readv readv var from file.var, id, field {on error …} then … else …
readvl readvl var from file.var, id, field {locked …} then … else …
readvu readvu var from file.var, id, field {locked …} then … else …
recordlocked recordlocked(file.var, id) — -3 -2 -1 0 1 2 3
recordlockl recordlockl file.var, id {locked …} {on error …}
recordlocku recordlocku file.var, id {locked …} {on error …}
redim redim name(rows {, cols}) — changes the size of a matrix passed in as an argument
regex regex(a, b)
release release {file.var {, id}} {on error …} — bare release releases everything
rem rem(a, b)
remove remove value from arr setting delimiter.code
remove.break.handler remove.break.handler
repeat repeat — closes a loop
restore.screen restore.screen image, restore.cursor
restricted restricted var {readonly}, … · restricted subroutine name{(args)} … end · restricted function name{(args)} … end — in a class module
return return {to label} · return(value) from a function
returning clause of execute — take the command's error text (clause word)
reuse reuse(a)
reusing reusing(name) — name is an argument of this subroutine or function
revremove revremove var from array setting code
rmvd rmvd(array, code)
rnd rnd(a)
rollback rollback, inside begin transaction … end transaction
rounddown rounddown(a, step)
roundup roundup(a, step)
rtnlist clause of execute — take the list the command left (clause word)
rtrans rtrans(file.var, id, field, action)

S#

sadd sadd(a, b)
save.screen save.screen(a, b, c, d)
savelist savelist name {from list.no} then … else — the then/else is not optional
scmp scmp(a, b)
screen screen verb {values} {keyword values} {returning var} {then … else …} — see page 12a
sddecrypt sddecrypt(a, b, c)
sdencrypt sdencrypt(a, b, c)
sdiv sdiv(a, b)
sdkey sdkey(passphrase, salt) — a 44 character base64 key (argon2id); status() 10206 bad salt, 10207 bad passphrase — see SD Basic - Encrypting Data
sdrandkey sdrandkey() — a random 256 bit key, 44 characters
sdsalt sdsalt() — a fresh random salt for sdkey()
seek seek file.var, offset {, relative.to} then … else …
select select {file.var} {to list.no}
select.socket select.socket(matrix, milliseconds) — see SD Basic - Sockets
selecte selecte {to var}
selectindex selectindex index {, value} from file.var {to list.no}
selectindexv selectindexv index {, value} from file.var to list.var — list 10 is its scratch list
selectinfo selectinfo(a, b)
selectleft selectleft index from file.var setting var to list.no — no then/else
selectleftv selectleftv index from file.var {setting var} to list.var — list 10 is its scratch list
selectn selectn {file.var} to list.no
selectright selectright index from file.var setting var to list.no — no then/else
selectrightv selectrightv index from file.var {setting var} to list.var — list 10 is its scratch list
selectv selectv {file.var} to var — read it back with readnext … from
send send expression {:} to file.var then … else … — without the colon a line is written (writeseq), with it the string as it stands (writeblk)
sendmail sendmail to, from, subject, body {, attachments} then … else …
seq seq(a)
server.addr server.addr(a)
set set var on object to value
set.arg set.arg n, value
set.break.handler set.break.handler subroutine.name
set.exit.status set.exit.status n
set.port.params set.port.params(a, b)
set.socket.mode set.socket.mode(a, b, c)
set.timezone set.timezone zone
setleft setleft index from file.var — no then/else
setnls setnls key, value
setpu setpu on unit, key, value
setrem setrem position on var
setright setright index from file.var — no then/else
setting clause of find, findstr, locate, remove, selectleft, selectright (clause word)
shared openseq path, id shared to file.var then … else … (clause word)
shift shift(a, b)
signal signal(user.no)
silent clause of execute, phantom and os.execute — run the command and throw its output away (not with capturing) (clause word)
sin sin(a)
sleep sleep {seconds} · sleep hh:mm:ss
smul smul(a, b)
socket.info socket.info(a, b)
sort sort(key.count, {mat} flags) — makes a sort and gives back the variable that stands for it
sort.compare sort.compare(a, b, mode {, no.case})
sortadd sortadd sortvar, {mat} keys {, data}
sortclear sortclear sortvar
sortdata sortdata(sortvar {, max.items})
sortnext sortnext(sortvar {, {mat} keys})
soundex soundex(a)
soundexs soundexs(a)
space space(a)
spaces spaces(a)
splice splice(a, b, c)
sqrt sqrt(a)
squote squote(a)
sselect sselect {file.var} {by field} {to list.no}
sselectn sselectn file.var {right.aligned} {descending} {to list.no}
sselectv sselectv file.var to list.var {right.aligned} {descending}
ssub ssub(a, b)
stacklist clause of execute — keep the active select list and put it back afterwards (clause word)
status status()
step clause of for: for v = a to b step n (clause word)
stop stop {message}
str str(a, b)
strs strs(a, b)
subroutine subroutine name(arg, …)
substitute substitute(arr, from, to, delimiter)
substrings substrings(a, b, c)
sum sum(a)
summation summation(a)
swapcase swapcase(a)
sync clause of open and openpath — open name to file.var sync else … — every write is flushed before the statement returns (a hashed file only) (clause word)
sysmsg sysmsg(number {, substitution, …})
system system(a)

T#

tan tan(a)
terminfo terminfo(capability {, arg, …})
then clause of if, and of every statement that has an else (clause word)
throw throw exception {, data} — see page 02
time time()
timedate timedate()
timeout timeout file.var, seconds
to clause of open, for, equate, readcsv, select, savelist, writecsv (clause word)
trans trans({dict,} file.name, id, field, action)
transaction transaction start · transaction commit · transaction abort
trapping clause of execute — trap the break key (clause word)
trim trim(string {, character {, option}})
trimb trimb(a)
trimbs trimbs(a)
trimf trimf(a)
trimfs trimfs(a)
trims trims(arr {, character {, option}})
trimw trimw(a)
trimws trimws(array)
try try {statement} … catch exception … end — see page 02
ttyget ttyget()
ttyset ttyset settings — the array ttyget() gave

U#

umask umask(a)
unassigned unassigned(a)
unlock unlock {n}
until clause of loop: loop … until condition … repeat
upcase upcase(a)

V#

vartype vartype(a)
vocpath vocpath(file {, dict.flag})
void void function.call — call a function and discard its value
vslice vslice(array, value.number)

W#

waiting clause of input: input var waiting seconds (clause word)
wake wake user.no
weofseq weofseq file.var {on error …}
while clause of loop: loop … while condition … repeat
write write var to file.var, id {on error …} — inside a transaction the lock must already be held · write var to file.var creating.seqkey id.var {on error …} — a hashed file numbers the record itself
write.socket write.socket(a, b, c, d)
writeblk writeblk var to file.var {on error …}
writecsv writecsv value, … to file.var {delimiter d} {quote q} {escape e} then … else …
writejson writejson collection to file.var then … else …
writelist writelist array to name — on may stand for to
writeseq writeseq var to file.var {on error …} then … else …
writeseqf writeseqf var to file.var {on error …} then … else …
writeu writeu var to file.var, id {on error …} · writeu var to file.var creating.seqkey id.var {on error …}
writev writev var to file.var, id, field {on error …}
writevu writevu var to file.var, id, field {on error …}

X#

xbuild xbuild(element {, mode {, indent}})
xparse xparse(text {, mode})
xpath xpath(element, query)
xtd xtd(a)

See also#

SD Basic - Program Structure · SD Basic - Program Control · SD Basic - File Handling · SD Basic - System and Environment.