How to read syntax diagrams

Certain conventions apply to the syntax diagrams that are used in IBM® documentation.

Apply the following rules when reading the syntax diagrams that are used in Db2® for z/OS® documentation:
  • Read the syntax diagrams from left to right, from top to bottom, following the path of the line.
  • Required items appear on the horizontal line (the main path).
    Read syntax diagramSkip visual syntax diagram required_item
  • Optional items appear below the main path.
    Read syntax diagramSkip visual syntax diagram required_item optional_item

    If an optional item appears above the main path, that item has no effect on the execution of the statement and is used only for readability.

    Read syntax diagramSkip visual syntax diagram required_item optional_item
  • If you can choose from two or more items, they appear vertically, in a stack.

    If you must choose one of the items, one item of the stack appears on the main path.

    Read syntax diagramSkip visual syntax diagram required_item required_choice1required_choice2

    If choosing one of the items is optional, the entire stack appears below the main path.

    Read syntax diagramSkip visual syntax diagram required_item optional_choice1optional_choice2

    If one of the items is the default, it appears above the main path and the remaining choices are shown below.

    Read syntax diagramSkip visual syntax diagram required_item default_choiceoptional_choiceoptional_choice
  • An arrow returning to the left, above the main line, indicates an item that can be repeated.
    Read syntax diagramSkip visual syntax diagram required_item repeatable_item

    If the repeat arrow contains a comma, you must separate repeated items with a comma.

    Read syntax diagramSkip visual syntax diagram required_item ,repeatable_item

    A repeat arrow above a stack indicates that you can repeat the items in the stack.

  • Sometimes a diagram must be split into fragments. The syntax fragment is shown separately from the main syntax diagram, but the contents of the fragment should be read as if they are on the main path of the diagram.
    Read syntax diagramSkip visual syntax diagram required_item fragment-name
    fragment-name
    Read syntax diagramSkip visual syntax diagram required_item optional_name
  • For some references in syntax diagrams, you must follow any rules described in the description for that diagram, and also rules that are described in other syntax diagrams. For example:
    • For expression, you must also follow the rules described in Expressions.
    • For references to fullselect, you must also follow the rules described in fullselect.
    • For references to search-condition, you must also follow the rules described in Search conditions.
  • With the exception of XPath keywords, keywords appear in uppercase (for example, FROM). Keywords must be spelled exactly as shown.
  • XPath keywords are defined as lowercase names, and must be spelled exactly as shown.
  • Variables appear in all lowercase letters (for example, column-name). They represent user-supplied names or values.
  • If punctuation marks, parentheses, arithmetic operators, or other such symbols are shown, you must enter them as part of the syntax.