HPlogo MPE/iX Commands Reference Manual > Chapter 2 Command Structure Defined

Native Mode Command Structure

MPE documents

Complete PDF
Table of Contents
Index

Many commands in this chapter have the designation Native Mode at the end of their definition. This means that the command is parsed by the Native Mode Command Parser. If Native Mode is not specified, the command is parsed by the Compatibility Mode Command Parser. (A command parser separates command parameters.) There is no relationship between the parser a command uses and the function(s) the command performs. Also, just because a command is parsed by the Compatibility Mode parser does not mean it functions in the same way it did in the Classic HP3000 environment.

All new commands for MPE/iX use the NM parser. Some commands used on MPE V/E which have been changed for MPE/iX use the NM parser and some do not. MPE V/E commands which have not been changed for MPE/iX generally use the CM parser.

The important thing to remember is that the Native Mode parser accepts several different formats for commands that you enter at the colon prompt (:). You may enter these NM-parsed commands in one of the following ways:
  • By using the formal command specification shown in the syntax diagram for each command in this chapter.

  • By using positional parameter specifications to enter keyword parameter values.

  • By combining positional and keyword specification

Another difference between the NM parser and the CM parser is that the CM parser restricts a single comand parameter value to be <=255 characters. On the NM side, the value is limited by the size of the CI's command buffer.

Formal Command Specification


You may enter an NM-parsed command as shown in the syntax diagram for each command, for example:

  COMMAND KEYWORD1=A;KEYWORD2=B;KEYWORD3=C

Positional Parameter Specification


You may also enter an NM-parsed command by omitting the keyword parameter name and only entering the values as positional parameters, for example:

  COMMAND A,B,C

If you omit the keyword specifications and enter the values as positional parameters, the values must be treated as such, and all rules for positional parameters must be followed. For example, if you only specify A and C, you must use the positional place holder (,) as shown in the following example:

  COMMAND A,,C

Combining Positional/Keyword Parameters


Another option is to enter NM-parsed commands by using a combination of positional and keyword specifications, for example:

  COMMAND A,B;KEYWORD3=C

There is one important rule to remember when you combine positional and keyword parameters: once you specify a keyword parameter, you may not use positional parameters. For example, entering the following command would produce an error:

  COMMAND A;KEYWORD2=B,C

An exception to the rule is that you may specify positional parameters that are subparameters of a keyword parameter. For example, in the BUILD command shown below, REC is a keyword but the next four parameters (which define records as being 80 bytes long, blocked at 1 and in Fixed ASCII format) are positional. This syntax is acceptable because they are subparameters of the key word REC.

  BUILD filename;REC=-80,1,F,ASCII

The following example shows the correct way to combine positional and keyword parameters where the keyword has no subparameters:

  COMMAND A;KEYWORD2=B;KEYWORD3=C

Entering Numbers in Commands


You may enter numbers as parameters to NM-parsed commands as follows:
  • With or without leading zeros.

  • As positive or negative numbers.

  • Preceded by the $ sign indicating hexadecimal or base 16.

  • Precdeded by the % sign indicating octal or base 8.

  • Preceded by the # sign indicating decimal or base 10 (if neither $, % nor # is specified base 10 is used).

  • In the decimal range -2,147,483,648 to 2,147,483,647.

For example, suppose you wanted to suspend spooling on LDEV 6, your system printer. You could enter :

  SPOOLER DEV=#0006;SUSPEND;SHOW

Or, because decimal is the default you could omit the # sign and enter:

  SPOOLER DEV=0006;SUSPEND;SHOW

Or, omitting the leading zeroes you could enter:

  SPOOLER DEV=6;SUSPEND;SHOW

When entering numbers as command parameters, it is advisable to omit leading zeros for some commands parsed by the compatibility mode (CM) parser.

Using Quotes and Strings


The NM parser optionally accepts any string input in single or double quotes. For example, because the file name parameter of the PRINT command is a string parameter, you could enter it as follows:

  PRINT FILENAME

or

  PRINT "FILENAME"

or

  PRINT 'FILENAME'

General Rules for Using Quotes

Quotes are required if the value of any string parameter contains any of the following delimiters:
,

comma

;

semicolon

blank (one or more spaces)

=

equal sign

(

left parentheses

)

right parentheses

For example, suppose you want to set a variable called MYVAR to a value of ;(A). Because this string contains both a semi-colon and parentheses, you would enter SETVAR as follows:

  SETVAR MYVAR ";(A)"

As another example, suppose you wanted to use the INFO= parameter of the RUN command to pass the following string (which contains both commas and spaces) BLUE RIGHT 24, SPLIT LEFT, 2. You would enter:

  RUN PROG;INFO="BLUE RIGHT 24, SPLIT LEFT, 2"

String Processing

