z/OS TSO/E Programming Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Example 5: Describing a WHEN command syntax

z/OS TSO/E Programming Services
SA32-0973-00

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 syntax
EXAM4    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

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014