The Command Environment

Top  Previous  Next

 

Although applications commonly use the graphical interface capabilities of QM, developers normally work from the character mode interface command prompt using a terminal emulator or directly from the system console. Commands can also originate from within application programs.

 

Commands entered at the terminal or generated from within a QM application are processed by the command processor. This uses the vocabulary file (VOC) to determine the meaning of each word or symbol within the command.

 

The terminal command prompt is the colon character. Whenever this is displayed at the start of a line, QM is ready to accept a new command. The command prompt changes to a double colon if the default select list is active. This serves as a warning that the select list may impact execution of the next command. The prompt characters may be modified using the PTERM command.

 

The first word of a command entered at the command prompt must identify an executable item within the VOC. This will be the name of a verb, sentence, paragraph, menu or Proc. It is also possible to run a program from the system catalogue by typing its name as a command. Other valid actions at the command prompt are:

Command stack operations, prefixed by a dot character

Command editor keystrokes

Save the command without execution by appending a question mark

 

A command usually commences with a verb which may also require one or more arguments to determine exactly what the verb is to do.

 

The command processor performs the VOC look-up for a verb in three stages; firstly by looking for a record with the name of the verb exactly as entered. If this fails, it then tries again with the name mapped to uppercase. All system verbs have uppercase names and can therefore be entered in lowercase, uppercase or a mix. For compatibility with Pick databases, a third attempt is made with any hyphens in the uppercase version of the verb name replaced by dots. Thus a command such as CREATE.FILE can be entered as create.file or CREATE-FILE.

 

If the command is not found in the VOC, a final check is made in the private and global catalogues. If the name exists here, the catalogued program is executed. The names of catalogued programs executed in this way must commence with a letter or an asterisk.

 

Many commands perform the first two phases of this look-up for file names, keywords, etc, however, commands that might have a detrimental effect if used in error (DELETE.FILE, for example) either insist on the file name being entered exactly as it appears in the VOC or prompt for confirmation if the name is not an exact match.

 

Command lines commencing with an asterisk followed by at least one space are treated as comments and ignored except that inline prompts are still processed. Although comments are primarily of use within paragraphs, they can be entered directly at the keyboard when they will appear in any active como file.

 

Many QM commands return status values via the @SYSTEM.RETURN.CODE variable. In general, a positive or zero value indicates success. A negative value is an error code and the actual value is the negative of the codes listed in the ERR.H include record in SYSCOM.