MPE/iX string processing finds the first double or single quote and pairs it with the last quote of the same type to form a string. In other words, single quotes pair only with other single quotes and double quotes only with other double quotes. For this reason you can use single quotes within double quotes, and double quotes within single quotes. For example, all three of the following INFO strings are correct:

  ...;INFO="THIS IS THE 'WRITE' WAY"
  ...;INFO='THIS IS THE "WRITE" WAY TOO'
  ...;INFO="YOU SIMPLY CAN'T GO WRONG"

In all of the above cases, the quotes around the word WRITE and in the word CAN'T are contained within the string and are treated just like any other character.

Quotes within Strings

A technique called quote folding enables you to embed single or double quotes in quoted strings. For example, the following INFO= string would pass the string shown below it:

  ... ;INFO="JUST SAY ""GATO""."

  JUST SAY "GATO".

Quote folding works as follows: When the NM parser reads a quote (other than the very first quote in an entire line), it checks the character to the immediate right of the quote. If it is a quote of the same kind (single or double) it is disregarded and the previous quote is treated like any other non-quote character. For example, after being parsed, the following quoted string becomes the string listed below it:

  ...;"PASS ""A"" TO ""X"" AND ""B"" TO ""Y"""

  PASS "A" TO "X" AND "B" TO "Y" 

Here is another example:

  "HERE ARE FOUR QUOTES "" "" "" """

  HERE ARE FOUR QUOTES " " " "

To delete spaces between the four quotes, you would enter the string like this:

  "HERE ARE FOUR QUOTES """""""""

After being parsed, the string would look like this:

  HERE ARE FOUR QUOTES """" 

The NM parser processes quoted strings in the same way regardless of the command or parameter with which they are used.

For most CM commands, the CM parser processes quoted strings in the same way as the NM parser. However, the CM parser limits the length of quoted strings to 255 characters.

Exceptions


There are four exceptions to the syntax governing MPE/iX commands:
  • User command parameter lists (which may affect string quoting rules).

  • The SETVAR command.

  • The XEQ command.

These three exceptions allow the use of only specific delimiters when specifying parameters, as defined below.

Also the ECHO command accepts all delimiters and treats them as part of the value to be echoed.

Invoking User Defined Commands

User defined commands may be structured to accept the KEYWORD=parm format, and you may mix keyword and positional parameters. User command parameter lists allow you to use the following to delimit parameters:
,

comma

;

semicolon

blank (one or more spaces)

=

equal sign

For example, if the user defined command UDCA is defined as UDCA parm1,parm2,parm3 you could invoke it as follows:

  UDCA X;Y;Z

or

  UDCA X PARM2=Y,PARM3=Z

If the value of any parameter contains any of the above delimiters you must use quotes to delimit the parameter string. For example, if I;J;K is a single string parameter value you must delimit it with quotes (because it contains semi-colons) as follows:

  UDCA "I;J;K"

The = sign is used only to delimit a parameter name from a parameter value. If the value of a parameter contains an = sign, then you must delimit the value with quotes. For example:

  UDCA PARM1="YES=OK"

Similarly, if a string value contains a quote, you must delimit it by a quote. As an example, suppose you have a UDC which runs a program with the INFO string. The RUN command within the UDC might look something like this:

  RUN PROGNAME;INFO="!PARM"

If the value of the parameter were something like this: THE "END" IS NEAR, you would invoke the UDC like this:

  UDCA PARM="THE ""END"" IS NEAR"

Or, you could enter this:

  UDCA "THE ""END"" IS NEAR"


NOTE: If a parameter value begins with a quote it must have a matching end quote. If it does not begin with a quote it may contain embedded quotes which will be treated as any other character.

For more information on the use of quotes, refer to the section "Using Quotes and Strings" earlier in this chapter.

The SETVAR Command

The SETVAR command allows you to use either spaces, semicolons, or commas to delimit parameters, as follows:

  SETVAR NAME expression
  SETVAR NAME,expression
  SETVAR NAME;expression

The rules for using quotes within strings containing delimiters or quotes, previously discussed, apply to the SETVAR command.

For example, suppose you want to set a variable called BIGVAR to a value of X,"Y";Z. This expression contains two delimiters (comma and semicolon) as well as quotes. The correct SETVAR command would be:

  SETVAR BIGVAR "X,""Y"";Z"

You could also delimit the expression from the variable name using either a comma or semicolon as follows:

  SETVAR BIGVAR;"X,""Y"";Z"

  SETVAR BIGVAR,"X,""Y"";Z"

For more information on the use of quotes, refer to the section "Using Quotes and Strings" earlier in this chapter.

The XEQ Command

The XEQ command allows you to use only spaces to delimit parameters, as follows:

  XEQ filename [parameters]
  XEQ cmdfile [parameters]


NOTE: A leading semicolon is optional for the first keyword parameter supplied for most commands if it immediately follows the command name. For example, the two commands below are equally valid:

  ALTJOB JOB=...

  ALTJOB ;JOB=...





Commands and Parameters


Remote Sessions and Command Intrinsics