This example shows how the parse macro instructions could
be used to describe the syntax of a sample WHEN command that has the
following syntax:
WHEN [addr ] (subcommand chain)
[expression]
Figure 1 shows the sequence of parse
macro instructions that
describe this sample WHEN command to the
Parse Service Routine. The
parse
macro instructions
used in this example perform the following functions:
- The IKJPARM macro instruction indicates
the beginning of the parameter control list and creates the PARSEWHN
DSECT that you use to map the parameter descriptor list returned by
the Parse Service Routine.
- The IKJOPER macro instruction describes
an operand that can be entered as either an expression or a variable.
- The IKJTERM macro instructions
that are labeled "SYMBOL" and "SYMBOL2" describe the operands
that are part of the expression.
- The IKJRSVWD and IKJNAME macro instructions define
possible reserved words that can be operators in the expression.
- The IKJTERM macro instruction that
is labeled "ADDR1" describes the variable that can be specified
as the first positional operand.
- The IKJPOSIT macro instruction describes
a parenthesized string.
- The IKJENDP macro instruction indicates
the end of the parameter control list.
Figure 1. Example 5
- using parse macros to describe command operand syntaxEXAM4 IKJPARM DSECT=PARSEWHN
OPER IKJOPER 'EXPRESSION',OPERND1=SYMBOL1,OPERND2=SYMBOL2, X
RSVWD=OPERATOR,CHAIN=ADDR1,PROMPT='TERM',VALICHK=CHECK
SYMBOL1 IKJTERM 'SYMBOL1',UPPERCASE,TYPE=VAR,PROMPT='SYMBOL2'
OPERATOR IKJRSVWD 'OPERATOR',PROMPT='OPERATOR'
IKJNAME 'EQ'
IKJNAME 'NEQ'
SYMBOL2 IKJTERM 'SYMBOL2',TYPE=VAR
ADDR1 IKJTERM 'ADDRESS',TYPE=VAR,VALIDCK=CHECK1
LASTONE IKJPOSIT PSTRING,VALIDCK=CHECK2
IKJENDP