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.

Read syntax diagramSkip visual syntax diagramscalar_def,declaratorenum_defstruct_defunion_def,declarator;
scalar_def
Read syntax diagramSkip visual syntax diagramcharsignedunsigneddoublelongfloatintsignedunsignedlongshortlongsignedunsignedintdoubleshortsignedunsignedintsignedlongshortintcharunsignedlongshortintcharvoid*
declarator
Read syntax diagramSkip visual syntax diagram*identifier(identifier)identifier[integer]
enum_def
Read syntax diagramSkip visual syntax diagramenumidentifier{,identifier=constant_expr}
struct_def
Read syntax diagramSkip visual syntax diagram_Packedstructidentifier,identifier{;enum_defscalar_defstruct_defunion_def}
union_def
Read syntax diagramSkip visual syntax diagram_Packedunionidentifier,identifier{;enum_defscalar_defstruct_defunion_def}
*
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 or case 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 the PLAYBACK commands by using the PLAYBACK 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.
    struct tagone {int a; int b;} c;
    then specify:
    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