HELPLIB.HLB  —  MACRO  /ALPHA  Lexical Operators, Syntax
    You invoke a lexical string operator with a percent sign followed
    by the lexical operator name, a left parentheses, a list of
    arguments separated by commas, and a right parentheses. The
    following example shows the lexical operator syntax:

       .print "%EDIT(<Fred>,<upcase>)"

    Spaces are allowed between syntax elements in the general lexical
    operator syntax. For example, the following syntax, including
    spaces, is allowed:

    .print "%EDIT ( <Fred> , <upcase> )"

    Spaces are also allowed between the opening and closing percent
    signs in a lexical substitution operator.

    .print "% lexical_symbol_name %"

    Spaces are not allowed between the pair of percent signs
    indicating a lexical escape operator.

    You can specify lexical operator arguments in the same way as
    macro arguments:

    o  A numeric symbol name preceded by a backslash (\). This
       construct results in the decimal value of the numeric symbol,
       as shown in the following example:

          \N

    o  Any string of characters surrounded by left- and right-angle
       brackets, as shown in the following example:

       <Foo bar thud>

       You can nest angle brackets (<>).  For example:

       <<X+7>*17>

    o  Any string of characters surrounded by a delimiter specified
       after a caret character (^). You cannot nest delimiters. For
       example:

       ^%Foo bar thud%

    o  Any undelimited string of characters not separated by a space,
       tab, form feed, comma, equal sign, semicolon, or end of line.
       For example:

       A+B+C

    In addition to the formats allowed for a macro argument, you can
    also specify lexical operator arguments as follows:

    o  An undelimited string of characters may also contain a string
       of characters enclosed within left and right parentheses. The
       characters between the left and right parentheses may contain
       space, tab, or comma delimiters. For example:

       16( R27 )

    o  You can use a lexical operator as an argument to another
       lexical operator. For example:

       %EXTRACT( %LOCATE($,X), %LENGTH(X) - %LOCATE($,X) ,X)

    Except for the %TYPE lexical operator, a string symbol name
    supplied as a lexical operator argument is replaced with the
    value of the string symbol.

    Each lexical operator accepts a given number of arguments and
    each argument has a specific type. There are three different
    types of arguments-string, integer, and name:

    o  A string argument can be any arbitrary sequence of characters.

    o  An integer argument must be an absolute or relocatable
       expression that can be resolved at that point in the assembly.
       A relocatable expression represents a psect and an offset
       within that psect. If you specify a relocatable expression for
       an integer argument, the assembler uses only the value of the
       offset within the psect. The offset value is determined before
       optimization and code alignment, but after data alignment.

    o  The name argument type is used only by the %TYPE lexical
       operator. The %TYPE lexical operator accepts the name of a
       numeric symbol, string symbol, label, psect, or a permanent
       symbol as its argument. Unlike the other lexical operators, if
       a string symbol name is specified as an argument to %TYPE, the
       value of the string symbol is not substituted for its name.
       Instead, information about the name is returned.

    If you omit a string argument, the default is the empty string.
    An empty string is a string with no characters. If you omit an
    integer argument or specify an illegal expression, the default
    value is 0. The assembler does not issue diagnostic messages
    for illegal expressions used as arguments to lexical operators.
    If you omit the name argument or specify an illegal name to the
    %TYPE lexical operator, %TYPE returns a 0 value.
Close Help