Internal verbs¶
Internal.cs implements the built-in commands of the MVsharp runtime: list handling, locks, printers, account management, tape dump and load, and so on.
How a command gets here¶
Process(inProcess.cs) tokenises the command line and looks up the verb in the VOC.- If VOC attribute 1 is
Internal, it callsnew Internal(tokens, session). -
All of the work happens in the constructor. It dequeues the first token and switches on it:
As a result:
- Verbs are case-insensitive.
-and.are interchangeable (COPY-LISTis the same asCOPY.LIST).
There is no default case
A verb that is routed here but has no
casedoes nothing, and prints no error. -
Each case reads its own arguments from the
tokensqueue. - Errors are reported in one of two ways:
- By throwing
Exception. The caller displays the message. - By printing a message and returning.
- By throwing
Each verb's code sits inside a #region with the verb's name, so you can search for the region name to find it.
Verb lists and UPDATE.VOC¶
The lists at the top of the class (compilerVerbs, internalVerbs, databaseVerbs, externalVerbs) aren't used for dispatch. UPDATE.VOC uses them to write each verb into the VOC with the correct module in attribute 1.
Adding a new internal verb
You must do two things:
- Add a
case. - Add the verb to
internalVerbs. Without this,UPDATE.VOCwon't register it.
The other data lists are also only used by UPDATE.VOC, INIT.DICT.DICT and INIT.ERRMSG:
| List | Contents |
|---|---|
dictVoc, vocDicts |
DICT VOC records |
dictDicts |
DICT.DICT contents |
errmsgs |
ERRMSG contents |
filePointers, directoryFiles, dataFiles |
System files that UPDATE.VOC creates or points to |
d3sysnonums |
Synonyms: LOGTO|TO, LISTF|LF, VOC|MD |
executeStatements, fileNames |
BP file and the statements run at the end of UPDATE.VOC (MVsharp or Netbasic build) |
Conventions in this document¶
[x]means optional.{a|b}means choose one.- Options are letters that follow an option bracket. The tokenizer turns
(into a token of typeOwith valueOB. For example,COPY BP X (Ouses optionO. - "Select list 0" is the default active select list.
SYSTEM(11)tests whether it is active. &SAVEDLISTS&is opened intosession.SavedListsFile.
Verb index¶
Server ports used¶
Several verbs talk to the MVsharp service over SocketClient:
| Port | Used by |
|---|---|
9000 (localhost, or the user's app server) |
MESSAGE, LOGOFF, REST.CONFIG, FAILOVER, CLEAN.USERS, SYNC.CLUSTER, SHOW.CONFIG, SHOW.LICENSE, VERSION |
8999 |
SYNC.CLUSTER, LIST.READU LOCAL |
9001 |
UPDATE.LICENSE, UPDATE.VOC (getAccount, serverPath) |
9002 |
PORT.STATUS (getCluster) |
session.SysControl |
LISTU, LISTUSER, LOGOFF, TANDEM, LOGTO |
session.LockControl |
All lock verbs |
| Per-process debug port | PORT.STATUS, REMOTE.DEBUG |
Session and terminal¶
OFF / LO / LOGOUT / QUIT / BYE / EXIT¶
OFF
Terminates Session.messageServer, stops BufferedConsole, and calls Environment.Exit(1).
LOGTO (TO)¶
Switches the session to another account. The steps are:
- Changes the process directory to the account path and calls
session.ChangeDirectory(). - Clears the file caches.
- Re-initialises the VOC and session, and tells
SysControlabout the switch. - If the typed name is a synonym, sets
@ACCOUNTand@WHOto the typed name. - Unless the login type is
NetObj, it does three things:- Prints a connect-time line (d3Mode only).
- Processes VOC
MVSHARP.CONFIG. - Runs the
LOGINparagraph. In d3Mode, it runs the VOC item named after the account instead, if there is one.
- Calls
ValidateAccount.
M or F skips the login paragraph.
Errors: Invalid account <name>
WHO¶
Prints the user number, account and user:
- Non-D3 mode: also prints the SQL database if one is set.
- d3Mode: the field order depends on the static
pickWhoflag.CHANGEWHOsets the flag andCHANGEBACKclears it. These keywords are case-sensitive, and the setting lasts for the life of the process.pickWhoalso affects theU50BBuser exit inBasicRuntime.cs.
WHERE¶
WHERE
Prints the current directory.
DATE / TIME¶
DATE
TIME
DATEprints the date. The format depends onsession.d3Modeandsession.EuropeanDate. d3Mode also shows the internal and Julian dates.TIMEprintsTIMEDATE().
TERM (TERM.TYPE)¶
TERMshows the terminal and printer settings.-
TERM driverselects a screen driver. Driver names are case-sensitive:Driver Accepted names console consoleansi ansiwyse50 wyse50,W,wvt220 vt220,vt100,j,Jaddsvp addsvp,V,v -
TERM width,depth,...sets dimensions by position. You can leave any position empty to keep its current value.
Note
You can't set a driver and dimensions in the same command.
Errors:
- An unknown driver name.
- A non-integer value.
- A depth less than 1.
ECHO.ON / ECHO.OFF / P¶
ECHO.ON
ECHO.OFF
P
Turns terminal echo on or off. P toggles it.
HUSH¶
HUSH {ON|OFF}
Turns hush mode on or off by calling Functions.HUSH.
BREAK.KEY.ON / BREAK.KEY.OFF¶
BREAK.KEY.ON
BREAK.KEY.OFF
Sets session.BreakKeyOn.
CONTROL.CHARS¶
Nignores control characters.Fstops ignoring them.- With no argument, it reports the current state.
The report is inverted
See Known issues.
AUTOLOGOUT¶
Starts or stops an idle timer. When the session has been idle for the given time, the process exits with code 0. With no argument, it shows the current setting.
ECLTYPE¶
ECLTYPE [U|P]
Sets session.RunMode: U sets 1 (U2) and P sets 2 (Pick). With no argument, it shows the current mode.
DATE.FORMAT¶
ON/OFFsetsession.EuropeanDate.INFORMsets@SYSTEM.RETURN.CODEto 1 if European dates are on, otherwise 0.
CLR / CLS / CS¶
CLR
CLS
CS
Clears the screen with SCREEN_CONTROL(-1).
DISPLAY¶
DISPLAY text
Prints the first token with double quotes removed.
SLEEP¶
- No argument: sleeps 1 second.
- A number: sleeps that many seconds.
- A time: waits until that time, which may be tomorrow.
AUTOLOGOUTis suspended while it waits.
RESET¶
RESET
Clears these caches and settings:
- Subroutine, Python and JavaScript function caches.
- BP file cache.
- Select lists.
- File cache.
PrinterIsOn.
It then runs a GC and prints:
CLEARDATA¶
CLEARDATA
Clears the DATA stack (session.AtDataPending).
CLEARPROMPTS¶
CLEARPROMPTS
Clears paragraph <<prompt>> answers (Paragraph.promptList).
CLEARCOMMON¶
CLEARCOMMON
Clears unnamed and named COMMON.
SET.DEBUGGER¶
SET.DEBUGGER [target]
Sets session.remoteDebug. With no argument, it sets it to empty.
Users and processes¶
LISTU¶
LISTU [filter]
Lists logged-in users from SysControl with these columns:
- Pid (your own process is marked
*) - Port
- Account
- Login Id
- Date/Time
- Type
- Last command
filter is a case-insensitive substring match on each line. The total count shown includes users that the filter hides.
LISTUSER¶
LISTUSER [filter]
Same as LISTU, but shows different columns: Pid, User, Type, IP, Date/Time and Machine.
LOGOFF¶
LOGOFF [pid]
LOGOFFwith no argument exits the current process at once. UnlikeOFF, it doesn't stop the message server first.LOGOFF pidsendslogoff|pidto the app server that hosts that process.
MESSAGE¶
Sends a message to other users:
*sends to every process.- A number sends to that pid.
- Any other value sends to every process for that user ID. The match is case-sensitive.
If you don't give any text, it prompts for it. Delivery failures are ignored.
TANDEM¶
TANDEM pid
If the pid is logged in, outputs STX STX pid ETX to attach to that session.
Errors: Expected Pid after TANDEM, Invalid Pid after TANDEM
PORT.STATUS¶
- No arguments: lists every process with its account, type, and current program and line.
-
PORT pid action: sends a request to that process's debug port. Valid actions:Action Effect STACKShow the call stack. FILESShow open file variables. VAR/VARIABLESShow variables. Values are truncated to 55 characters. TRACESend a trace request. BREAKBreak into the process. DEBUG/DEBUGGERStart debugging. PROFILE ON|OFF|CLEARControl profiling. PROFILE IMPORTCopy the remote process's statistics into this session.
REMOTE.DEBUG¶
REMOTE.DEBUG pid
Connects to the debug port of a running process and opens an interactive :: prompt.
var,filesandstackreplies are formatted.qquits.
Note
The "no argument" error message says "PORT", but the argument is a pid.
PHANTOM¶
Runs command in the background with Phantom.exe, or with dotnet Phantom.dll on Linux:
- Creates
&PH&if needed. - Passes context to the child in
Phantom_*environment variables. - Sets
@STATUSto the child pid.
| Option | Effect |
|---|---|
BRIEF |
No start message. |
SQUAWK |
Print the &PH& item name. |
D3 |
D3-style [438] Job #pid submitted. message. |
D3S |
Like D3, and also no "Exited" message when the job ends. |
Z / ZH / ZD / ZS¶
Z command
ZS command
D3 shortcuts. Z command runs PHANTOM command. ZS adds D3S. Z, ZH and ZD behave the same.
Locks¶
There are 64 system locks, numbered 0–63. They are held by the lock server at session.LockControl. The 0–63 range isn't checked locally.
LOCK¶
- By default, it waits until it can set lock
n. NO.WAITfails at once withUnable to set Lock "n"if the lock is already held.PROMPTsets the lock from a phantom process.
CLEAR.LOCKS¶
CLEAR.LOCKS [n]
Clears all locks held by this process, or only lock n.
LIST.LOCKS¶
LIST.LOCKS
Shows an 8×8 grid of locks 0–63 and who holds each one.
LIST.READU¶
LIST.READU [LOCAL]
Lists file locks and record locks. LOCAL queries localhost:8999 instead of LockControl.
UNLOCK¶
Releases locks held by everyone, a user, a process, or on a file.
Select and saved lists¶
SAVE.LIST¶
Saves select list n (default 0) as record listname in &SAVEDLISTS&, creating &SAVEDLISTS& if needed. The default name is &TEMP<pid>&. If the list isn't active, it saves an empty list.
SAVE.LIST dirfile listname checks that dirfile is a directory file, but still writes to &SAVEDLISTS&.
GET.LIST¶
Loads one or more saved lists, joined together, into select list n (default 0). Sets @SELECTED.
UNIQUEremoves duplicates. It is case-sensitive.- In d3Mode, you must give a name.
DELETE.LIST¶
DELETE.LIST name
Runs DELETE &SAVEDLISTS& name.
EDIT.LIST¶
EDIT.LIST name
Runs ED &SAVEDLISTS& name.
COPY.LIST¶
COPY.LIST name [args]
Runs COPY &SAVEDLISTS& name args.
MERGE.LIST¶
Combines two active select lists (by number) into l3 (default 0). Sets @SELECTED and @SYSTEM.RETURN.CODE. COUNT.SUP suppresses the message.
LIST.UNION / LIST.DIFF / LIST.INTER¶
Combines two saved lists with a set operation and saves the result as target. If list2 or target is missing, the verb prompts for it. The results are de-duplicated.
COMPARE.LIST¶
D3 style. Combines two saved lists and saves the result to outlist, or back over list1 if outlist is omitted. Option G activates the result with GET.LIST.
| Operator | Result |
|---|---|
& |
Intersection (distinct) |
<> |
Items in list1 that aren't in list2 (distinct) |
= |
Union (distinct) |
+ |
Concatenation (keeps duplicates) |
- |
list1 with the first occurrence of each list2 item removed |
END¶
END
Runs CLEARSELECT (D3 style).
Records and files¶
CT (LIST.ITEM)¶
Displays records with numbered attributes. It uses the ids you give, then any active select list. If you give no ids and no list is active, or you use *, it displays the whole file.
| Option | Effect |
|---|---|
S |
No line numbers. |
P |
Send to the printer. |
N |
No paging. |
COPY¶
There are two syntaxes. The verb chooses between them by whether the first argument is FROM.
Pick style¶
Then it prompts TO:. Valid answers:
| Answer | Destination |
|---|---|
| Empty | Display only |
newid ... |
Same file, new ids |
(destfile [newid ...] |
Another file |
(DICT destfile [newid ...] |
Another file's dictionary |
(unix:/path [newid ...] |
An OS directory (d3Mode only) |
If no ids are given, it uses the active select list.
| Option | Effect |
|---|---|
O |
Overwrite existing records. |
D |
Delete the source after copying (a move). |
T |
Display instead of copying (uses CT). |
P |
Print instead of copying. Implies T. |
I, S |
Suppress the per-record messages. S also removes line numbers in T/P output. |
N |
No paging. See Known issues: N makes the copy do nothing. |
Information style¶
COPY FROM [DICT] src [TO [DICT] dest] [ALL] [OVERWRITING] [DELETING] [NUM.SUP] [id[,newid] ...]
Choosing the keys:
- Explicit ids are used first.
- Otherwise,
ALLcopies every record. - Otherwise, the active select list is used.
| Keyword | Effect |
|---|---|
OVERWRITING |
Replace existing records. |
DELETING |
Remove the source after copying. |
NUM.SUP |
Hide the record count. |
UPDATING |
Accepted, but currently behaves the same as DELETING; see Known issues. |
BINARY |
Ignored. |
If both files are flat (directory) files, it copies with File.Copy.
COMPARE¶
Also works with an active select list. Compares records in the two files. The file types must match.
- Directory files: compared line by line.
- Other files: compared attribute by attribute. Values are trimmed before comparing.
Note
In @F<n>, n is 0-based.
DELETE¶
Deletes the given ids, or all ids in the active select list. ALL deletes every record in the file. Prints N Record(s) Deleted.
There's no confirmation prompt
UP / UPDATE¶
Opens records in the full-screen UpdateProcessor editor. An active select list takes priority over ids on the command line. Dictionary names on the command line pick which fields the editor shows.
Exit actions:
- Exit
- File
- File and stay
- File + COMPILE + CATALOG
- File + COMPILE + RUN
- Delete
- File as new name (rename)
SEARCH (ESEARCH)¶
Prompts STRING: repeatedly until you enter a blank line. Puts into select list 0 every record that contains any of the strings. The match is a case-sensitive substring match. It searches the active list, or the whole file.
COUNT¶
Counts the records and prints N record(s) counted. Sets @SELECTED. If you give criteria, it runs a SELECT with them.
Note
The verb must be typed exactly as COUNT followed by a space, because the criteria are taken from @SENTENCE after the first 6 characters.
SPOOL¶
SPOOL file id
Prints one record to printer 0, one line per attribute.
CONVERT.UTF8¶
Rewrites the OS files in a directory file in UTF-8 (with a BOM) and CRLF line endings. It converts the given ids, or all records. This replaces select list 0.
SET.FILE¶
Creates a Q-pointer in the VOC (default name QFILE). Prompts for any value you leave out. If the remote file can't be opened, it removes the Q-pointer and reports an error. An existing Q-pointer with the same name is overwritten, but it won't overwrite a VOC item of any other type.
LISTF (LISTFILES)¶
LISTF
Lists every VOC file pointer with its type and whether it opens. Multi-part data files are listed indented under their parent file.
CD (COMPILE.DICT)¶
CD file [id ...]
Recompiles the I-type dictionary items: either all of them, or only the ids you give. Prints a success or error line for each item.
Output capture¶
COMO¶
Captures terminal output to &COMO&/<name>, creating &COMO& if needed. The file name is escaped with EscapeName. LIST, SPOOL and DELETE pass through to the LIST, SPOOL and DELETE verbs.
DIVERT.OUT¶
DIVERT.OUT ON dirfile id [TRUNCATE] [APPEND] [TTY.OFF|TTY.ON]
DIVERT.OUT {OFF | FILE.ON | FILE.OFF}
Sends output to a sequential file in a directory file.
TTY.OFFstops output going to the screen as well.FILE.ON/FILE.OFFpause and resume capture without closing the file.
Printing¶
SETPTR¶
Configures session.Printers[unit]. The arguments are parsed from @SENTENCE by splitting on commas.
| Setting | Default |
|---|---|
unit |
0 |
width |
132 |
depth |
66 |
top |
0 |
bottom |
0 |
mode |
1 |
Mode 3 means hold: output is not printed.
Options:
COPIES nAT deviceFORM nameBANNERorASfollowed byname,UNIQUE [prefix]orNEXT [prefix]BRIEF: don't display the settings afterwards.
SP.ASSIGN¶
D3 style. Looks up form Fnn in &DEVICES& and runs the matching SETPTR.
| Option | Effect |
|---|---|
n |
Number of copies (one leading digit). |
? |
Run SETPTR and stop. |
A |
Slave (auxiliary) printing. |
H |
Hold. |
S |
Suppress printing. |
Fnn |
Form. Default F0. |
Rnn |
Printer unit. |
The init and reset sequences named in the form record are applied to printer 0.
ADD.FORM¶
Writes a form definition to the printer file (&DEVICES&), which SP.ASSIGN uses.
SETPDF¶
With no arguments, shows the current PDF settings. With arguments, sets session.PdfDef.
- Orientation: 1 = landscape.
- Paper size: 0 = A4, 1 = A3, 2 = A2, 3 = Letter, 4 = Foolscap, 5 = Legal.
LISTPTR¶
LISTPTR
Lists OS printers: from WMI Win32_Printer on Windows, or lpstat -t on Linux.
SP.STATUS¶
SP.STATUS
Lists print jobs from System.Printing. Does nothing in the Core build.
SP.OPEN / SP.CLOSE¶
SP.OPEN
SP.CLOSE
Turns printer output on or off (Functions.PRINTER(true/false)).
Caching and statistics¶
CACHE / CLEAR.CACHE / LIST.CACHE¶
CACHE file ...
CLEAR.CACHE
LIST.CACHE
CACHE file ...adds files to the session file cache.CLEAR.CACHEempties the cache and runs a GC.LIST.CACHElists the cached files.
STATS / PROFILE¶
Controls and displays the runtime statistics (session.SystemStats).
Backup and restore¶
T.DUMP¶
Dumps the active select list, or the whole file, to an OS file. Prompts for the path if you leave it out.
- d3Mode: writes a D3 tape image: a label, then 512-byte blocks with a 12-byte pad. It uses
writeTapeLabelandwriteTapeBlock. - Other modes: writes one line per record, in the form
id þ LOWER(record).
T.LOAD¶
Reverses T.DUMP. In d3Mode it reads the tape image with getTapeLabel and getTapeBuffer. In other modes it writes the records in batches of 5000.
ACCOUNT.RESTORE¶
Prompts for the path of a D3 account-save file. It also reads continuation files named path-1, path-2, and so on. It restores the data into the current account:
- MD items go to
D3.MD. - Each dictionary and data section becomes a file, created with
CREATE.FILE.
| Option | Effect |
|---|---|
account |
Restore only that account from a multi-account save. |
OVERWRITE |
Replace existing records. |
SKIP filename |
Skip everything before that file. |
Warning
You can't run it in the MVsharp account itself.
Account setup¶
UPDATE.VOC (UPDATE.MD)¶
UPDATE.VOC
Rebuilds the standard contents of the current account. It does these steps in order:
- Creates the BP file pointer (
MVsharp.BPorNetbasic.BP), plus the&DEVICES&andNEWACCpointers. - Creates
&HOLD&,&PH&,&LOGS&and&SAVEDLISTS&if they don't exist. - Creates
DICT.DICTandERRMSGif they don't exist. - Writes a VOC entry for every verb in the four verb lists. An existing
RESETentry is kept. - Writes the VOC dictionary items.
- Creates the synonyms
TO,LFandMD. - Copies any missing source programs from the server's
Sourcesfolder. - In d3Mode, copies the
NEWACCitems into the VOC. - Runs
executeStatements: compiles and catalogs the BP file, then runsINIT.MS.FILES.
INIT.DICT.DICT¶
INIT.DICT.DICT
Creates DICT.DICT and loads the dictDicts items into it.
INIT.ERRMSG¶
INIT.ERRMSG
Creates ERRMSG and loads the errmsgs items into it.
DEPLOY.SQLSERVER (UPDATE.SQLSERVER)¶
DEPLOY.SQLSERVER
UPDATE.SQLSERVER
Sets the session's SQL Server database to TRUSTWORTHY, then runs SqlServerDeploy.txt (for DEPLOY) or SqlServerUpdate.txt (for UPDATE) from the executable's folder. The script is split on GO lines, which must have CRLF line endings. Errors containing "Cannot drop" are ignored.
Server and licence¶
SHOW.CONFIG / SHOW.LICENSE / VERSION¶
SHOW.CONFIG
SHOW.LICENSE
VERSION
All three print the runtime, service and SSH versions.
SHOW.CONFIGalso prints the licence configuration: serial, cores, users, expiry, MvSync and high availability.SHOW.LICENSEalso prints the licence text.
UPDATE.LICENSE¶
UPDATE.LICENSE
Prompts for a licence key and sends it to the service on port 9001.
REST.CONFIG¶
REST.CONFIG
Prompts for the REST server settings: server, user and password, connection pool sizes, idle timeout and port. Sends them to the service on port 9000.
FAILOVER / CLEAN.USERS / SYNC.CLUSTER¶
FAILOVER
CLEAN.USERS
SYNC.CLUSTER
High-availability commands sent to the local service:
| Verb | Effect |
|---|---|
FAILOVER |
Migrates users to the secondary server. |
CLEAN.USERS |
Restores the user table. |
SYNC.CLUSTER |
Syncs both cluster nodes (ports 9000 and 8999). |
Helper methods¶
| Member | Purpose | Used by |
|---|---|---|
ValidateAccount(Session) |
Creates the minimum VOC entries and files for a new Hashed account. Exceptions are swallowed. | LOGTO |
writeTapeBlock(writer, data) |
Writes 12 NULs plus 500 characters of data, and returns the remainder. data must be at least 500 characters. |
T.DUMP |
writeTapeLabel(writer, fileName) |
Writes a 512-byte D3 tape label. | T.DUMP |
getTapeLabel(reader) |
Reads and validates a tape label, and returns its text. | T.LOAD |
getTapeBuffer(reader, buf, blockSize) |
Appends the next block's data to buf. blockSize isn't used. |
T.LOAD |
AutoLogout_Elapsed |
Timer handler that exits the process when the session is idle. | AUTOLOGOUT |
proc_exited |
Prints [pid] Exited :cmd when a phantom ends. |
PHANTOM |
EscapeName(name) |
Escapes % * \ : " > < / | for OS file names. |
COMO |
printerDef |
Printer row: name, status, device. | LISTPTR (Linux) |