Declarations (C and C++)
Use declarations
to declare session variables and tags
that are effective during a z/OS® Debugger session. Session variables remain
in effect for the entire debug session, or process in which they were
declared. Variables and tags declared with declarations
can
be used in other z/OS Debugger commands as if they were declared to the compiler.
Declared variables and tags are removed when your z/OS Debugger session ends
or when the CLEAR
command is used to remove them. The
keywords must be the correct case and cannot be abbreviated.
You can also declare enum
, struct
, and union
data
types. The syntax is identical to C except that enum
members
can only be initialized to an optionally signed integer constant.
- *
- A C indirect operator.
- identifier
- A valid C identifier.
- integer
- A valid C array bound integer constant.
- constant_expr
- A valid C integer constant.
Usage notes
- As in C and C++, the keywords can be specified in any order. For example, unsigned long int is equivalent to int unsigned long. Some permutations are shown in the syntax diagram to make sure that every keyword is shown at least once in the initial position.
- As in C and C++, the identifiers are case-sensitive; that is, "X" and "x" are different names.
- A
structure
definition must have either an identifier, a declarator, or both specified. - Initialization is not supported.
- A declaration cannot be used in a command list; for example, as
the subject of an
if
command orcase
clause. - Declarations of the form
struct tag identifier
must have the tag previously declared interactively. - See the C and C++ Language References for an explanation of
the following keywords:
char short double signed enum struct float union int unsigned long void _Packed(1) (1) _Packed is not supported in C++.
- You cannot use the
declarations
command while you replay recorded statements by using thePLAYBACK
commands by using thePLAYBACK
command.
Examples
- Define two C integers.
int myvar, hisvar;
- Define an enumeration variable
status
that represents the following values:Enumeration Constant Integer Representation run 0 create 1 delete 5 suspend 6 enum statustag {run, create, delete=5, suspend} status;
- Define a variable in a
struct
declaration.struct atag { char foo; int var1; } avar;
- Interactively declare variables using structure tags.
then specify:struct tagone {int a; int b;} c;
struct tagone d;
Refer to the following topics for more information related to the material discussed in this topic.
- Related tasks
- IBM® z/OS Debugger User's Guide