Declarations (COBOL)

Use declarations to declare session variables 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 declared with declarations can be used in other z/OS Debugger commands as if they were declared to the compiler. Declared variables are removed when your z/OS Debugger session ends or when the CLEAR command is used to remove them. The keywords cannot be abbreviated.

Read syntax diagramSkip visual syntax diagram;levelidentifierattributeusage_attribute;
attribute
Read syntax diagramSkip visual syntax diagramPICPICTUREISpictureusage_attribute
usage_attribute
Read syntax diagramSkip visual syntax diagram USAGEIS POINTERBINARYCOMPCOMPUTATIONALCOMP-1COMPUTATIONAL-1COMP-2COMPUTATIONAL-2
level
1 or 77.
identifier
A valid COBOL data name (including DBCS data names).
picture
A sequence of characters from the set: S X 9 (replication factor is optional).

If picture is not X(*), the COBOL USAGE clause is required.

Usage notes

  • For Enterprise COBOL for z/OS Version 5, if you declare a session variable by using the attribute UNSIGNED BINARY, it can be used only when the current qualification is an Enterprise COBOL for z/OS Version 5 program.
  • For Enterprise COBOL for z/OS Version 5, it enforces COBOL rules for variable names when session variables are declared. Version 4 allows some invalid names to be used. Some examples are as follows:
    • For Version 5, it does not allow the name "4-44"; however, the name is allowed in Version 4. The name is invalid because COBOL requires at least one alphabetical character in a variable name.
    • For Version 5, it does not allow the name "SV12#"; however, the name is allowed in Version 4. The name is invalid because '#' is not allowed. Only '-', '_', and alphanumerical characters are allowed in a COBOL variable name.
    • For Version 5, it does not allow the name "_SV12"; however, the name is allowed in Version 4. The name is invalid because '_' cannot be used as the first character in a variable name.
  • For Enterprise COBOL for z/OS Version 5, COMP-4 and COMPUTATIONAL-4 are also accepted.
  • A declaration cannot be used in a command list; for example, as the subject of an IF command or WHEN clause.
  • BINARY and COMP are equivalent.
  • Use BINARY or COMP for COMPUTATIONAL-4.
  • COMP-1 is short floating point (4 bytes).
  • COMP-2 is long floating point (8 bytes).
  • Only COBOL PICTURE and USAGE clauses are supported.
  • Short forms of COMPUTATIONAL (COMP) are supported.

Examples

  • Define a variable named floattmp to hold a floating-point number.
    01 floattmp USAGE COMP-1;
  • Define an integer variable name temp.
    77 temp PIC S9(9) USAGE COMP;

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
  • Related references
  • Enterprise COBOL for z/OS Language Reference