MPE/iX Commands Reference Manual
> Chapter 2 Command Structure DefinedNative Mode Command Structure |
||||||||||||||||||||
|
Formal Command SpecificationYou 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 SpecificationYou 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,CIf 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 ParametersAnother option is to enter NM-parsed commands by using a combination of positional and keyword specifications, for example: COMMAND A,B;KEYWORD3=CThere 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,CAn 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,ASCIIThe 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 CommandsYou may enter numbers as parameters to NM-parsed commands as follows:
SPOOLER DEV=#0006;SUSPEND;SHOWOr, because decimal is the default you could omit the # sign and enter: SPOOLER DEV=0006;SUSPEND;SHOWOr, omitting the leading zeroes you could enter: SPOOLER DEV=6;SUSPEND;SHOWWhen 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 StringsThe 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 FILENAMEor PRINT "FILENAME"or PRINT 'FILENAME' General Rules for Using QuotesQuotes are required if the value of any string parameter contains any of the following delimiters:
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 ProcessingMPE/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 StringsA 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. ExceptionsThere are four exceptions to the syntax governing MPE/iX commands:
Invoking User Defined CommandsUser 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:
UDCA X;Y;Zor UDCA X PARM2=Y,PARM3=ZIf 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"
The SETVAR CommandThe SETVAR command allows you to use either spaces, semicolons, or commas to delimit parameters, as follows:SETVAR NAME expression SETVAR NAME,expression SETVAR NAME;expressionThe 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 CommandThe XEQ command allows you to use only spaces to delimit parameters, as follows:XEQ filename [parameters] XEQ cmdfile [parameters]
|