Quick Reference Guide
Quick Reference Guide
2.11-0
Quick
Reference
Guide
Quick Reference Guide
All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or
mechanical, including photocopying, recording, taping, or information storage and retrieval systems - without the
written permission of the publisher.
Products that are referred to in this document may be either trademarks and/or registered trademarks of the
respective owners. The publisher and the author make no claim to these trademarks.
While every precaution has been taken in the preparation of this document, the publisher and the author assume no
responsibility for errors or omissions, or for damages resulting from the use of information contained in this
document or from the use of programs and source code that may accompany it. In no event shall the publisher and
the author be liable for any loss of profit or any other commercial damage caused or alleged to have been caused
directly or indirectly by this document.
Technical Editor
Martin Phillips
Cover Graphic
Ishimsi
Contents 3
Table of Contents
2 Dictionary Records 7
3 Command Editor 9
4 Commands 10
5 Inline Prompts 36
11 QMBasic Debugger 95
15 ED Commands 108
2.11-0
VOC Record Types 5
D Data definition
F2 = Field number
F3 = Conversion code
F4 = Column heading
F5 = Format code
F6 = Single/multi-value flag
F7 = Association name
F8 = Available for user use. Not referenced by QM.
F File reference
F2 = Data pathname(s)
F3 = Dictionary pathname
F4 = Subfile names for a multifile
F5 = File inclusion flags for ACCOUNT.SAVE and FILE.SAVE
F6 = Special mode flags
K Keyword
F2 = Keyword number
F3+ = Alternative expansion for use as a command
M Menu
F2 = Title
F3 = Item text
F4 = Action. End with semicolon for "Press return to continue" prompt
F5 = Help text
F6 = Access key
F7 = Hide inaccessible entries?
F8 = Access control subroutine name
F9 = Prompt text
F10 = Exit codes
F11 = Stop codes
PA Paragraph
F2+ = Commands to execute
PH Phrase
F2 = Expansion
PQ PROCs
F2+ = Commands to execute
2.11-0
6 Quick Reference Guide
S Sentence
F2 = Command
V Verb
F2 = Type
F3 = Item to execute
F4 = Additional information
F5 = Security subroutine name (optional)
X Miscellaneous
User defined VOC record types can be parsed using the X-type $VOC.PARSER record:
Field 2 Multivalued list of VOC record type codes
Field 3 Corresponding multivalued list of catalogue names of handler programs.
2.11-0
Dictionary Records 7
2 Dictionary Records
A Pick style data definitions. A-types are provided for compatibility with other environments. D
and I-type records should be used by preference. See the QM Reference Manual for details.
C Calculated values. Similar in concept to I-types, these are programs that return a value via
the @ANS variable. C-types are provided for compatibility with other environments and
I-types should be used by preference. See the QM Reference Manual for details.
D Direct data types. Describes data that is held in a field of the record.
I Indirect data types. Describes data that can be evaluated from data in fields of the record by
evaluating a QMBasic expression.
S Pick style data definitions. S-types are provided for compatibility with other environments. D
and I-type records should be used by preference. See the QM Reference Manual for details.
@ A phrase record defining the default list of items to be displayed by LIST and SORT
in the absence of any other field names.
@LPTR A phrase record defining the default list of items to be displayed by LIST and SORT
in the absence of any other field names when output is directed to a printer. If this
record is not present, the query processor uses the @ record instead.
2.11-0
8 Quick Reference Guide
@MODIFY A phrase record defining the default list of items to be processed by the MODIFY
command.
@SHOW A phrase record defining the default list of items to be displayed by SHOW in the
absence of any other field names.
2.11-0
Command Editor 9
3 Command Editor
Dot Commands
Special keys
2.11-0
10 Quick Reference Guide
4 Commands
* text
Defines a comment in a paragraph.
! command
Executes a shell (operating system) command.
ABORT {text}
Terminates all active processing and returns to the command prompt.
ADMIN
System administration tools menu (QMSYS account only).
ADMIN.SERVER
Manage security rules for QMNet server connections.
ADMIN.USER
Performs management of the register of user names for network connections.
ALIAS
Lists all defined command aliases.
ALIAS command
Removes alias for command.
AUTHKEY password
Encrypts a password for use with AUTHENTICATE.
AUTOLOGOUT period
Sets an inactivity period after which a process will automatically be logged out.
2.11-0
Commands 11
An X-type record named $BASIC.OPTIONS in the named file or in the VOC can be used to
apply compiler defaults. Fields 2 onwards contain any of the following options, one per field:
CATALOGUE {LOCAL | GLOBAL} Catalogues program after compilation.
DEBUGGING Compiles the program in debug mode.
DEFINE name {value} Defines token name.
LISTING Generates a listing record.
MODE option.name Sets the given compilation mode.
NOXREF Compiles the program with no cross reference tables.
XREF Generate a compiler listing record including a variable
cross-reference table.
BLOCK.PRINT text
Prints text on the default printer using large characters.
BLOCK.TERM text
Displays text using large characters.
BREAK CLEAR
Clears deferred breaks.
BREAK COUNT
Reports the number of active BREAK OFF commands.
BREAK ON USER n
Enables the break key for the specified user.
Neither Adds to private catalogue for access from current account only
CD ALL
Compiles all I-type records in all dictionaries referenced by F-type VOC entries in the account.
CD LOCAL
Compiles all I-type records in all dictionaries referenced by F-type VOC entries in the account
that do not have a directory separator in the dictionary pathname.
CLEAN.ACCOUNT
Clears the $HOLD, $COMO and $SAVEDLISTS files.
CLEAR.ABORT
Clears the abort status so that an ON.ABORT paragraph can restart the application.
CLEAR.DATA
CLEARDATA
Clears the data queue created by the DATA command or the QMBasic DATA statement.
CLEAR.INPUT
CLEARINPUT
Clears all unprocessed characters entered at the keyboard.
CLEAR.LOCKS {lock.number}
Releases task locks.
CLEARPROMPTS
Clears all stored inline prompts and responses.
CLEAR.SELECT {list.number}
CLEAR.SELECT ALL
CLEARSELECT {list.number}
CLEARSELECT ALL
Clears one or all active select lists.
CLEAR.STACK
Clears the command stack.
CLR
Clears the terminal screen.
COMO ON record.name
Commences recording of command output in named record of $COMO file.
COMO OFF
Terminates recording of command output.
CONFIG {LPTR}
Reports licence details and configuration parameters.
2.11-0
14 Quick Reference Guide
MERGE.LOAD pct Sets the merge load factor for the file (default 50%).
VERSION vno Specifies internal file format for backward compatibility.
NO.CASE Creates a file using case insensitive record ids.
NO.MAP Suppress translation of reserved characters in record ids of
directory files.
NO.RESIZE Creates the file with dynamic resizing disabled.
MODE ddd:sss Sets access permissions (not Windows)
CS
Clears the terminal screen.
DATA {text}
Used in paragraphs to supply data to a command or program instead of prompting the user.
DATE
Displays the current day, date and time (e.g. "Wednesday, 18 February 2004 04:57pm")
DATE date
Converts internal day number to date or vice versa.
DATE INTERNAL
Displays the current date as an internal form day number.
DATE.FORMAT DISPLAY
Displays the default date format.
DATE.FORMAT INFORM
Sets @SYSTEM.RETURN.CODE according to the default date format.
DATE.FORMAT conv.code
Sets the default date conversion code.
2.11-0
16 Quick Reference Guide
DELETE.KEY {keyname}
Deletes an encryption key.
DELETE.LIST list.name
Deletes a previously saved select list.
DELETE.PRIVATE.SERVER name
Deletes a QMNet private server definition.
DELETE.SERVER name
Deletes a QMNet server definition.
DELETE.USER {username}
Deletes a user name from the register of users for network security checks.
DISABLE.PULISHING
Disables publishing to all replication subscribers.
2.11-0
Commands 17
EDIT.CONFIG
Edits QM configuration parameters.
EDIT.LIST {list.name}
Invokes the ED line editor to edit a saved select list in the $SAVEDLISTS file.
ENABLE.PULISHING
Reenables publishing to all replication subscribers.
FIND.ACCOUNT account.name
Locates an account on a Pick style FILE.SAVE tape.
FIND.PROGRAM name
Locates and reports details of a catalogued program.
FSTAT RESET
Clears global statistics counters.
FSTAT
Periodic global statistics display.
GENERATE file.name
Generates a QMBasic include record from a dictionary.
2.11-0
18 Quick Reference Guide
GET.STACK {stack.name}
Restores a previously saved command stack.
GO label{:}
Used within paragraphs to jump to a labelled line.
HELP
Provides help on a wide variety of topics.
LIST.COMMON
Lists named common blocks.
LIST.FILES {BRIEF}
Displays statistics regarding the number of open files.
2.11-0
Commands 19
LIST.LOCKS
Reports the state of the 64 system wide task locks.
LIST.PHANTOMS
Shows all currently active phantom processes.
LIST.TRIGGERS
Displays a summary of trigger functions used in an account.
2.11-0
20 Quick Reference Guide
LIST.USERS
Lists users from the register of users for network security checks.
LIST.VARS {ALL}
Displays user @-variables.
LISTF {LPTR}
Lists all files defined in the VOC.
LISTFL {LPTR}
Lists all files defined in the VOC that are local to the account.
LISTFR {LPTR}
Lists all files defined in the VOC that are remote to the account.
LISTK {LPTR}
Lists all keywords defined in the VOC.
LISTM {LPTR}
Lists all menus defined in the VOC.
LISTPA {LPTR}
Lists all paragraphs defined in the VOC.
LISTPH {LPTR}
Lists all phrases defined in the VOC.
LISTPQ {LPTR}
Lists all PROCs defined in the VOC.
LISTQ {LPTR}
Lists all indirect file references defined in the VOC.
LISTR {LPTR}
Lists all remote items defined in the VOC.
LISTS {LPTR}
Lists all sentences defined in the VOC.
LISTU {DETAIL}
Lists the users currently in QM.
LISTV {LPTR}
Lists all verbs defined in the VOC.
LOAD.LANGUAGE pathname
Install non-English message texts (QMSYS account only).
2.11-0
Commands 21
LOGOUT {user}
Terminates a QM process.
LOGOUT ALL
Terminates all QM processes except the one issuing the command. Restricted to administrators.
LOOP
sentence(s)
REPEAT
Defines the top and bottom of a group of sentences to be repeated within a paragraph.
MESSAGE OFF
Disables reception of messages.
MESSAGE ON
Enables reception of messages.
NLS {key}
Report national language support settings.
NLS DEFAULT
Sets default national language support settings.
2.11-0
Commands 23
2.11-0
24 Quick Reference Guide
The option command also supports short forms that set multiple options as described in the QM
Reference Manual.
PASSWORD {username}
Changes the password for a QM user on Windows 95, 98 and ME.
PAUSE
Displays a "Press return to continue" prompt.
PDEBUG {command}
Runs the phantom debugger.
2.11-0
Commands 25
PTERM BREAK { n | ^c }
Specifies the character to be recognised as the break key (not supported in all terminal
emulators).
2.11-0
26 Quick Reference Guide
PTERM DISPLAY
Displays terminal settings.
PTERM LPTR
Reports terminal settings on the default printer.
QSELECT {DICT} filename {id | * | FROM list} {TO list} {SAVING field}
Constructs a select list from the content of selected records.
QUIT
Terminates the current QM session.
REBUILD.ALL.INDICES {CONCURRENT}
Rebuilds all alternate key indices in an account.
2.11-0
Commands 27
REPORT.STYLE
Displays the default query processor report style.
REPORT.STYLE name
Sets the default query processor report style.
REPORT.STYLE OFF
Disables the default query processor report style.
RESET.MASER.KEY
Resets the master encryption key after relicensing or moving an encrypted system.
SAVE.STACK {stack.name}
Saves the current command stack.
2.11-0
28 Quick Reference Guide
SECURITY
Reports the current security setting.
SET.EXIT.STATUS value
Sets the final exit status returned by QM to the operating system.
2.11-0
Commands 29
SET.LANGUAGE language.code
Select message text language.
SET.TRIGGER file.name
Displays the trigger function associated with a dynamic file.
SETPORT port {BAUD rate} {BITS bits.per.byte} {PARITY parity} {STOP.BITS stop}
{BRIEF}
Sets communications parameters for a serial port.
CRLF.
NFMT Specifies that no page formatting is to be applied to the output
data.
NODEFAULT Leaves omitted options at their current value.
NOEJECT Suppresses the normal page throw at the end of a print job
(Windows only).
OPTIONS xxx Passes the given option(s) to the underlying operating system
print spooler (e.g. OPTIONS "landscape" on a Linux system).
OVERLAY subr Identifies a catalogued subroutine for use in generating a
graphical overlay for each page of output.
PCL Specifies that this printer supports PCL.
PORTRAIT Specifies that the output is to be printed in portrait format.
PREFIX path Prefixes output with the contents of the named file.
RAW Specifies that the Windows non-GDI mode API calls are to be
used.
SPOOLER name Selects a non-default spooler on Linux and FreeBSD.
STYLE name Sets the default query processor report style for reports
directed to this print unit.
Additional options available with PCL are shown below. In many cases, the list of acceptable
parameter values can be extended by modifying the SYSCOM $PCLDATA record.
CPI n Specifies the number of characters per inch when used with
PCL. The value may be non-integer.
DUPLEX Selects duplex (double sided) printing, binding on the long
edge. This option is currently only supported in conjunction
with the PCL option.
DUPLEX SHORT Selects duplex (double sided) printing, binding on the short
edge. This option is currently only supported in conjunction
with the PCL option.
LPI n Specifies the number of lines per inch when used with PCL.
The value must be 1, 2, 3, 4, 6, 8, 12, 16, 24 or 48.
PAPER.SIZE xx Specifies the paper size when used with PCL. Valid size
names are A4, LETTER, LEGAL, LEDGER, A3,
MONARCH, COM_10, DL, C5, B5.
SYMBOL.SET xx Specifies the character set when used with PCL. Valid values
of xx are ROMAN8 (the default), LATIN1, ASCII, PC8.
WEIGHT xx Specifies the font weight when used with PCL. Valid values
of xx are ULTRA-THIN, EXTRA-THIN, THIN,
EXTRA-LIGHT, LIGHT, DEMI-LIGHT, SEMI-LIGHT,
MEDIUM, SEMI-BOLD, DEMI-BOLD, BOLD,
EXTRA-BOLD, BLACK, EXTRA-BLACK,
ULTRA-BLACK though specific printers might not support
all values.
SH
Executes an interactive shell. (Not currently available on Windows)
2.11-0
Commands 31
SH command
Executes a shell (operating system) command.
SLEEP time
Suspends execution of further commands until a given number of seconds have elapsed or until a
specified time of day.
SP.ASSIGN options
Sets output to a Pick style form queue. Options are:
n number of copies to print
Fqno specifies the form queue number
2.11-0
32 Quick Reference Guide
SP.CLOSE
Resets the "keep open" state of the default printer and closes the active print job.
SP.OPEN
Sets the "keep open" state of the default printer, merging successive print requests into a single
job.
STATUS { ALL }
Displays a list of active phantom processes.
STOP
Terminates the currently active paragraph.
2.11-0
Commands 33
T.DET
Detach a previously assigned tape device.
T.EOD
Position a tape device to the end of the recorded data.
T.FWD
Move a tape device forward by one file.
T.RDLBL
Read the label from a tape device.
T.READ
Read data from a tape device.
T.REW
Rewind a tape device.
T.STAT
Report the status of a tape device.
T.WEOF
Write end of file marker to a tape device.
TERM
Displays the terminal screen layout dimensions.
TERM DEFAULT
Sets the terminal screen layout dimensions to their default values.
2.11-0
34 Quick Reference Guide
TERM DISPLAY
Displays input key codes and output control sequences for the currently selected terminal.
TIME
Displays the current date and time (e.g. 16:57:00 18 Feb 2004).
TIME time
Converts and external format time to its internal value or vice versa.
TIME INTERNAL
Displays the current time in internal form (seconds since midnight).
UMASK {rights}
Set access rights to be applied on file creation.
UNLOCK.KEY.VAULT
Enables user access to encryption keys when using key vault security.
UPDATE.ACCOUNT
Copies all system VOC entries from NEWVOC, setting the correct locations for system files.
UPDATE.LICENCE
Applies new licence details.
2.11-0
Commands 35
WHO
Displays the current user number and account name.
WHERE
Displays the pathname of the current account.
2.11-0
36 Quick Reference Guide
5 Inline Prompts
control determines the way in which the prompt is displayed and how it is actioned on
subsequent execution of the same statement or another with the same text.
@(col, row) Specifies the display position for the prompt text.
@(BELL) Sounds the audible warning unless suppressed by BELL OFF.
@(CLR) Clears the display.
@(TOF) Positions to the top left of the display.
A Always prompt.
Cn Returns the n'th token of the current sentence.
Cn:default Returns the n'th token of the current sentence of default if
none.
Cm-n Returns tokens m to n of the current sentence.
Cn+ Returns tokens n onwards of the current sentence.
C# Returns the number of tokens in the current sentence.
CHANGE(str,old,new) Change all occurrences of old to new in str.
F(file, key {,field {, value {, subvalue}}}) Fetch data from a database
record.
ICONV(str,code) Apply input conversion code to str.
In Returns the n'th word of the current sentence, prompting if
null.
Ln Returns the next item from select list n.
OCONV(str,code) Apply input conversion code to str.
R Prompts repeatedly, separating items by a space.
R(string) Prompts repeatedly, separating items by string.
Sn Returns the n'th word of the command entered at the command
prompt.
SUBR(name) Executes catalogued QMBasic subroutine name, returning the
result.
SUBR(name,arg) Executes catalogued QMBasic subroutine name, passing in
the given argument(s) and returning the result.
SYSTEM(n) Returns the value of the QMBasic SYSTEM(n) function.
U Converts data entered in response to the prompt to uppercase.
@var Retrieves the value of the given variable.
@var:default Retrieves the value of the given variable, returning default if
none.
$var Retrieves the value of an operating system environment
variable.
$var:default Retrieves the value of an operating system environment
variable, returning default if none.
text is the prompt text to be displayed. An equals sign is automatically added to the end of
2.11-0
Inline Prompts 37
check is used to check whether the response to the prompt is valid. This may be a either a
pattern match template or an input conversion code. Conversion codes must be
enclosed in round brackets.
2.11-0
38 Quick Reference Guide
= EQ EQUAL
# NE <> >< NOT
> GT GREATER AFTER
< LT LESS BEFORE
>= GE =<
<= LE =>
BETWEEN
AND OR
OR !
LIKE MATCHES MATCHING
UNLIKE NOT.MATCH
ING
SAID SPOKEN ~
IN
NOT.IN
The NO.CASE qualifier can be used after a relational operator to make the comparison case
insensitive.
2.11-0
Query Processor Keywords 39
ABSENT.IGNORE
Ignore absent records, suppressing the display of such records on completion of the command.
ABSENT.NULL
Treats an absent record as a null item rather than an error.
ALL.MATCH
Used in SEARCH to specify that the records must contain all of the given search strings.
BOXED
Generates a boxed report on a PCL printer.
2.11-0
40 Quick Reference Guide
BY {NO.CASE} field
Sorts records into ascending order of field prior to display or when building a select list.
CALC field
Prefixes an I-type field name or an evaluated expression, causing the calculation to be performed
on the total lines using accumulated values from the detail lines.
CAPTION "text"
Specifies text to appear at the left edge of the grand total line with AVERAGE, ENUM, MAX,
MIN, PERCENT or TOTAL.
COL.HDG.ID
Uses the displayed field names as the default column headings in a report.
COL.HDR.SUPP
COL-HDR-SUPP
COL.HDR.SUP
COL-HDR-SUP
Suppresses page and column headings.
COL.SPACES n
COL.SPCS n
Determines the number of spaces inserted between columns of a tabular report.
COL.SUP
COL-SUPP
Suppresses column headings. With LIST.ITEM and SORT.ITEM, this suppresses line
numbering.
COUNT.SUP
Suppresses display of the number of records listed or selected at the end of the command.
2.11-0
Query Processor Keywords 41
DBL.SPC
DBL-SPC
Inserts a blank line between records in a tabular report.
DET.SUP
Suppresses reporting of detail lines, leaving only page and column headers, totals, footers and
the final record count.
EVAL expr
EVALUATE expr
Evaluates an expression as though it were an I-type defined in the dictionary.
FIRST {n}
Selects of displays only the first n records meeting any supplied selection criteria.
FORCE
Forces display of headings in empty report.
FOOTER "text"
FOOTING "text"
Defines a page footing for the report. The following control codes can be included in text:
B{n} Inserts data from the corresponding B control code in a BREAK.ON or
BREAK.SUP.
C Centres the current line of the footing text. When used with G, the C option centres the
current element of the text.
D Inserts the date.
F{n} Inserts the file name in a field of n spaces. If n is omitted, a variable width is used.
G Inserts spaces to expand the text to the width of the output device.
Hn Sets horizontal position (column), numbered from 1.
I{n} Inserts the record id in a field of n spaces. If n is omitted, a variable width is used.
2.11-0
42 Quick Reference Guide
FROM list.no
Specifies the select list to be used as a source of record ids for processing by the query.
GRAND.TOTAL "text"
GRAND-TOTAL "text"
Specifies text to appear at the left edge of the grand total line with AVERAGE, ENUM, MAX,
MIN, PERCENT or TOTAL.
HDR.SUP
HDR-SUPP
Suppresses the default page heading in a query.
HEADER "text"
HEADING "text"
Defines a page footing for the report. The following control codes can be included in text:
B{n} Inserts data from the corresponding B control code in a BREAK.ON or
BREAK.SUP.
C Centres the current line of the footing text. When used with G, the C option centres the
current element of the text.
D Inserts the date.
F{n} Inserts the file name in a field of n spaces. If n is omitted, a variable width is used.
G Inserts spaces to expand the text to the width of the output device.
Hn Sets horizontal position (column), numbered from 1.
I{n} Inserts the record id in a field of n spaces. If n is omitted, a variable width is used.
L Inserts a new line at this point in the text.
N Suppresses pagination of the output to the display.
O Reverses the elements separated by G tokens in the current line on even numbered
pages. This is of use when printing double sided reports.
P{n} Inserts the page number, right justified in n spaces. If omitted, n defaults to 4.
R{n} Same as I{n}.
S{n} Inserts the page number, left justified in n spaces. If omitted, n defaults to 1.
T Inserts the time and date.
ID.ONLY
Causes the query processor to ignore the default listing phrase and show only record ids.
ID.SUP
ID-SUPP
Omits the default display of @ID from the report.
2.11-0
Query Processor Keywords 43
LABEL template.name
LABEL NO.DEFAULT
Specifies the label template record name for LIST.LABEL and SORT.LABEL.
LOCKING
Takes a file lock on the file being processed, preventing updates during the report.
LPTR { unit }
Directs the output of the query to a printer.
MARGIN width
Specifies the width of a blank left margin to appear in the report output.
field MULTI.VALUE
field MULTIVALUED
Forces the field to be processed as a multi-valued item.
NEW.PAGE
Causes each record in a report to start on a new page.
NO.CASE
Used in SEARCH to specify that case insensitive string comparison is to be used.
NO.GRAND.TOTAL
Suppresses the grand total line.
NO.INDEX
Causes the query processor to ignore any alternate key index.
NO.MATCH
Used in SEARCH to specify that the records must contain none of the given search strings.
NO.NULLS
Suppresses null items. Used with the AVERAGE, ENUMERATE, MIN or SAVING.
2.11-0
44 Quick Reference Guide
NO.PAGE
NOPAGE
Suppresses the normal page end prompt.
NO.SPLIT
Causes the query processor to avoid splitting records across pages where possible.
ONLY
Causes the query processor to ignore the default listing phrase and show only record ids.
OVERLAY subr.name
Sets a graphical page overlay.
PAGESEQ filename id
Specifies a control record to ensure contiguous page numbering of separate reports.
PAN
Used in reports directed to the display, permits the total width of the report to exceed that of the
display.
REPEATING
Causes single valued data to be repeated against each value in other fields.
REQUIRE.INDEX
Terminates the query unless it can make use of an alternate key index.
REQUIRE.SELECT
Terminates the query if there is no active select list.
SAMPLE {n}
Selects or displays only the first n records meeting any supplied selection criteria.
2.11-0
Query Processor Keywords 45
SAMPLED {n}
Processes every n'th record.
SCROLL
Used in a report directed to the display, enables scrolling back through report pages.
field SINGLE.VALUE
field SINGLEVALUED
Forces the field to be processed as a single-valued item.
STRINGS filename id
Specifies a control record containing the search strings for SEARCH.
STYLE name
Sets the query processor report style.
SUPP
Suppresses page headings.
TO list.no
Used in SELECT, SSELECT or SEARCH, specifies the select list to be created.
TO new.file.name
Used in REFORMAT, specifies the name of the output file.
WHEN condition
Introduces a selection clause for a multi-valued field.
WITH NO field
Tests whether field is null.
2.11-0
46 Quick Reference Guide
WITHOUT field
Tests whether field is null.
2.11-0
@-Variables and Constants 47
Variables
2.11-0
48 Quick Reference Guide
@DICTRECS The query processor sets this variable to an item mark delimited
copy of the dictionary records that were used to construct the
display clause elements of the query (including any item with the
BREAK.SUP prefix). For dictionary records that contain object
code (C/I types and A/S types with correlatives), the object code
is omitted.
@DS The operating system specific directory delimiter character, / on
Linux or FreeBSD, \ on Windows.
@FILE.NAME The name of the file referenced in the most recent query
processor command.
@FILENAME Synonym for @FILE.NAME
@FMT The query processor sets this variable to a field mark delimited
list of the width and justification codes for each item in the
display clause of the query (including any item with the
BREAK.SUP prefix).
@GID User's group id number for all platforms except Windows. Same
as SYSTEM(29).
@HOSTNAME The name of the server computer system. Same as
SYSTEM(1015).
@ID The record id of the record being processed by a query processor
command or an I-type function.
@IP.ADDR The IP address associated with a network user. Same as
SYSTEM(42).
@ITYPE.MODE The mode of execution of an I-type. It has three possible values:
0 Normal
1 Evaluation of the old index value when updating or deleting
a record from a file with an alternate key index.
2 Evaluation of the new index value when updating or adding
a record to a file with an alternate key index.
@LEVEL The current command processor depth (EXECUTE level). The
initial command processor is level one, each EXECUTE level
increments this by one.
@LOGNAME User's login name. On Windows, this is converted to uppercase.
@LPTRHIGH The number of lines per page of print unit zero. Depending on
the current setting of the PRINTER flag, this may refer to the
display or to the printer.
@LPTRWIDE The width of print unit zero. Depending on the current setting of
the PRINTER flag, this may refer to the display or to the
printer.
@MONTH The month in which the last command started execution as a two
digit value.
@NB Break number level. Set to zero on detail lines and one upwards
on break lines. A value of 255 represents the grand total line.
@NI Item counter. Used in I-types, this holds the number of records
retrieved by the query processor command.
@OPTION Contains a copy of field 4 of the V-type VOC entry when a verb
2.11-0
@-Variables and Constants 49
2.11-0
50 Quick Reference Guide
2.11-0
QMBasic Compiler Directives 51
$DEBUG
Compile the program in debug mode.
$ELSE
Used with $IFDEF or $IFNDEF to select alternative source statements.
$ENDIF
Terminates a conditional compilation element started with $IFDEF or $IFNDEF.
$EXECUTE "command"
Executes a QM command during program compilation.
$IFDEF name
Compile the following statements only if name is defined.
$IFNDEF name
Compile the following statements only if name is not defined.
2.11-0
52 Quick Reference Guide
$NO.CATALOGUE
Indicates that the program should not be catalogued where the $BASIC.OPTIONS record
includes the CATALOGUE option.
2.11-0
QMBasic Compiler Directives 53
$NO.XREF
Indicates that the program should compiled without the cross-reference tables used for extended
error diagnostics.
$NOCASE.STRINGS
Compiles the program with case insensitive string handling.
$PAGE
Inserts a page break in the compiler listing record.
$QMCALL
Makes the program available for calling via the QMClient QMCall function in systems running
with the QMCLIENT configuration parameter set to 2.
2.11-0
54 Quick Reference Guide
@(col {, line})
Returns cursor control code to move to given column and line. Top left = 0,0.
@(mode {, arg})
Sets specified terminal mode. Modes and their symbolic names are:
Mode Token Function Argument
-1 IT$CS Clear screen
-2 IT$CAH Cursor home
-3 IT$CLEOS Clear to end of screen
-4 IT$CLEOL Clear to end of line
-5 IT$SBLINK Start flashing text
-6 IT$EBLINK End flashing text
-7 IT$SPA Start protected area
-8 IT$EPA End protected area
-9 IT$CUB Backspace No of characters (default 1)
-10 IT$CUU Cursor up No of lines (default 1)
-11 IT$SHALF Start half brightness
-12 IT$EHALF End half brightness
-13 IT$SREV Start reverse video
-14 IT$EREV End reverse video
-15 IT$SUL Start underline
-16 IT$EUL End underline
-17 IT$IL Insert line No of lines (default 1)
-18 IT$DL Delete line No of lines (default 1)
-19 IT$ICH Insert character No of characters (default 1)
-22 IT$DCH Delete character No of characters (default 1)
-23 IT$AUXON Turn on printer
-24 IT$AUXOFF Turn off printer
-29 IT$E80 Set 80 column mode
-30 IT$E132 Set 132 column mode
-31 IT$RIC Reset inhibit cursor
-32 IT$SIC Inhibit cursor
-33 IT$CUD Cursor down No of lines (default 1)
-34 IT$CUF Cursor forward No of characters (default 1)
-37 IT$FGC Set foreground colour Colour
-38 IT$BGC Set background colour Colour
-54 IT$SLT Set line truncation
-55 IT$RLT Reset line truncation
-58 IT$SBOLD Set bold mode
-59 IT$EBOLD Reset bold mode
-100 to -107 User definable via the u0 to u7 terminfo keys
-108 IT$ACMD Asynchronous command Command to execute
-109 IT$SCMD Synchronous command Command to execute
-250 IT$STYLUS PDA stylus control Non-zero = enable
-251 IT$KEYS PDA keyboard display Non-zero = enable
2.11-0
QMBasic Statements and Functions 55
3 IT$CYAN
4 IT$RED
5 IT$MAGENTA
6 IT$BROWN
7 IT$WHITE
8 IT$GREY
9 IT$BRIGHT.BLUE
10 IT$BRIGHT.GREEN
11 IT$BRIGHT.CYAN
12 IT$BRIGHT.RED
13 IT$BRIGHT.MAGENTA
14 IT$YELLOW
15 IT$BRIGHT.WHITE
ABORT {msg}
ABORTE {msg.key}
ABORTM {msg.text}
Terminates the current program, returning to the command prompt. ABORTE interprets
msg.key as a key to a message in the ERRMSG file. ABORTM treats msg.text as the actual
message. ABORT normally behaves as ABORTM but can be switched to behave as
ABORTE using the $MODE directive.
ABS(expr)
Returns absolute (positive) value of expr.
ABSS(expr)
Returns absolute (positive) value of each element of dynamic array expr.
ACCEPT.SOCKET.CONNECTION(srvr.skt, timeout)
Opens a data socket on a server to handle an incoming connection.
ACOS(expr)
Returns the arc-cosine of expr. Angles are measured in degrees. If expr is a dynamic array, the
function returns a similar dynamic array of results.
ALPHA(string)
Returns true (1) if string contains only alphabetic characters (A to Z, a to z). Returns false (0)
for a null string or a string that contains non-alphabetic characters.
ANDS(expr1, expr2)
Returns a dynamic array of results of logical AND operations between corresponding elements
of dynamic arrays expr1 and expr2.
ARG(n)
Returns argument n from the current subroutine. This is intended for use with subroutine
declared with the VAR.ARGS option.
ARG.COUNT()
Returns the number of arguments passed into a subroutine. This is intended for use with
subroutine declared with the VAR.ARGS option.
ARG.PRESENT()
Tests for presence of an argument variable in a subroutine or function declared with the
2.11-0
56 Quick Reference Guide
VAR.ARGS option.
ASCII(expr)
Returns the ASCII equivalent of the supplied EBCDIC string. Characters that have no ASCII
equivalent are returned as question marks.
ASIN(expr)
Returns the arc-sine of expr. Angles are measured in degrees. If expr is a dynamic array, the
function returns a similar dynamic array of results.
ASSIGNED(var)
Tests whether a variable is assigned.
ATAN(expr)
Returns the arc-tangent of expr. Angles are measured in degrees. If expr is a dynamic array, the
function returns a similar dynamic array of results.
BEGIN TRANSACTION
COMMIT / ROLLBACK
END TRANSACTION
Defines a transaction in which either all updates must be completed or discarded as a group.
BINDKEY(key.string, action)
Set, remove, query, save or restore key bindings.
BITAND(expr1, expr2)
Returns the bitwise AND of two integer values.
BITNOT(expr)
Returns the bitwise inverse of an integer values.
BITOR(expr1, expr2)
Returns the bitwise OR of two integer values.
BITRESET(expr, bit)
Returns the value of expr with the specified bit set to zero. Bits are numbered from 0 to 31 from
the least significant end of the value.
BITSET(expr, bit)
Returns the value of expr with the specified bit set to one. Bits are numbered from 0 to 31 from
the least significant end of the value.
BITTEST(expr, bit)
Returns the value of the specified bit of expr. Bits are numbered from 0 to 31 from the least
significant end of the value.
BITXOR(expr1, expr2)
Returns the bitwise exclusive or of two integer values.
2.11-0
QMBasic Statements and Functions 57
BEGIN CASE
CASE expr
statement(s)
CASE expr
statement(s)
END CASE
Executes the first set of conditioned statements for which expr is true. Use the pseudo
conditional element CASE 1 as the final test to include statements to be executed if none of the
preceding conditions were true.
CATALOGUED(name)
Test if name is in the system catalogue. Returns
0 the subroutine is not catalogued
1 the subroutine is catalogued locally as a V type VOC entry
2 the subroutine is catalogued privately
3 the subroutine is catalogued globally
CATS(string1, string2)
Returns the result of concatenating corresponding dynamic array components (fields, values and
subvalues) from the supplied strings.
CHAIN expr
The current program terminates immediately, discarding local variables but retaining common
variables. The command defined by expr is executed as though it replaced the sentence which
invoked the program in which the CHAIN statement occurs. If this sentence is in a paragraph,
the remainder of the paragraph will be executed when the CHAIN'ed program terminates.
CHAR(seq)
Returns a single character string containing the ASCII character with value seq. It is the inverse
of the SEQ() function.
CHECKSUM(data)
Returns a checksum value for the supplied data.
2.11-0
58 Quick Reference Guide
CHILD(userno)
Tests whether a phantom started by the current process is still running.
CLEAR
All local variables, including all elements of matrices, are set to zero. Files associated with local
file variables will be closed. The value of variables in common areas are not affected.
CLEARCOMMON {name}
CLEAR COMMON {name}
All variables in the common block identified by name are set to zero, the unnamed common
block if name is omitted. Other variables are not affected.
CLEARDATA
The data queue is cleared. Any keyboard type-ahead is not affected by this statement.
CLEARINPUT
CLEAR INPUT
Clears any type-ahead data. Data stored by the DATA statement is not affected.
CLEARSELECT {list.no}
CLEARSELECT ALL
CLEARSELECT var
Clears the specified (or all) select list.
CLOSE.SOCKET skt
Closes a socket.
COL1()
Used after a FIELD() function, returns the character position of the character immediately
preceding the extracted substring.
COL2()
Used after a FIELD() function, returns the character position of the character immediately
following the extracted substring.
COMMIT
Terminates a transaction, applying all cached updates to the database.
2.11-0
QMBasic Statements and Functions 59
CONFIG(param)
Retrieves the value of configuration parameters defined in the QM configuration file. If param is
not recognised as a value configuration parameter name, the function returns zero.
CONTINUE
Equivalent to a jump to the REPEAT or NEXT statement of the innermost loop structure.
COS(expr)
Returns the cosine of expr. Angles are measured in degrees. If expr is a dynamic array, the
function returns a similar dynamic array of results.
COUNT(string, substring)
Counts occurrences of substring within string.
COUNTS(string, substring)
Counts occurrences of substring within each element of dynamic array string, returning a
similar dynamic array of results.
2.11-0
60 Quick Reference Guide
CREATE file.var
{ON ERROR statement(s)}
{THEN statement(s)}
{ELSE statement(s)}
Creates an empty directory file record after a previous OPENSEQ has reported that the record
did not exist.
CROP(string)
Removes redundant mark characters from string.
CRT {print.list}
Displays the print.list item(s) on the user's terminal. Where multiple items are specified as a
comma separated lists, the display moves to the next tabulation column at each comma.
CSVDQ(string {, delimiter})
Dequotes a CSV string into a dynamic array.
DATE()
Returns the internal representation of the day number of the current date.
DCOUNT(string, delimiter)
Counts substrings delimited by delimiter within string.
DEBUG
Enters debug mode for the program in which it was executed and all programs called by it.
DECRYPT(data, key)
Decrypts data using the supplied key.
DEFFUN name {(arg1 {,arg2 ...})} {CALLING "subr" | LOCAL} {VAR.ARGS} {KEY key}
Defines a catalogued function that may be called from within the program. The optional
CALLING component allows the catalogue name of the function to be different from the name
of the function itself. The LOCAL keyword defines an internal function.
2.11-0
QMBasic Statements and Functions 61
DELETELIST name
Deletes the previously saved select list identified by name from the $SAVEDLISTS file. No
error occurs if the list does not exist.
DIR(pathname)
Returns the contents of an operating system directory.
DISINHERIT object
Disinherits an object, removing it from the name search when locating a public variable,
function or subroutine.
DISPLAY {print.list}
Displays the print.list item(s) on the user's terminal. Where multiple items are specified as a
comma separated lists, the display moves to the next tabulation column at each comma.
DIV(dividend, divisor)
Returns the quotient from a division operation.
DOWNCASE(string)
Returns the value of string with all letters converted to lower case.
2.11-0
62 Quick Reference Guide
DQUOTE(expr)
Returns a copy of its argument string enclosed in double quotes.
DQUOTES(dyn.array)
Returns a copy of the dynamic array argument with each element enclosed in double quotes.
DTX(expr {, min.width})
Converts the supplied expr value to hexadecimal. If the converted value is shorter than
min.width, leading zeros are added.
EBCDIC(expr)
Returns the EBCDIC equivalent of the supplied ASCII string. The action of this function with
non-ASCII characters is undefined.
ECHO OFF
ECHO ON
ECHO expr
ECHO OFF will suppress keyboard echo until a subsequent ECHO ON statement. The
ECHO expr format of this statement is equivalent to ECHO ON if the value of expr is
non-zero and ECHO OFF if expr is zero.
ENCRYPT(data, key)
Encrypts data using the supplied key.
END
The END statement terminates a program, subroutine or a block of statements conditioned by
the THEN, ELSE, LOCKED or ON ERROR keywords.
ENV(var.name)
Retrieves the named operating system environment variable, returning its value. If the variable is
not defined or var.name is invalid a null string is returned.
EPOCH()
Returns the internal representation of the date and time as an epoch value.
EQS(expr1, expr2)
Compares corresponding elements of the dynamic arrays expr1 and expr2, returning a similarly
structured dynamic array of true / false values indicating the results of the comparison.
2.11-0
QMBasic Statements and Functions 63
All forms of EQUATE can be abbreviated to EQU. Multiple tokens may be equated on a single
line by separating each definition by a comma.
The ERRMSG file entry consists of one or more fields, each prefixed by an action code. The
message is built up and displayed by processing each code in turn. The codes are:
A{n} Display the next argument left aligned in a field of n characters. If n is omitted, the
argument is displayed without any additional spaces.
B Sound the terminal "bell".
D Outputs the system date in the form dd mmm yyyy.
E Outputs the msg.id enclosed in square brackets.
Htext Outputs the given text.
L{n} Outputs n newlines. The value of n defaults to 1 if omitted.
R{n} Display the next argument right aligned in a field of n characters. If n is omitted,
the argument is displayed without any additional spaces.
Sn Displays n spaces.
T Outputs the system time in the form hh:mm:ss.
The component parts of the message are output with no insertion of newlines except as explicitly
specified in the ERRMSG entry.
2.11-0
64 Quick Reference Guide
EXIT
Equivalent to a jump to the statement following the REPEAT or NEXT statement of the
innermost loop structure.
EXP(expr)
Returns the exponential of expr, that is, the mathematical constant e raised to the power expr.
The value of e is about 2.71828. If expr is a numeric array (a dynamic array where all elements
are numeric), the EXP() function operates on each element in turn and returns a numeric array
with the same structure as expr.
2.11-0
QMBasic Statements and Functions 65
FILE.EVENT(path, event)
Create a file event monitoring variable.
FILEINFO(file.var, key)
Returns information about an open file. The key value may be:
0 FL$OPEN Check if file is open. Returns true (1) if file.var is associated
with an open file, false (0) if it is not.
1 FL$VOCNAME Returns the VOC name used to open the file.
2 FL$PATH Returns pathname of open file.
3 FL$TYPE File type. Returns one of
FL$TYPE.DH (3) Dynamic file
FL$TYPE.DIR (4) Directory file
FL$TYPE.SEQ (5) Sequential file
FL$TYPE.VFS (6)Virtual file system
5 FL$MODULUS File modulus (dynamic files only)
6 FL$MINMOD Minimum modulus (dynamic files only)
7 FL$GRPSIZE Group size (dynamic files only)
8 FL$LARGEREC Large record size (dynamic files only)
9 FL$MERGE Merge load percentage (dynamic files only)
10 FL$SPLIT Split load percentage (dynamic files only)
11 FL$LOAD Current load percentage (dynamic files only)
13 FL$AK File has alternate key indices (dynamic files only)
14 FL$LINE Line to read or write next (sequential files only)
1000 FL$LOADBYTES Current load bytes (dynamic files only)
1001 FL$READONLY Returns true (1) is file is read-only
1002 FL$TRIGGER Returns trigger function name, null if none
1003 FL$PHYSBYTES Returns total size of file, excluding indices
1004 FL$VERSION Internal file version number (dynamic files only)
1005 FL$STATS.QUERY Returns true (1) if file statistics gathering is enabled
1006 FL$SEQPOS File position (sequential files only)
1007 FL$TRG.MODES Returns trigger mode flags
1008 FL$NOCASE Returns true (1) if file uses case insensitive record ids.
1009 FL$FILENO Returns the internal file number for file.var. This may change
each time the file is opened.
1011 FL$AKPATH Returns the pathname of the alternate key index directory. This
is a null string in the indices are in their default location.
1012 FL$ID Returns the id of the last record read from the file.
1013 FL$STATUS Returns a dynamic array as for the STATUS statement.
1014 FL$MARK.MAPPING Returns true if mark mapping is enabled, false if not
(directory files).
1015 FL$RECORD.COUNT Returns a count of the number of records in the file
(dynamic files only).
1016 FL$PRI.BYTES Physical size of the primary subfile in bytes (dynamic files
only). This figure will include space previously used by groups
that have been discarded as the result of a merge operation.
1017 FL$OVF.BYTES Physical size of the overflow subfile in bytes (dynamic files
only). This figure will include space previously used by
overflow blocks that are no longer active and are retained for
future use.
1018 FL$NO.RESIZE Is resizing inhibited on this file?
1019 FL$UPDATE Update count, incremented by every write, delete or clear file.
1020 FL$ENCRYPTED Returns true if file uses encryption.
1021 FL$WHO Returns field mark delimited list of QM users numbers for
2.11-0
66 Quick Reference Guide
users who have the file open. The process that executes the
FILEINFO() function will not appear in this list if file.var is
the only file variable referencing the file.
1022 FL$NETFILE Returns true if this is a QMNet file, otherwise returns false.
1023 FL$SEQTYPE Sequential file sub-type:
FL$SEQTYPE.PORT (1) - Serial port
FL$SEQTYPE.CHDEV (2) - Character device
FL$SEQTYPE.FIFO (3) - FIFO
FL$SEQTYPE.DRIVE (4) - Disk drive or other block
device
1024 FL$REPLICATED Returns a field mark delimited list of replication targets.
1025 FL$NOMAP Returns true if this is a directory file with character translation
of record ids suppressed.
FLUSH file.var
{THEN statement(s)}
{ELSE statement(s)}
Flushes pending writes to a sequential file to disk.
FMT(expr, fmt.spec)
Formats expr in a manner defined by fmt.spec.
2.11-0
QMBasic Statements and Functions 67
FMTS(expr, fmt.spec)
Identical to FMT() except that it works on each element of dynamic array expr in turn, returning
the result in a similarly delimited dynamic array.
The footing text may include the following control tokens enclosed in single quotes. Multiple
tokens may appear within a single set of quotes.
C Centres text on the line
D Insert the current date in the form mm/dd/yy
G Insert a gap. Spaces are inserted in the footing line at the position of each G control
token such that the overall length of the line is the same as the printer unit width. A
single use of the G token will right justify the subsequent text. Multiple G tokens will
distribute spaces as evenly as possible.
Hn Sets horizontal position (column), numbered from 1.
L Start a new line
N Inhibit automatic display pagination
O Reverses the elements separated by G tokens in the current line on even numbered
pages. This is of use when printing double sided reports.
Pn Inserts the page number, right justified in n spaces. If omitted, n defaults to 4.
Sn Inserts the page number, left justified in n spaces. If omitted, n defaults to 1.
T Insert current date and time in the form hh:mm:ss mm/dd/yy
2.11-0
68 Quick Reference Guide
GES(expr1, expr2)
Compares corresponding elements of the dynamic arrays expr1 and expr2, returning a similarly
structured dynamic array of true / false values indicating the results of the comparison.
GET.MESSAGES()
Returns any messages currently queued for display.
GET.PORT.PARAMS(fvar)
Returns a dynamic array containing the communications parameters for a serial port.
GETNLS(key)
Returns the value of the named national language support parameter. Available parameters are:
1 NLS$CURRENCY Default currency symbol. Maximum 8 characters.
2 NLS$THOUSANDS Default thousands separator character.
3 NLS$DECIMAL Default decimal separator character.
GETPU(key, unit)
Returns the print unit characteristic specified by key. Possible values of key are:
0 PU$DEFINED Is print unit defined?
1 PU$MODE Print unit mode
2 PU$WIDTH Characters per line
3 PU$LENGTH Lines per page
4 PU$TOPMARGIN Top margin size
2.11-0
QMBasic Statements and Functions 69
GETREM(string)
Returns the offset of the remove pointer into string. The remove pointer is positioned on the
character preceding the next fragment to be extracted. It is reset to zero when a new value is
assigned to the string.
GOSUB label{:}
Enters the subroutine at the named label, saving the return address for a later RETURN.
GOSUB label{:}(args)
Enters the subroutine named label defined by a LOCAL SUBROUTINE statement, saving the
return address for a later RETURN.
GOTO label{:}
GO {TO} label{:}
The program continues execution at the given label.
GTS(expr1, expr2)
Compares corresponding elements of the dynamic arrays expr1 and expr2, returning a similarly
structured dynamic array of true / false values indicating the results of the comparison.
in which the text is output. A page heading is output whenever the first line of output on a page
is about to be printed or displayed. The HEADING statement normally causes subsequent
output to appear on a new page. The NO.EJECT option defers the new heading until the start
of the next page.
The heading text may include the following control tokens enclosed in single quotes. Multiple
tokens may appear within a single set of quotes.
C Centres text on the line
D Insert the current date in the form mm/dd/yy
G Insert a gap. Spaces are inserted in the footing line at the position of each G control
token such that the overall length of the line is the same as the printer unit width. A
single use of the G token will right justify the subsequent text. Multiple G tokens will
distribute spaces as evenly as possible.
Hn Sets horizontal position (column), numbered from 1.
L Start a new line
N Inhibit automatic display pagination
O Reverses the elements separated by G tokens in the current line on even numbered
pages. This is of use when printing double sided reports.
Pn Inserts the page number, right justified in n spaces. If omitted, n defaults to 4.
Sn Inserts the page number, left justified in n spaces. If omitted, n defaults to 1.
T Insert current date and time in the form hh:mm:ss mm/dd/yy
The optional SETTING clause saves the previous state of display output control in var which
can be used later to revert to that state. Alternatively, the previous state can be obtained using
the STATUS() function immediately after the HUSH statement. In either case, the value is 1 if
output was suppressed or 0 if it was enabled.
ICONV(expr, conv.spec)
Performs input conversion. Data in expr is converted from its external representation to the
internal form.
ICONVS(dynarray, conv.spec)
Performs intput conversion. Data in each element of dynarray is converted from its external
representation to the internal form to construct an equivalent dynamic array of converted values.
IDIV(dividend, divisor)
Returns the result of dividing integer value dividend by integer value divisor, rounded towards
zero.
2.11-0
QMBasic Statements and Functions 71
IF expr THEN
statement(s)
{END ELSE
statement(s)}
END
Executes one or other set of conditioned statements depending on the value of expr. The ELSE
clause is optional.
A single IF statement may mix both the single line and multi-line formats.
INDICES(file.var)
Returns a field mark delimited list of alternate key index names for the file referenced via
file.var.
INDICES(file.var, index.name)
Returns a dynamic array resembling a dictionary record for the index named by the index.name
argument. This dynamic array has at least the following content. Other dictionary fields may
also be present.
Field 1 D or I dependant on the index type. Additionally, this field may be
multivalued:
Value 2 Set to 1 if the index needs to be built, otherwise null
Value 3 Set to 1 if the index is null-suppressed (NO.NULLS option to
CREATE.INDEX), otherwise null
Value 4 Set to 1 if updates are enabled, otherwise null
Value 5 Internal AK number
Value 6 Sort mode of keys within an index entry
Value 8 Set to 1 if the index is case insensitive, otherwise null
Value 9 Set to 1 if the index is being built, otherwise null
Field 2 The field number (D-type) or the virtual attribute expression (I-type)
Field 5 L or R indicating whether the index is based on a left or right aligned sort
Field 6 S or M indicating whether the indexed data may be multi-valued
Field 16+ The compiled version of an I-type index
2.11-0
72 Quick Reference Guide
INHERIT object
Inherits an object, adding it from the name search when locating a public variable, function or
subroutine.
INMAT()
Returns information relating to the last use of the following statements:
DIMENSION 0 if successful, 1 if insufficient memory.
MATPARSE The number of elements assigned. Zero if overflows.
MATREAD The number of elements assigned. Zero if overflows.
MATREADL The number of elements assigned. Zero if overflows.
MATREADU The number of elements assigned. Zero if overflows.
OPEN The modulus of a dynamic file.
INMAT({mat})
Returns the current dimensions of the matrix. If mat is a single dimensional matrix, INMAT()
returns the number of elements, excluding the zero element. If mat is a two dimensional matrix,
INMAT() returns the number of rows and columns as two values separated by a value mark.
INPUT @(col,row) {:} var {, length} {_} {:} {APPEND} {EDIT} {HIDDEN} {OVERLAY}
{PANNING} {TIMEOUT wait} {UPCASE}
{THEN statements} { ELSE statements}
Input data from keyboard or DATA queue at the specified screen position.
INPUTCLEAR
Any type-ahead data is cleared. Data stored by the DATA statement is not affected.
INPUTERR expr
Displays an error message which is removed from the screen when the next input is entered.
INPUTFIELD @(x, y) {,} {:} var, length {_} {:} {format} {APPEND} {EDIT} {HIDDEN}
{OVERLAY} {PANNING} {TIMEOUT wait} {UPCASE}
{THEN statements} { ELSE statements}
Input data from keyboard or DATA queue with special handling of control codes.
INT(expr)
Returns the integer value of expr, rounded towards zero.
ITYPE(itype)
Executes the compiled I-type expression in the supplied dictionary style record. @RECORD and
@ID are used as source data for the calculation.
2.11-0
QMBasic Statements and Functions 73
KEYCODE({timeout})
Reads a single keystroke from the keyboard, using the terminfo database to recognise standard
control codes.
KEYIN({timeout})
Reads a single keystroke from the keyboard.
KEYINC({timeout})
Reads a single keystroke from the keyboard, honouring case inversion.
KEYINR({timeout})
Reads a single keystroke from the keyboard in raw mode (no internal processing).
KEYREADY()
Tests for data entered at the keyboard.
LEN(string)
Returns the length of a string.
LENS(string)
Returns the length of a length of each element of a dynamic array.
LES(expr1, expr2)
Compares corresponding elements of the dynamic arrays expr1 and expr2, returning a similarly
structured dynamic array of true / false values indicating the results of the comparison.
LN(expr)
Returns the natural log of a value.
2.11-0
74 Quick Reference Guide
LOGMSG text
Add a message to the system error log.
LOOP
statement(s)
REPEAT
Repeats the enclosed statements until the loop is terminated. See also CONTINUE, WHILE,
UNTIL and EXIT.
LOWER(string)
Converts mark characters in a string to the next lower level mark.
LTS(expr1, expr2)
Compares corresponding elements of the dynamic arrays expr1 and expr2, returning a similarly
structured dynamic array of true / false values indicating the results of the comparison.
MATCHESS(dyn.arr, pattern)
Matches each element of a dynamic array against a pattern, returning an equivalently structured
dynamic array of true/false values.
2.11-0
QMBasic Statements and Functions 75
MAX (a, b)
Returns the greater of two values.
MAXIMUM(dyn.array)
Returns the greatest numeric value in a dynamic array.
MD5 (string)
Returns the 32 digit MD5 message digest value for the given string.
MIN (a, b)
Returns the lesser of two values.
MINIMUM(dyn.array)
Returns the lowest numeric value in a dynamic array.
MOD(dividend, divisor)
Returns the modulus value of one value divided by another.
MODS(dividend, divisor)
Returns a dynamic array of the modulus values for division of corresponding elements of two
dynamic arrays.
MVDATE(epoch)
Returns the multivalue style date from an epoch value.
MVTIME(epoch)
Returns the multivalue style time from an epoch value.
MVEPOCH(time.string)
MVEPOCH(date, time)
Returns the epoch value for a given multivalue style date and time.
2.11-0
76 Quick Reference Guide
MVDATE.TIME(epoch)
Returns the multivalue style date and time from an epoch value.
NAP time
Causes the program to pause for a given number of milliseconds.
NEG(expr)
Returns the arithmetic inverse of a value.
NEGS(dynarray)
Returns the arithmetic inverse of each element of a dynamic array.
NES(expr1, expr2)
Compares corresponding elements of the dynamic arrays expr1 and expr2, returning a similarly
structured dynamic array of true / false values indicating the results of the comparison.
NOBUF file.var
{THEN statement(s)}
{ELSE statement(s)}
Turns off buffering for a record opened using OPENSEQ.
NOT(expr)
Returns the logical inverse expr.
NOTS(dynarray)
Returns the logical inverse of each element of a dynamic array.
NULL
Performs no action.
NUM(string)
Tests whether a string can be converted to a number.
NUMS(dynarray)
Tests whether each element of a dynamic array can be converted to a number.
OBJECT(cat.name {, args})
Instantiates an object defined by the class module catalogued as cat.name.
OBJINFO(var , key)
Returns information about an object variable.
0 OI$ISOBJ Is var an object variable?
1 OI$CLASS Class module catalogue name
OCONV(expr, conv.spec)
Performs output conversion. Data in expr is converted from its internal representation to the
external form.
OCONVS(dynarray, conv.spec)
Performs output conversion. Data in each element of dynarray is converted from its internal
representation to the external form to construct an equivalent dynamic array of converted values.
2.11-0
QMBasic Statements and Functions 77
ORS(expr1, expr2)
Constructs the logical or of corresponding elements of two dynamic arrays, returning a similarly
structured dynamic array of true / false values.
OS.ERROR()
Returns operating system error information.
OSDELETE path
Deletes an operating system file by pathname.
2.11-0
78 Quick Reference Guide
PAUSE {timeout}
Suspend execution until awoken by another process.
PRECISION expr
Sets the maximum number of decimal places to appear when converting numeric values to
strings.
PRINTER ON
PRINTER OFF
Determine whether output from PRINT statements to the default print unit (unit 0) is directed to
the display or to the printer.
2.11-0
QMBasic Statements and Functions 79
PRINTER RESET
Resets the default print unit and display output.
PRINTERR expr
Displays an error message which is removed from the screen when the next input is entered.
PROCWRITE expr
Writes data to the PROC primary input buffer.
PROGRAM name
Introduces a program.
PROMPT expr
Sets the character to be used as the prompt in INPUT statements.
PTERM(key, value)
Sets, clears or queries a terminal setting. Possible values of key are:
1 PT$BREAK Interpret break character as break key? (boolean)
2 PT$INVERT Invert case of alphabetic characters on input? (boolean)
3 PT$BRKCH Sets break character to be char(value). The value must be in the
range 1 to 31. For any other value, the current setting is returned.
4 PT$PAGE.PAUSE Set/clear page pause (boolean)
5 PT$MARK Set/clear translation of characters 28-30 on keyboard input to field,
value and subvalue marks. (boolean)
PWR(expr, pwr.expr)
Returns the value of a number raised to a given power.
QUOTE(expr)
Returns a copy of its argument string enclosed in double quotes.
QUOTES(dyn.array)
Returns a copy of the dynamic array argument with each element enclosed in double quotes.
RAISE(string)
Converts mark characters in a string to the next higher level mark.
2.11-0
80 Quick Reference Guide
RANDOMIZE expr
Initialises the random number generator.
RDIV(dividend, divisor)
Returns the rounded integer result of dividing two values
2.11-0
QMBasic Statements and Functions 81
RECORDLOCKED(file.var, record.id)
The RECORDLOCKED() function indicates whether a given record is locked. Return values
are:
Value Token Lock state
-3 LOCK$OTHER.FILELOCK Another user holds a file lock
-2 LOCK$OTHER.READU Another user holds an update lock
-1 LOCK$OTHER.READL Another user holds a read lock
0 LOCK$NO.LOCK The record is not locked
1 LOCK$MY.READL This user holds a read lock
2 LOCK$MY.READU This user holds an update lock
3 LOCK$MY.FILELOCK This user holds a file lock
2.11-0
82 Quick Reference Guide
REM(dividend, divisor)
Returns the remainder when one value is divided by another.
REMARK text
REM text
Enters comment text into a program.
REMOVE.BREAK.HANDLER
Deactivates a break handler previously established to be called on use of the break key.
RETURN
Returns from a local subroutine entered by GOSUB or an external subroutine entered by CALL
.
RETURN expr
Returns from a function, passing expr to the caller as the value of the function.
RETURN TO label{:}
Exits from a local subroutine entered by GOSUB, discarding the return address and jumping to
label. If not in a local subroutine, this statement returns from the program.
REUSE(num.array)
Determines how arithmetic operators applied to numeric arrays handle unequal numbers of
fields, values or subvalues.
RND(expr)
Returns a random integer within a range defined by expr.
ROUNDDOWN(value, increment)
Returns value rounded towards zero in steps of increment.
ROUNDUP(value, increment)
Returns value rounded away from zero in steps of increment.
ROLLBACK
Terminates a transaction, discarding all cached updates.
2.11-0
QMBasic Statements and Functions 83
RQM {time}
Causes the program to pause for a given number of seconds or until a specific time.
SELECT.SOCKET(skt.array, timeout)
Monitor events on multiple sockets.
SELECTE TO list.var
Transfers the default select list to a select list variable.
SELECTINFO(list.no, key)
SELECTINFO(var, key)
Returns information about a select list.
SENTENCE()
Returns the command line that started the current program (Same as @SENTENCE).
2.11-0
84 Quick Reference Guide
SEQ(char)
Returns the ASCII character set position value of a character.
SERVER.ADDR(server.name)
Returns the IP address for the given server name.
SET.BREAK.HANDLER handler
Establishes a break handler to be called on use of the break key.
SET.EXIT.STATUS value
Sets the final exit status returned by QM to the operating system.
SET.PORT.PARAMS(fvar, params)
Sets the communications parameters for a serial port.
SET.TIMEZONE zone
Sets time zone for use by the epoch conversion code.
2.11-0
QMBasic Statements and Functions 85
output
1008 PU$SPOOLER Spooler to be used (ignored on Windows)
1009 PU$OVERLAY Catalogued subroutine name for graphical page overlay
1010 PU$CPI Characters per inch (may be non-integer value)
1011 PU$PAPER.SIZE See SYSCOM KEYS.H for size tokens
1012 PU$LPI Lines per inch. Must be 1, 2, 3, 4, 6, 8, 12, 16, 24, 48
1013 PU$WEIGHT Font stroke weight. See SYSCOM PCL.H
1014 PU$SYMBOL.SET Symbol set. See SYSCOM PCL.H
1015 PU$STYLE Query processor style. See the Query processor STYLE
option.
1016 PU$NEWLINE Newline string for this print unit.
1017 PU$PRINTER.NAME Name of printer.
1018 PU$FILE.NAME File name for output directed to a file.
1021 PU$FORM.FEED Form feed string for this print unit.
SHIFT(value, shift.len)
Performs a logical right bit-shift of shift.len places on integer value. A negative shift.len shifts
left.
SIN(expr)
Returns the sine of a value.
SLEEP {time}
Causes the program to pause for a given number of seconds or until a specific time.
SOCKET.INFO(skt, key)
Returns information about an open socket.
SOUNDEX(string)
Returns a four character string determined by the phonetic content of a string,
SOUNDEXS(string)
Constructs a dynamic array in which each element consists of the phonetic Soundex code for the
content of the corresponding element of dynarray,
SPACE(count)
Returns a string consisting of a given number of spaces.
SPACES(dynarray)
Constructs a dynamic array in which each element consists of the number of spaces specified by
the corresponding element of dynarray.
SQRT(expr)
Returns the square root of a value.
SQUOTE(expr)
Returns a copy of its argument string enclosed in single quotes.
2.11-0
86 Quick Reference Guide
SQUOTES(dyn.array)
Returns a copy of the dynamic array argument with each element enclosed in single quotes.
STATUS()
Returns information following execution of certain other statements. In many cases, this
information gives details of an error condition.
STOP {expr}
Terminates the current program. The interpretation of expr depends on the setting of the
PICK.ERRMSG option.
STOPE {expr}
Terminates the current program using Pick style message handling.
STOPM {print.list}
Terminates the current program, displaying print.list.
STR(string, count)
Returns a string made up of a given number of repeated occurrences of another string.
STRS(dynarray, count)
Returns a dynamic array made up of count occurrences of each element of dynarray.
SUM(expr)
Eliminates the lowest level of a dynamic array by adding the elements to form an item of the
next highest level.
SUMMATION(expr)
Returns the total value of all elements of a numeric array.
2.11-0
QMBasic Statements and Functions 87
SWAPCASE(string)
Inverts the case of all alphabetic characters in a string.
SYSTEM(key)
Returns information regarding the status of various aspects of the system.
Key Function
1 Returns 1 if a PRINTER ON statement is in effect
2 Current page width of the default print unit
3 Current page length of the default print unit
4 Lines remaining on current page of the default print unit
5 Current page number of the default print unit
6 Current line number of the default print unit
7 Terminal type (same as @TERM.TYPE)
9 Cumulative processor time used (mS) by the QM session
10 Input waiting in the DATA queue? (1 if so, 0 if not)
11 Select list 0 active? (1 if so, 0 if not)
12 Time in seconds since midnight (same as TIME())
18 User number (same as @USERNO)
19 Returns a unique value formed from the internal form date and time as two five
digit numbers. If the function is used more than once system wide in the same
second, an alphabetic suffix is added to create a unique value.
23 Break key enabled? (1 if so, 0 if not)
24 Input echo enabled? (1 if so, 0 if not)
25 Is this a phantom process?
26 Returns the current input prompt character
27 Returns the operating system uid for the user's process. (Not Windows or PDA)
28 Returns the operating system effective uid for the user's process. (Not Windows or
PDA)
29 Returns the operating system gid for the user's process. (Not Windows or PDA)
30 Returns the operating system effective gid for the user's process. (Not Windows or
PDA)
31 Licence number
32 Returns the system directory pathname
38 Returns temporary directory pathname
42 Returns telnet connection IP address, null for a console user
91 Returns 1 on Windows, 0 on Linux or FreeBSD
1000 Returns 1 if EXECUTE CAPTURING is in effect, 0 otherwise
1001 Returns 1 if case inversion is enabled, 0 otherwise
1002 Returns the program call history. This is a dynamic array in which each program is
represented by a field, the current program being in field 1. The first value in each
field contains the program name. Subsequent values are divided into two
subvalues containing the program address and line number (where available) for
each internal subroutine call (GOSUB) in the program.
1003 Returns a dynamic array containing a list of open files. Each field has two values;
the first holds the internal file number, the second holds the file's pathname.
1004 Returns the peak number of files that have been open at one time since QM was
started.
1005 Returns the combined date and time value as DATE() * 86400 + TIME().
2.11-0
88 Quick Reference Guide
TAN(expr)
Returns the tangent of a value.
TCLREAD var
Returns the sentence that started the current program (Similar to use of as @SENTENCE).
TERMINFO()
TERMINFO(cap.name)
Returns information from the terminfo database.
TESTLOCK(lock.num)
Returns the owner of a task lock, zero if free.
2.11-0
QMBasic Statements and Functions 89
TIME()
Returns the current time as the number of seconds since midnight.
TIMEDATE()
Returns the current time and date as a 20 character string in the form hh:mm:ss dd mmm yyyy
TOTAL(expr)
Accumulates totals for use with the CALC query processor keyword (Only in dictionary I-type
items).
TRANSACTION ABORT
Aborts a transaction.
TRIM(string)
Returns a copy of string with all leading and trailing spaces removed and multiple embedded
spaces compressed to a single space.
TRIMB(string)
Removes trailing spaces from a string.
TRIMBS(dynarray)
Returns a dynamic array with trailing spaces removed from each element of dynarray.
TRIMF(string)
Removes leading spaces from a string.
2.11-0
90 Quick Reference Guide
TRIMFS(dynarray)
Returns a dynamic array with leading spaces removed from each element of dynarray.
TRIMS(dynarray)
Returns a dynamic array with all leading and trailing spaces removed and multiple embedded
spaces compressed to a single space in each element of dynarray.
TTYGET()
Returns a dynamic array containing the current terminal settings.
Field Content
1 Ctrl-C treated as the break key? (PTERM BREAK mode)
2 Case inversion on? (PTERM CASE mode)
3 Break character value (PTERM BREAK n)
4 Output newline sequence (PTERM NEWLINE)
5 Input return key code (PTERM RETURN)
TTYSET var
Sets the terminal modes.
UNASSIGNED(var)
Tests whether a variable is unassigned.
UNTIL expr
Used in conjunction with the FOR / NEXT or LOOP / REPEAT constructs to determine
whether execution of the loop should continue.
UPCASE(string)
Returns a string with all letters converted to upper case.
VOCPATH(filename {, dict.flag})
Uses the VOC to return the pathname of the supplied filename.
VOID expr
Evaluates an expression and discards the result.
2.11-0
QMBasic Statements and Functions 91
VSLICE(string, vpos)
Returns a string formed by extracting a given value position from a dynamic array.
WAIT.FILE.EVENT(event, timeout)
Wait for a file monitoring event.
WAKE user.no
Resume execution of another process that has executed a PAUSE.
WHILE expr
Used in conjunction with the FOR / NEXT or LOOP / REPEAT constructs to determine
whether execution of the loop should continue.
2.11-0
92 Quick Reference Guide
XTD(expr)
Converts the supplied hexadecimal string in expr to a number.
2.11-0
Standard QMBasic Subroutines 93
!ATVAR(value, name)
Retrieves the value of an @-variable.
!ERRTEXT(errno)
Returns the text description for a QM error number.
!LISTU(dyn.array)
Returns raw data as used by the LISTU command.
!PATHTKN(outpath, inpath)
Processes special tokens in a VOC or ACCOUNTS file pathname.
!SETVAR(name, value)
Sets the value of a user defined @-variable.
!USERNAME(name, userno)
Returns the user login name for a given QM user number.
!USERNO(userno, name)
Returns the QM user numbers for users logged in with the given user name.
!VOCREC(rec, id)
Reads a VOC record, following remote record pointers.
PCL.xxx() Functions
These all map onto calls to the !PCL() subroutine via definitions in the PCL.H include record. See
2.11-0
94 Quick Reference Guide
the QM Reference Manual or the online help for details of the arguments to these functions.
PCL.COPIES(copies)
Sets the number of copies to be printed.
PCL.CURSOR(x, y)
Sets the current cursor position.
PCL.DUPLEX(mode)
Sets duplex mode. 0 = off, 1 = long edge binding, 2 = short edge binding.
PCL.FONT(font)
Sets the font details for text output.
PCL.ORIENTATION(layout)
Specifies the page format.
PCL.PAPER.SIZE(size)
Specifies the page size.
PCL.RESET()
Resets the printer.
PCL.RESTORE.CSR()
Restores a previously saved cursor position.
PCL.SAVE.CSR()
Saves the current cursor position.
2.11-0
QMBasic Debugger 95
11 QMBasic Debugger
Word Based Commands (uppercase letters are the short form where appropriate)
ABORT Quit the program, generating an abort.
BRK {n} Set a breakpoint on line n. Shows breakpoints if n omitted.
CLR Clear all breakpoints.
CLR n Clear breakpoint on line n.
DUMP var path Dumps a variable to an operating system level file.
EP Exit program, returning to parent program or external subroutine.
EXit Exit subroutine, returning to parent program, internal or external
subroutine.
Goto n Continue execution at line n.
HELP Display help page.
PDUMP Generate a process dump file.
Quit Quit the program, generating an abort
Run Free run.
Run n Run to line n.
SET var = value Change content of a program variable
STACK Display call stack, most recent program first.
Step n Execute n lines.
Step .n Execute n elements.
StepOver Step over subroutine call (internal or external)
STOP Quit the program, generating a stop.
UnWatch Cancels an active watch action.
View Display user screen (normal program output)
Watch {var} Watches the named variable. Shows watched variable if var omitted.
Watch var op value Watches the named variable, stopping when the condition is met.
XEQ command Execute command.
2.11-0
96 Quick Reference Guide
Displaying Variables
var/ Displays the content of variable var
var(index)/ Displays an element of dimensioned matrix var
var<f,v,s>/ Displays a field, value or subvalue of variable var
/* Displays all variables (full screen mode only)
Alternative syntaxes of /var, var? and ?var are provided for compatibility with other environments.
2.11-0
QMClient Visual Basic API 97
1 SV_ON_ERROR Action took the ON ERROR clause to recover from a situation that
would otherwise cause the server process to abort.
2 SV_ELSE Action took the ELSE clause. In most cases the QMStatus() function
can be used to determine the error number.
3 SV_ERROR An error occurred for which extended error text can be retrieved using
the QMError() function.
4 SV_LOCKED The action was blocked by a lock held by another user. The
QMStatus() function can be used to determine the blocking user.
5 SV_PROMPT A command executed on the server is waiting for input. The only valid
client functions when this status is returned are QMRespond(),
QMEndCommand and QMDisconnect.
Value = QMChecksum(String)
Calculate checksum value for given string.
QMClearSelect ListNo
Clears a select list.
QMClose FileNo
Closes a file.
Ok = QMConnectLocal(Account)
Establishes a QMClient session on the local system as the current user.
Ok = QMConnected()
Confirms whether a QMClient session is open.
QMConnectionType Type
Sets parameters that will be used for the next session opened.
2.11-0
98 Quick Reference Guide
Ct = QMDcount(Src, Delim)
Counts delimited items in a string.
QMDelete FileNo, Id
Deletes a record from a file.
QMDeleteu FileNo, Id
Deletes a record from a file, retaining the record lock.
QMDisconnect
Terminates a QMClient session.
QMDisconnectAll
Terminates all open QMClient sessions.
QMEndCommand
Aborts a command executed on the server that is requesting input.
Text = QMError()
Returns extended error message text.
QMFree(addr)
Releases dynamic memory returned by other API functions (C API only).
Session = QMGetSession()
Returns the session number for the currently selected QMClient session.
Ok = QMLogto(Account)
Moves to an alternative account.
2.11-0
QMClient Visual Basic API 99
FileNo = QMOpen(FileName)
Opens a file.
QMRelease FileNo, Id
Releases a record lock.
Text = QMRevision()
Returns the revision numbers of the client and server components.
2.11-0
100 Quick Reference Guide
Bool = QMSetSession(Session)
Selects an open QMClient session.
Code = QMStatus()
Returns the value of the QMBasic STATUS() function for the last server function executed.
QMTrapCallAbort Mode
Enables or disables client side trapping of aborts in QMCall.
2.11-0
Conversion Codes 101
13 Conversion Codes
A - A-correlative
A;expr Executes A-correlative expression expr interpretively.
B - Boolean
Input: Accepts N and Y, upper or lowercase, returning 0 for N and 1 for Y.
Output: Returns N for false, Y for true.
B64 - Base64
Input: Converts from base64 encoding.
Output: Converts to base64 encoding.
C - Concatenation
C{;} c expr c expr …
D - Date
D {y} {c} {fmt} {[f1, f2, f3, f4, f5]}
2.11-0
102 Quick Reference Guide
E - Epoch
E {y} {c} {fmt} {[f1, f2, f3, f4, f5]}
F - F-correlative
F;expr Executes F-correlative expression expr interpretively.
G - Group
Gcn Returns the first n components of the source data delimited by character c.
Gscn Skips s components and then returns the next n components of the source data
delimited by character c.
IS, IL - Integer
IS Converts a QMBasic integer value to a hardware specific short integer (16 bits).
2.11-0
Conversion Codes 103
IL Converts a QMBasic integer value to a hardware specific long integer (32 bits).
ISL, ILL As IS and IL but forcing use of a low byte first representation.
ISH, ILH As IS and IL but forcing use of a high byte first representation.
L - Length
L Returns the length of the string being converted.
Ln Returns the original string if its length is less than or equal to n. Otherwise it returns
a null string.
Ln,m Returns the original string if its length is greater than or equal to n and less than or
equal to m. Otherwise it returns a null string.
MC - Character
MCA Delete all non-alphabetic characters
MC/A Delete all alphabetic characters
MCAN Delete all non-alphanumeric characters
MC/AN Delete all alphanumeric characters
MCL Convert to lower case
MCN Delete all non-numeric characters
MC/N Delete all numeric characters
MCP Replace non-printing characters by dots
MCT Capital initial all words
MCU Convert to uppercase
2.11-0
104 Quick Reference Guide
T specifies that trailing decimal places should be truncated rather than rounded on
output conversion.
x{c} specifies the field width and fill character.
fx specifies padding. f is * for asterisk, # for space, % for zero. x is the field width. This
element can be a complete format mask (e.g. #3-#4). When the
PICK.ML.CONV.MASK mode of the OPTION command is in effect, the fx element
may be enclosed in round brackets in ML and MR conversions.
The x{c} and fx padding specifications cannot be used together.
MT - Time
MT {H} {S} {c}
H specifies that 12-hour format with either AM or PM appended is to be used.
S specifies that output conversion is to include the seconds field.
c is the character to separate the hours, minutes and seconds fields.
P - Pattern Matching
P(template){;(template)...}
Attempts to match the input data against each template in turn. If a match is found, the original
data is returned. Otherwise a null string is returned.
R - Range Check
Rn,m{;n,m...}
Tests whether the input data is an integer value in the range n to m. If so, the input data is
returned. If not, a null string is returned.
S - Substitution
S;value1;value2
Returns a value determined by value1 if the source data is not zero or null, a value determined
by value2 if the source data is zero or null. The value1 and value2 items may be:
0 Returns the value of @ID
number Returns the specified field from @RECORD
* Returns the source data unchanged
'text' Returns the given text string. The string may be enclosed in single quotes, double
quotes or backslashes.
2.11-0
Conversion Codes 105
T - Text substring
Tm{,n}
Returns n characters starting at character m of the source data. If n is omitted, the last m
characters of the source data are returned.
2.11-0
106 Quick Reference Guide
14 Format codes
n The number of decimal places to appear in the result when formatting numeric
data.
mask A mask to be used to format the data. If omitted, field.width must be specified.
Both can be used together.
2.11-0
Format codes 107
Where the mask specifies more characters than in the data being converted,
positions corresponding to # characters in the mask are replaced by the fill.char
, positions corresponding to * characters in the mask are replaced by asterisks
and positions corresponding to % characters in the mask are replaced by zeros.
If the data is left aligned, the padding is inserted in the rightmost positions. If
the data is right aligned, the padding is inserted in the leftmost positions.
If the mask specifies fewer characters than in the data being converted, part of
the source data will be lost. A left aligned format will truncate the source data
and a right aligned format will lose data from the start of the source.
2.11-0
108 Quick Reference Guide
15 ED Commands
Positioning Commands
n Move to line n.
+n Move forwards n lines.
-n Move backwards n lines.
B Move to the last line of the record.
F{n} {string} Move forward to the next line containing string starting at column position n
(from one).
Gn Move to line n.
G< Move to the first line of the currently defined block.
G> Move to the last line of the currently defined block.
L {string} Move forward to the next line containing string.
M {pattern} Move forward to the next line matching pattern.
POn Move to line n.
T Move to before line 1.
Displaying Text
Ln Display n lines (Same as P except that n must be included).
P{n} Display n lines, moving the current line forward to the final displayed line.
PL{{-}n} Display n lines relative to the current line position without changing the current line
position.
PP{n} Display n lines surrounding the current line position.
Inserting Text
I Enter insert mode under the current line.
I text Insert text as a single line under the current line.
IB Enter insert mode above the current line.
IB text Insert text as a single line above the current line.
LOAD {{filename} record.id} Insert part or all of the specified record
Deleting Lines
D{n} Delete n lines starting at the current line position.
DE{n} Delete n lines starting at the current line position.
Changing Text
A {string} Append string to the current line.
B string Break the current line into two after string.
C/old.string/new.string/{n}{G}{B} Change old.string to new.string in the current line.
The optional n component specifies that n lines starting at the current line
are to be changed. G replaces all occurrences of old.string. B applies the
change to the currently defined block.
CAT {string} Concatenate the current line, string and the following line.
DUP {n} Duplicate the current line n times.
R/old.string/new.string/{n}{G}{B} Same as C.
R text Replace the current line with the specified text.
2.11-0
ED Commands 109
Miscellaneous Commands
? Display status information about the editor and the record being edited.
^ Toggle non-printing character expansion mode.
CASE OFF Set case insensitive mode for the C, F and L commands.
CASE ON Set case sensitive mode for the C, F and L commands.
COL Display a column number ruler to aid alignment of inserted text.
FORMAT Apply conventional indentation rules to the program being edited.
HELP {topic} Display a short description associated with the command identified by topic.
NPRINT Toggles non-print character entry mode.
OOPS Undo the most recent function that modified the record.
STAMP Insert an edit history comment line below the current line.
SPOOL {lines}Print a copy of the record on the default printer.
XEQ {command} Execute command.
2.11-0
110 Quick Reference Guide
2.11-0
SED Default Key Bindings 111
Editor commands in the default key bindings consist of keystrokes which are
· Control shift + key
· ESCape followed by another key
· Ctrl-X followed by another key
· Ctrl-X followed by control shift + key
Functions marked with an asterisk cannot be included in a macro and cannot be repeated using the
repeat or repeat count functions.
2.11-0
112 Quick Reference Guide
17 Configuration Parameters
For full details, see the QM Reference Guide. Parameters marked with an asterisk can be modified
for an individual process using the CONFIG command.
2.11-0
Configuration Parameters 113
2.11-0
114 Quick Reference Guide
2.11-0
Configuration Parameters 115
QMTERM ADDR IP address (or host name) and port number of connection.
2.11-0