TL;DR Summary: Understanding IBM® Syntax Diagrams for Db2 12 involves following a structured approach to read diagrams effectively. Key symbols indicate required, optional, and repeatable items, guiding users through statement structures.
- Required items are on the main path; optional items appear below.
- Repeatable items are indicated by arrows returning to the left.
Read the syntax diagrams from left to right, from top to bottom, following the path of the line.
The >>--- symbol indicates the beginning of the statement
The ---> symbol indicates that the statement syntax is continued on the next line
The >--- symbol indicates that a statement is continued from the previous line
The --->< symbol indicates the end of a statement
Diagrams of syntactical units other than complete statements start with the
>--- symbol and end with the ---> symbol.
Required items appear on the horizontal line (the main path).
>>__required_item________________________________________________________________><
Optional items appear below the main path.
>>__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.
_optional_item_
>>__required_item__ǀ______________ǀ______________________________________________><
If you can choose from two or more items, they appear vertically, in a stack. If you must choose one of the items, on item of the stack appears on the main path.
>>__required_item____required_choice1____________________________________________><
ǀ_required_choice2_ǀ
If choosing one of the items is optional, the entire stack appears below the main path.
>>__required_item________________________________________________________________><
ǀ_optional_choice1_ǀ
ǀ_optional_choice2_ǀ
If one of the items is the default, it appears above the main path and the remaining choices are shown below.
_default_choice_
>>__required_item____ǀ________________ǀ__________________________________________><
ǀ_optional_choice_ǀ
ǀ_optional_choice_ǀ
An arrow returning to the left, above the main line, indicates an item that can be repeated.
<_________________
>>__required_item______repeatable_item_ǀ_________________________________________><
If the repeat arrow contains a comma, you must separate repeated items with a comma.
<_,________________
>>__required_item______repeatable_item_ǀ_________________________________________><
A repeat arrow above a stack indicates that you can repeat the items in the stack.
Keywords appear in uppercase (for example, FROM). They 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.
Disclaimer: This Db2® 12 for z/OS Reference Guide was developed to help users in their daily activities in administrating and programming in Db2 for z/OS. There are no guarantees expressed or implied with the contents in this guide. We want to provide a quality and useful reference for users. Please notify us of any mistakes or errors in this reference guide at blogs@bmc.com. Db2 is a registered trademark of the IBM Corporation.
Db2 Guide
- Db2 12 for z/OS: An Introduction
- Scalar Functions in Db2 12
- How to Read IBM<sup>®</sup> Syntax Diagrams for Db2 12
- Language Elements in Db2 12
- Aggregate Functions in Db2 12
- Table & Row Functions in Db2 12
- Queries in Db2 12
- Commands in Db2 12
- SQL Control Statements in Db2 12
- Explain Tables in Db2 12
- DSNZPARMs in Db2 12
- Bind Parameters in Db2 12
- Db2 Limits in Db2 12
- SQL Communication Area (SQLCA) in Db2 12
- REXX SQLCA in Db2 12
- Get Diagnostics in Db2 12
- IFCIDS in Db2 12
- Catalog Tables in Db2 12
- Exceptions in Db2 12
- XML Schema Repository Tables in Db2 12
- Updatable Catalog Statistics in Db2 12
- IBM Utilities in Db2 12
- SQL Positive Return Codes in Db2 12
- SQL Error Return Codes in Db2 12
These postings are my own and do not necessarily represent BMC's position, strategies, or opinion.