SET command (COBOL)

The SET command assigns a value to a COBOL reference. The SET keyword cannot be abbreviated.

Read syntax diagramSkip visual syntax diagramSETreferenceTOreferenceliteralTRUE;
reference
A valid z/OS® Debugger COBOL reference.
literal
A valid COBOL numeric literal constant.
TRUE
The value assigned to a COBOL level-88 reference.
Usage notes
  • For Enterprise COBOL for z/OS Version 5, you cannot use the SET command to set an index with a non-integer data item (e.g. PIC 9v9).
  • For Enterprise COBOL for z/OS Version 5, you can set a pointer to the address of an array. The pointer is set to the start of the array.
  • You can assign the value TRUE only to a COBOL level-88 reference.
  • If z/OS Debugger was started because of a computational condition or an attention interrupt, using an assignment to set a variable might not give expected results. This is due to the uncertainty of variable values within statements as opposed to their values at statement boundaries.
  • SET assigns a value only to a single receiver; unlike COBOL, multiple receiver variables are not supported.
  • Only formats 1, 4 and 5 of the COBOL SET command are supported.
  • Index-names can only be program variables (because OCCURS is not supported for the z/OS Debugger session variables).
  • COBOL ADDRESS OF identifier is supported only for identifiers that are LINKAGE SECTION variables. In addition, COBOL ADDRESS OF as a receiver must be level 1 or 77, and COBOL ADDRESS OF as a sender can be any level except 66 or 88.
  • z/OS Debugger provides a hexadecimal constant that can be used with the SET command, where the hexadecimal value is preceded by an "H" and delimited by quotation marks (") or apostrophes (').
  • If the DATA option of the PLAYBACK ENABLE command is in effect, you can use the SET command to assign a value only to a session variable. You cannot assign a value to a program variable.
  • If you are debugging an optimized COBOL program, you can use the SET command to assign a value to a program variable only if you first enter the SET WARNING OFF command. The source or target of the SET command cannot reference a variable that was discarded by the optimizer.

Examples

  • Assign the value 3 to inx1, the index to itm-1.
    SET inx1 TO 3;
  • Assign the value of inx1 to inx2.
    SET inx2 TO inx1;
  • Assign the value of an invalid address (nonnumeric 0) to ptr and:
    SET ptr TO NULL;
  • Assign the address of one to ptr.
    SET ptr TO ADDRESS OF one;
  • Assigns the hexadecimal value of '20000' to the pointer ptr.
    SET ptr TO H'200000';

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