Caché ObjectScript Reference
Symbols Used in ObjectScript
[Home]  [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

A table of characters used in ObjectScript as operators, and so on.
Table of Symbols
The following are the literal symbols used in ObjectScript. (This list does not include symbols indicating format conventions, which are not part of the language.) There is a separate table for symbols used in Caché SQL.
The name of each symbol is followed by its ASCII numeric value.
Symbol Name and Usage
[space] or [tab]
White space (Tab (9) or Space (32)): Leading white space (space or tab) is required before every line of code, with the exceptions of labels, and some comment lines.
Within commands, one (and only one) space is required between the command name and the first argument.
Trailing white space (space or tab) is required between the last command argument and any following command or comment on the same line. Trailing whitespace is also required between a label and a following command or comment on the same line.
[two spaces, two tabs, or a space and a tab] Double white space: Trailing double white space required between an argumentless command and the next command on the same line.
!
In READ and WRITE commands, specifies a new line.
As first character at terminal prompt, load interactive subshell.
"
Quotes (34): Used to enclose string literals. In Dynamic SQL used to enclose the SQL code as a string argument of the %Prepare() method.
For differences between straight quotes (") and directional quotes (“ ”). see Pattern Matching in Using Caché ObjectScript.
""
Double quotes: Used to specify the null string (""), which is a zero-length string.
Used to specify a literal quote character within a quoted string.
#
Pound sign (35): Modulo division operator. Can be used to determine a bit value. For example, $ZA#2 returns the 1’s bit value (0 or 1); with the integer divide (\) operator $ZJOB\1024#2 returns the 1024’s bit value (0 or 1).
In READ and WRITE commands, form feed. In fixed-length READ, number of characters to read.
Prefix for referencing the value of a class parameter from within the class: #ParameterName.
Prefix for many macro preprocessor directives such as: #Define, #Include, and #If. See also ##.
In class syntax, parameter prefix used to return the parameter value. For example, ##class(%Library.Boolean).#XSDTYPE or myinstance.#EXTENTQUERYSPEC.
In ZBREAK debugging, an iteration counter for disabling a specified breakpoint or watchpoint. For example, the following disables the breakpoint at label^rou for 100 iterations: ZBREAK -label^rou#100.
Delimiter for a runtime expression: #(expr)#, where expr is a ObjectScript expression.
In the callout routine ZFENTRY, an argtype prefix indicating a DOUBLE data type: #D or #F.
Regular expression end-of line comment indicator (in (?x) mode only).
##
##super() syntax is used to invoke an overridden superclass method.
Prefix for certain macro preprocessor directives, including ##Continue, ##Expression, ##Function, ##Lit, ##SQL, and ##Unique. ##SQL is invoked to execute a line of SQL code from within ObjectScript: ##SQL(SQL command).
Delimiter for a compile-time expression: ##(expr)##, where expr is a ObjectScript expression.
##; Double pound sign semicolon: Single-line comment indicator; can be used in column 1 in either ObjectScript or Embedded SQL.
#; Pound sign semicolon: Single-line comment indicator; can be used in column 1.
$
Special variable prefix: $name.
$Znnn (a name beginning with $Z) can be a user-defined function or special variable defined using %ZLANG language extension library. It can also be an InterSystems-supplied system function or special variable.
Regular expression end of string anchor; for example, (USA)$.
In ZBREAK debugging, a single-step breakpoint.
As first character at terminal prompt, load interactive subshell.
$$
Double dollar sign: user-supplied function call prefix: $$myname(parameters). $$ is returned by $STACK when context was established by a reference to a user-supplied function.
Prefix to a routine name to directly invoke that routine.
$$$ Triple dollar sign: Macro invocation prefix.
%
Percent sign (37): Permitted as first character of names: (1) local variable names, indicating a “% variable” with special scoping rules, used for locking. (2) routine names, often indicates a system utility. (3) Package class names, such as %SYSTEM.class and %Library.class. (4) %Persistent object property names and method names, such as %Dialect, %New(), and %OpenId(). (5) Labels.
Required as first character of a macro argument.
Prefix for some embedded SQL variables: %msg, %ROWCOUNT, and for some SQL keywords: %STARTSWITH.
%%
Double percent sign: Prefix for the pseudo-field reference variable keywords %%CLASSNAME, %%CLASSNAMEQ, %%ID, and %%TABLENAME, used in ObjectScript computed field code and trigger code.
&
Ampersand (38): AND logical operator (full evaluation). $BITLOGIC bitstring AND operator.
In a formal parameter list, an optional, non-functional variable name prefix that marks a parameter as one that should be passed by reference. The & is a marker and is not part of the variable name. For example Calc(x,&y).
Shell invocation prefix for embedded code. For example &sql(SQL commands); &js<JavaScript commands>; &html<HTML commands>.
&&
Regular expression AND logical operator.
Symbol Name and Usage
'
( )
Parentheses (40,41): Used to enclose a procedure or function parameter list. Parentheses are mandatory, even when empty.
Used to nest expressions; nesting overrides the Caché default of strict left-to-right evaluation of operators, and allows you to give precedence to expressions.
Used to specify array subscripts for a local variable: a(1,1), a global variable: ^a(1,1), or a process-private global: ^||a(1,1).
Used to enclose an alternating pattern match (following a ?).
With NEW and KILL commands, exclusive (everything but) indicator.
Used to enclose embedded SQL code, following an &sql shell invocation command: &sql(SQL commands).
Regular expression match string (Boston) or string list (Boston|New York|Paris). Regular expression grouping construct.
When setting a JSON object or array value, used to enclose a Caché literal or expression.
*
In $ZSEARCH, wild card for zero, one, or more than one characters.
In $EXTRACT, $LIST, and $PIECE specifies the final item at the end of the string; can be used with a signed integer to specify offset from the end, for example *-2, *+1.
In WRITE command, specifies an integer code for a character. For example, WRITE *65 writes the letter “A”.
As prefix to $ZTRAP string value, specifies that call stack level should be left unchanged.
In ZBREAK a name prefix denoting a local variable. In certain error codes returned to $ZERROR, a name prefix denoting an undefined local variable, class, method, or property.
Regular expression 0 or more character quantifier.
** Double asterisk: Exponentiation operator. For example, 4**3=64.
*+ Asterisk plus: In SET $EXTRACT, SET $LIST, and SET $PIECE specifies offset beyond the last item of the string; used to append values. For example, *+1 appends an item to the end of string.
*-
Asterisk minus: In WRITE command, specifies a device control integer code. For example, WRITE *-10 clears the terminal input buffer.
In $EXTRACT, $LIST, $LISTGET, and $PIECE specifies offset backwards from the last item of the string; for example, *-1 is the next-to-last item.
*/ Asterisk slash: Multi-line comment ending indicator. Comment begins with /*.
+
Plus sign (43): Unary arithmetic positive operator. When appended to a string or a function that returns a string forces numeric evaluation; for example, WRITE +"007.0" or WRITE +$PIECE(str,",",2).
Integer line count offset from a label: label+offset. In $ZTRAP, integer line count offset from top of a procedure: +offset^procname.
With LOCK and ZBREAK commands, a prefix that enables or applies/increments the item that follows.
Regular expression 1 or more character quantifier.
,
Comma (44): In functions and procedures, multiple parameters separator.
In array variables, subscript levels separator.
American numeric group separator or European decimal point character (configurable).
In $ECODE, surround error code: ,M7,
,, Two commas: In functions, a placeholder for an unspecified positional parameter (which takes a default value).
With LOCK and ZBREAK commands, a prefix that disables or decrements/removes the item that follows.
Regular expression character range operator; for example [A-Z].
––
Double minus sign: With ZBREAK command, a prefix that removes the item that follows.
Regular expression subtract (except for) logical operator.
.
Period (46): American decimal point character, or European numeric group separator (configurable).
Object dot syntax used to refer to a method or property of an object instance: myinstance.Name.
Windows and UNIX®: As a pathname or part of a pathname, specifies the current directory. Used by $ZSEARCH.
May be included within a global name or a routine name.
Prefix to a variable or array name in an actual parameter list that specifies passing by reference: SET x=$$Calc(num,.result).
Regular expression single-character wildcard.
Following argumentless DO command, a code block structure line prefix.
..
Double period: relative dot syntax: a prefix that specifies a method or property of the current object. For example, WRITE ..foo()
Windows and UNIX®: As a pathname or part of a pathname, specifies the parent directory of the current directory. Used by $ZSEARCH.
..# Double period, pound sign: A prefix for references to a class parameter from within a method of the same class. For example, WRITE ..#MyParam
...
Triple period (ellipsis): A suffix appended to the last (or only) parameter in a formal parameter list or actual parameter list that is used to specify a variable number of parameters. For example, Calc(x,y,params...). This syntax is commonly used with a dynamic dispatch method, such as Method %DispatchMethod(Method As %String,Params...)
In ZWRITE output, trailing ellipsis indicates string truncation.
(This literal use of ellipsis in code should not be confused with format convention usage in our documentation, where ellipsis indicates that an argument can be repeated multiple times, or that a section of code is intentionally omitted.)
/
Slash (47): Division operator (keep remainder).
In OPEN, CLOSE, and USE commands, I/O keyword parameter prefix. In READ and WRITE, device control mnemonic prefix.
With ZBREAK command, a subcommand prefix.
// Double slash: Single-line comment indicator.
/// Triple slash: Single-line comment indicator. Can be used in column 1 for macro comments.
/* Slash asterisk: Multi-line comment begins indicator. Comment ends with */.
:
Colon (58): In commands, postconditional indicator, for example, WRITE:x=0 “nothing”.
In commands such as OPEN, USE, CLOSE, JOB, LOCK, READ, and ZBREAK a placeholder separator of arguments and/or separator of parameters within an argument. For example, LOCK var1:10,+var2:15, or OPEN "|TCP|4":(:4200:"PSTE"::32767:32767)
In $CASE and $SELECT functions, used to specify test:value paired items.
In a JSON object, used to specify a key:value pair. For example, SET JSONobj={"name":"Sam"}.
In $JOB special variable value, separates process ID (PID) and nodename. For example, 11368:MYCOMPUTER.
Prefix indicating a ObjectScript label within embedded ObjectScript code, such as SQL trigger code, where the label cannot be coded in column 1.
; Semicolon (59): Single-line comment indicator.
;; Double semicolon: Retained single-line comment indicator.
<
Used to enclose Embedded JavaScript or Embedded HTML code, following a &js or &html directive: &js<JavaScript commands>.
<= Less than, Equal sign: Less than or equal to operator.
'< Not operator, Less than: Greater than or equal to operator.
=
In SET command, assignment operator.
'= Not operator, Equal sign: Not equal to comparison operator
> Greater than (62): Greater than operator.
>= Greater than, Equal sign: Greater than or equal to operator.
'> Not operator, Greater than: Less than or equal to operator.
?
Regular expression 0 or 1 character quantifier suffix. Regular expression mode prefix. For example, (?i) case mode on; (?-i) case mode off.
In $ZCONVERT translation table results, represents an untranslatable character.
In $ZSEARCH, wild card for a single character.
In READ and WRITE commands, column position indicator.
In ZBREAK command, display help text.
In Dynamic SQL, an input parameter variable supplied by the %Execute() method.
?# Question mark and pound sign: Regular expression embedded comment prefix. For example, (?# this is a comment).
@ At sign (64): Indirection operator. For subscript indirection, appears as: @array@(subscript).
A, a The letter “A” (65,97): Pattern match code (following a ?).
C, c The letter “C” (67,99): Pattern match code (following a ?).
E, e
The letter “E” (69,101): Scientific notation operator. for example, 4E3=4000. The uppercase “E” is the standard exponent operator; the lowercase “e” is a configurable exponent operator, using the ScientificNotation() method of the %SYSTEM.Process class.
Pattern match code (following a ?).
I, i The letter “I” (73,105): Integer indicator in $NUMBER function.
i% The letter “i” percent: instance variable syntax: i%propertyname.
L, l The letter “L” (76,108): Pattern match code (following a ?).
N, n The letter “N” (78,110): Pattern match code (following a ?).
P, p The letter “P” (80,112): Pattern match code (following a ?).
U, u The letter “U” (85,117): Pattern match code (following a ?).
Symbol Name and Usage
[ Open square bracket (91): Contains operator.
[ ]
Square brackets (91,93): Used to enclose a namespace name, directory name, or the null string in an extended global reference ^["namespace"]global. Used to specify a process-private global with the following syntax: ^["^"]ppgname or ^["^",""]ppgname.
In a structured system variable (SSVN) used to enclose a namespace name ^$["namespace"]GLOBAL() to specify an extended SSVN reference.
In XECUTE command or a procedure definition, encloses a public variables list: [a,b,c]
In ZWRITE or argumentless WRITE command display, encloses an object reference (oref).
Regular expression match any character in a list [ABCD] or a range [A-D].
JSON dynamic array expression, which returns an instance of %DynamicArray. For example, SET JSONarray=[1,2,3].
[: :] Square brackets and colons: Regular expression character type keyword. For example, [:alpha:].
\
Backslash (92): Integer division operator (drop remainder). Can be used with modulo (#) operator to determine a bit value; for example, $ZA\16#2 returns the value (0 or 1) of the $ZA 16 bit.
Regular expression escape prefix. JSON string escape prefix, for example\".
] Close square bracket (93): Follows operator.
]] Double close square brackets: Sorts After operator.
^
Caret (94): Global variable name prefix, for example, ^myglobal(i).
Routine invocation prefix, for example, DO ^routine or DO label^routine.
Implied namespace prefix with the format ^system^dir.
$BITLOGIC bitstring XOR (exclusive or) operator.
Regular expression beginning of string anchor; for example, ^A. Regular expression character type keyword inverse. For example, [:^alpha:].
^^ Double caret: Implied namespace prefix for the current system, with the format ^^dir.
^$ Caret dollar: Structured system variable prefix. For example, ^$GLOBAL() or ^$|"namespace"|GLOBAL().
^$[ Caret dollar bracket: In a structured system variable (SSVN) used to enclose a namespace name ^$["namespace"]GLOBAL() to specify an extended SSVN reference.
^$| Caret dollar bar: In a structured system variable (SSVN) used to enclose a namespace name ^$|"namespace"|GLOBAL() to specify an extended SSVN reference.
^% Caret percent: System global prefix, for example, ^%utility or ^%qStream.
^( Caret parenthesis: A naked global reference, where the most recently named subscripted global name is implied. For example: ^(1,2)
^[ Caret open square bracket: see Square brackets.
^|
Caret bar: depending on the character(s) that follow, this may be:
An extended global reference, a global reference where a pair of bars encloses a quoted namespace name, a directory name, or a null string. The bars and their contents are not part of the global name. For example: ^|""|globname, or ^|"namespace"|globname.
A process-private global prefix with the prefix ^||. The bars are part of the process-private global name. For example, ^||ppgname. Also valid as syntax for this process-private global: ^|"^"|ppgname.
An extended routine reference, where a pair of bars encloses a quoted namespace name, a variable that resolves to a namespace name, or a null string. For example, DO ^|"namespace"|routine.
_
{ }
Curly braces (123,125): Code block delimiters used in procedures, for TRY and CATCH blocks, or with the IF, FOR, DO WHILE, and WHILE commands.
In SQL compute code, encloses a field name. For example, SET {Age}=18, or SET {f1} = {f2}.
In XECUTE command, encloses code in which variables are treated as private.
Regular expression quantifier; for example, {5} = 5 times; {3,6} = at least 3 times but not more than 6 times. Regular expression character type letter code or keyword with \p prefix; for example, \p{LL}, \p{lower}. Regular expression single character keyword with \N prefix; for example, \N{comma}.
JSON dynamic object expression, which returns an instance of %DynamicObject. For example, SET JSONobj={"name":"Sam"}.
{*} Asterisk within curly braces: In SQL compute code, specifies the current SQL field name.
|
Vertical bar (124): $BITLOGIC bitstring OR operator.
Regular expression OR operator.
For other uses, see ^| and ^$.
||
Compound ID indicator. Used by Caché to display a generated compound object ID (a concatenated ID). This can be either an IDKey defined on multiple properties (prop1||prop2), or an ID for a parent/child relationship (parent||child).
~
Tilde (126): $BITLOGIC bitstring NOT (one's complement) operator.
In Windows pathnames, indicates 8.3 compression of long names. For example: c:\PROGRA~1\. To convert compressed directory names, use the NormalizeDirectory() method of the %Library.File class.