The following commands are the M language commands implemented in GT.M. All commands starting with the letter Z are GT.M additions to the ANSI standard command set. The M standard specifies standard abbreviations for commands and rejects any non-standard abbreviation
SET assigns values to variables or to a selected portion of a variable
The format for the SET is:
Example 1
Example 2
The READ command transfers the input from the current device to a global or local variable specified as a READ argument. For convenience, READ also accepts arguments that perform limited output to the current device
The format for the READ is:
Example 1
Example 2
The format for the WRITE is:
Example 1
Example 2
The format for the ZWRITE is:
Example 1
Example 2
The KILL command deletes local or global variables and their descendant nodes
The format for the KILL is:
Example 1
Example 2
Example 3
The format for the ZKILL is:
Example 1
Example 2
The format for the ZWITHDRAW is:
Example 1
Example 2
The MERGE command copies a variable and all its descendants into another variable. MERGE does not delete the destination variable, nor any of its descendants
The format for the MERGE is:
Example 1
Example 2
The NEW command "stacks" copies of local variables and reinitializes those variables. An explicit or implicit QUIT from a DO, XECUTE or extrinsic function "unstacks" the NEWed variables, that is, restores the variable to the stacked value. A NEW lasts only while the current scope of execution is active
The format for the NEW is:
Example 1
Example 2
The HALT command stops the program execution and cause GT.M to return control to the operating system environment that invoked the GT.M image
The format for the HALT is:
Example 1
Example 2
The format for the ZHELP is:
Example 1
Example 2
The format for the ZHALT is:
Example 1
Example 2
The format for the ZEDIT is:
Example 1
Example 2
The format for the ZLINK is:
Example 1
Example 2
The format for the ZSYSTEM is:
Example 1
Example 2
The JOB command initiates another GT.M process that executes the named routine. ($ZJOB is set to the pid of the process created by the JOB command. For more details, refer to “$ZJob”)
The format for the JOB is:
Example 1
Example 2
The format for the ZALLOCATE is:
Example 1
Example 2
The format for the ZDEALLOCATE is:
Example 1
Example 2
The format for the ZMESSAGE is:
Example 1
Example 2
The IF command provides conditional execution of the remaining commands on the line. When IF has an argument, it updates $TEST with the truth value of its evaluated argument. GT.M executes the remainder of a line after an IF statement when $TEST is 1 (TRUE). When $TEST is 0 (FALSE), GT.M does not execute the rest of the line
The format for the IF is:
Example 1
Example 2
Example 3
ELSE executes the remainder of the line after the ELSE if $TEST is FALSE (0). GT.M does not execute the rest of the line if $TEST is TRUE (1)
The format for the ELSE is:
Example 1
The FOR command provides a looping mechanism in GT.M. FOR does not generate an additional level in the M standard stack model
The format for the FOR is:
Example 1
Example 2
Example 3
Example 4
Except when a QUIT appears on a line after a FOR, the QUIT command terminates execution of the current GT.M invocation stack level initiated by a DO, XECUTE, extrinsic function or special variable, and return control to the next "lower" level. In this case, QUIT restores any values stacked at the current level by NEWs or by parameter passing. A QUIT command terminates any closest FOR command on the same line. Note that M overloads the QUIT command to terminate DO, FOR, XECUTE and extrinsics ($$) of which FOR is the most different
The format for the QUIT is:
Example 1
Example 2
The DO command makes an entry in the GT.M invocation stack and transfers execution to the location specified by the entryref
The format for the DO is:
Example 1
Example 2
The format for the XECUTE is:
Example 1
Example 2
The GOTO command transfers execution to a location specified by its argument
The format for the GOTO is:
Example 1
Example 2
The OPEN command creates a connection between a GT.M process and a device
The format for the OPEN is:
Example 1
Example 2
The format for the USE is:
Example 1
Example 2
The CLOSE command breaks the connection between a process and a device
The format for the CLOSE is:
Example 1
Example 2
Example 3
The BREAK command pauses execution of the code and initiates Direct Mode
The format for the BREAK is:
Example 1
Example 2
The format for the ZBREAK is:
Example 1
Example 2
The format for the ZGOTO is:
Example 1
Example 2
The format for the ZSTEP is:
Example 1
Example 2
The format for the ZSHOW is:
Example 1
Example 2
The format for the ZCONTINUE is:
Example 1
Example 2
The format for the ZPRINT is:
Example 1
Example 2
The format for the VIEW is:
Example 1
Example 2
The HANG command suspends GT.M program execution for a period of time specified by the command argument
The format for the HANG is:
Example 1
Example 2
The format for the ZCOMPILE is:
Example 1
Example 2
The format for the TSTART is:
Example 1
Example 2
The format for the TRESTART is:
Example 1
Example 2
The format for the TROLLBACK is:
Example 1
Example 2
The TCOMMIT command marks the end of a transaction or sub-transaction and decrements $TLEVEL. If TCOMMIT marks the end of a transaction (decrements $TLEVEL to zero), it invokes a COMMIT, which makes the database updates performed by the transaction generally available. A TCOMMIT issued when no transaction is in progress ($TLEVEL=0) produces an error
The format for the TCOMMIT is:
Example 1
Example 2
The LOCK command reserves and releases resource names, and provides a semaphore capability for GT.M processes. This capability can be used for interprocess synchronization and signaling. Assigning a LOCK does not specify any explicit control over variables and does not directly effect either read or write access to global (or local) data. However, an application that adheres to clearly defined conventions of LOCKing before any access can indirectly achieve such an effect. FIS recommends implementing database Consistency using transaction processing rather than LOCKs. If you wish to avoid GT.Ms use of optimistic concurrency for TP, place the LOCK just before the original TSTART and release it after the final TCOMMIT
The format for the LOCK is:
Example 1
Example 2
The format for the ZRUPDATE is:
Example 1
Example 2
The format for the ZTRIGGER is:
Example 1
Example 2
ZTS[TART][:tvexpr]
The format for the ZTSTART is:
Example 1
Example 2