DECLARE command (PL/I)

The DECLARE command declares session variables that are effective during a z/OS® Debugger session. Variables declared this way can be used in other z/OS Debugger commands as if they were declared to the compiler. They are removed with the CLEAR command or when your z/OS Debugger session ends. The keywords cannot be abbreviated.

Read syntax diagramSkip visual syntax diagramDCLDECLARE,major_structurescalar;
major_structure
Read syntax diagramSkip visual syntax diagram,levelnameattribute
scalar
Read syntax diagramSkip visual syntax diagram,name(,name)attribute
level
An unsigned positive integer. Level 1 must be specified for major structure names.
name
A valid PL/I identifier. The name must be unique within a particular structure level.
When name conflicts occur, z/OS Debugger uses session variables before using other variables of the same name that appear in the running programs. Use qualification to refer to the program variable during a z/OS Debugger session. For example, to display the variable a declared with the DECLARE command as well as the variable a in the program, issue the LIST command as follows:
LIST (a, %BLOCK:a);

If a name conflict occurs because the variable was declared earlier with a DECLARE command, the new declaration overrides the previous one.

attribute
A PL/I data or storage attribute.
Acceptable PL/I data attributes include:
     BINARY        CPLX       FIXED      LABEL      PTR
     BIT           DECIMAL    FLOAT      OFFSET     REAL
     CHARACTERS    EVENT      GRAPHIC    POINTER    VARYING
     COMPLEX
Acceptable PL/I storage attributes include:
     BASED    ALIGNED    UNALIGNED

Pointers cannot be specified with the BASED option.

Only simple factoring of attributes is allowed. DECLAREs such as the following are not allowed:
DCL (a(2), b) PTR;
DCL (x REAL, y CPLX) FIXED BIN(31);

Also, the precision attribute and scale factor as well as the bounds of a dimension can be specified. If a session variable has dimensions and bounds, these must be declared following PL/I language rules.

Usage notes

  • DECLARE is not valid as a subcommand. That is, it cannot be used as part of a DO/END or BEGIN/END block.
  • Initialization is not supported.
  • Program DEFAULT statements do not affect the DECLARE command.
  • If you are debugging a Enterprise PL/I program, you cannot declare arrays, structures, factor attributes, or multiple session variables in one command line.
  • The DECLARE command cannot be used while you replay recorded statements by using the PLAYBACK commands.
Examples
  • Declare x, y, and z as variables that can be used as pointers.
    DECLARE (x, y, z) POINTER;
  • Declare a as a variable that can represent binary, fixed-point data items of 15 bits.
    DECLARE a FIXED BIN(15);
  • Declare d03 as a variable that can represent binary, floating-point, complex data items.
    DECLARE d03 FLOAT BIN COMPLEX;
    This d03 will have the attribute of FLOAT BINARY(21).
  • Declare x as a pointer, and setx as a major structure with structure elements a and b as fixed-point data items.
    DECLARE x POINTER, 1 setx, 2 a FIXED, 2 b FIXED;
    This a and b will have the attributes of FIXED DECIMAL(5).

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

Refer to the following topics for more information related to the material discussed in this topic.

  • Related references
  • Enterprise PL/I for z/OS Language Reference