AT CHANGE command (full screen mode, line mode, batch mode)
Gives z/OS® Debugger control when either the program or z/OS Debugger command changes the specified variable value or storage location.
- GLOBAL
- Specifies that the AT CHANGE breakpoint is global. The AT CHANGE breakpoint is not limited to a specific compile unit; it spans the entire application. This is the default.
- LOCAL
- Specifies that the AT CHANGE breakpoint is limited to a specific
compile unit.
- cu_spec
- A valid compile unit specification. Specifies that the AT CHANGE breakpoint is limited to this compile unit.
- condition
- A valid, simple z/OS Debugger conditional expression. Simple means that you use only one operator; for example, a < b.
- reference
- A valid z/OS Debugger reference in the current programming language.
- 'reference'
- A valid z/OS Debugger reference when the current programming language is LangX COBOL.
- %STORAGE
- A built-in function that
provides an alternative way to select an
AT CHANGEsubject.- address
- The starting address of storage to be watched for changes.
- length
- The number of bytes of storage being watched for changes. This must be a positive integer constant. The default value is 1.
- command
- A valid z/OS Debugger command. If you are using remote debug mode, you can specify only commands that are supported in remote debug mode.
Usage notes
- If an
AT CHANGEbreakpoint is set on a file record of a BLOCKED QSAM file that is open OUTPUT or EXTEND, the breakpoint might not occur as expected when the WRITE statement is used. The breakpoint behavior in this case is not predictable because the file record is mapped onto the data management buffer.To get predictable
AT CHANGEbehavior in this case, set up the file to use a SAME RECORD AREA clause. - Data is watched only in storage; hence a value that is being kept in a register because of
compiler optimization cannot be watched. In addition, the z/OS Debugger variables
%GPRn,%Rn,%FPRn,%LPRn,%EPRn, and any assembler or disassembly symbols representing registers cannot be watched. - Only entire bytes are watched; bits or bit strings within a byte cannot be singled out.
- Because
AT CHANGEbreakpoints are identified by storage address and length, it is not possible to have twoAT CHANGEbreakpoints for the same area (address and length) of storage. That is, anAT CHANGEcommand replaces a previousAT CHANGEcommand if the storage address and length are the same. However, any other overlap is ignored and the breakpoints are considered to be for two separate variables. For example, if the storage address is the same, but the length is different, theAT CHANGEcommand does not replace the previousAT CHANGE. - When more than one
AT CHANGEbreakpoint is triggered at a time,AT CHANGEbreakpoints are triggered in the order that they were entered. However, if the triggering of one breakpoint causes a variable watched by a different breakpoint to change, the ordering of the triggers will not necessarily be according to when they were originally entered. For example,AT CHANGE y LIST y; AT CHANGE x y = 4; GO;If the next statement to be executed in your program causes the value of
xto change, theCHANGE xbreakpoint is triggered when z/OS Debugger gains control. Processing ofCHANGE xcauses the value ofyto change. If you typeGO;after being informed thatCHANGE xwas triggered, z/OS Debugger triggers theCHANGE ybreakpoint (before returning control to your program).In this case, the
CHANGE ybreakpoint was entered first, but theCHANGE xbreakpoint was triggered first (because it caused theCHANGE ybreakpoint to be triggered). %STORAGEis a z/OS Debugger built-in function that is available only with theAT CHANGEcommand.- For a CICS® application on z/OS Debugger, the
CHANGE %STORAGEbreakpoint is cleared at the end of the last process in the application. For a non-CICS application on z/OS Debugger, it is cleared at the end of a process. - The referenced variables must exist when the
AT CHANGEbreakpoint is defined. One way to ensure this is to embed theAT CHANGEin anAT ENTRY. - An
AT CHANGEbreakpoint gets removed automatically when the specified variable is no longer defined.AT CHANGEs for C static variables are removed when the module defining the variable is removed from storage. For C storage that is allocated usingmalloc()orcalloc(), this occurs when the dynamic storage is freed usingfree(). - Changes are not detected immediately, but only at the completion of any command that has the
potential of changing storage, variable values, or the logical condition. If you specify a single
reference, you can restrict the circumstances under which the
CHANGEcondition is raised by specifying aWHENcondition. If you enter a z/OS Debugger command that modifies a variable being watched, theCHANGEcondition is raised immediately if noWHENcondition is specified. If aWHENcondition is specified, theCHANGEcondition is only raised if the variable is modified and theWHENcondition is true. You can force more or less frequent checking by using theSET CHANGEcommand. - C and C++
AT CHANGEbreakpoint requirements- The variable must be an lvalue or an array.
- The variable must be declared in an active block if the variable is a parameter or has a storage
class of
auto. - A
CHANGEbreakpoint defined for a static variable is automatically removed when the file in which the variable was declared is no longer active. ACHANGEbreakpoint defined for an external variable is automatically removed when the module where the variable was declared is no longer active. - If reference is a pointer, z/OS Debugger stops when the contents of storage at the address given by that pointer changes.
- COBOL
AT CHANGEbreakpoint requirementsAT CHANGEusing a storage address should not reference a data item that follows a variable-size element or subgroup within a group. COBOL dynamically remaps the group when a variable-size element changes size.- Be careful when examining a variable whose allocated storage follows that of a variable-size element. COBOL dynamically remaps the storage for the element any time it changes size. This could alter the address of the variable you want to examine.
- You cannot set a
CHANGEbreakpoint for a COBOL file record before the file is opened. - The variable, when in the local storage section, must be declared in an active block.
- PL/I
AT CHANGEbreakpoint requirementsCHANGEbreakpoint is removed for based or controlled variables when they areFREEd and for parameters andAUTOMATICvariables when the block in which they are declared is no longer active.CHANGEmonitors only structures with single scalar elements. Structures containing more than one scalar element are not supported.- The variable must be a valid reference for the current block.
- The breakpoint is automatically removed after the referenced variable ceases to exist.
- A
CHANGEbreakpoint monitors the storage allocated to the current generation of a controlled variable. If you subsequently allocate new generations, they are not monitored.
- For PL/I and C/C++, when you specify a reference,
z/OS Debugger calculates the address of the
reference only once, when it runs the
AT CHANGEcommand the first time. Thereafter, z/OS Debugger monitors the storage location indicated by that address.For the following items, z/OS Debugger recalculates the address of reference each time it monitors the storage location. If the address of reference changes, z/OS Debugger uses the new storage location as the address to monitor:- COBOL variables whose address can change
- Assembler DSECT items that are in the range of an active USING when you enter the
AT CHANGEcommand - Assembler absolute locations that are in the range of an active USING when you enter the
AT CHANGEcommand
- When you free storage with the
STORAGE RELEASEmacro in an assembler or disassembly program, it is not possible to detect when the storage is freed. If you set anAT CHANGEbreakpoint on storage freed by aSTORAGE RELEASEmacro, unexpected results might occur, such as the triggering of the breakpoint at unexpected times. - The
AT CHANGEcommand cannot be used while you replay recorded statements by using thePLAYBACKcommands. - For optimized COBOL programs, the specified variable cannot be a variable that was discarded due to compiler optimization.
- When you use a COBOL level-88 variable on an
AT CHANGEcommand, the current setting of the value is saved. z/OS Debugger stops at the breakpoint only if the setting of the COBOL level-88 variable changes from the saved value to a different value. For example, if the saved value was TRUE and the new value is FALSE, z/OS Debugger stops at the breakpoint. Note that level-88 variables cannot be listed in LangX COBOL. - To use a COBOL level-88 variable with the
AT CHANGEcommand, you (through a z/OS Debugger command) or the program must have previously set the variable to one of the values specified in the variable's declaration. If you do not do this, z/OS Debugger behavior becomes unpredictable. - When you use a condition, the variables used in the condition or the condition are not evaluated
at the time the breakpoint is set but when the location associated with the
AT CHANGEcommand changes. - Only the following conditional operators can be used in a condition:
- =
- Compare the two operands for equality.
- ¬=
- Compare the two operands for inequality.
- <
- Determines whether the left operand is less than the right operand.
- >
- Determines whether the left operand is greater than the right operand.
- <=
- Determines whether the left operand is less than or equal to the right operand.
- >=
- Determines whether the left operand is greater than or equal to the right operand.
- &
- Logical "and" operation.
- |
- Logical "or" operation.
- If you use the
AT CHANGEcommand with aWHENcondition, every time the variable changes the condition is evaluated. If the condition evaluates to true, z/OS Debugger stops and runs the command associated with the breakpoint. - When z/OS Debugger evaluates the
condition and the condition is invalid, z/OS Debugger does one of the following actions:
- If
SET WARNINGis set toON, z/OS Debugger stops and displays a message that it could not evaluate the condition. You need to enter a command to indicate what action you want z/OS Debugger to take. - If
SET WARNINGis set toOFF, z/OS Debugger does not stop nor display a message that it could not evaluate the condition. z/OS Debugger continues running the program.
- If
- If you specify address with more than 8 significant digits or if reference references 64-bit addressable storage, z/OS Debugger assumes that the storage location is 64-bit addressable storage. Otherwise, z/OS Debugger assumes that the storage location is 31-bit addressable storage.
Examples
- Identify the current location each time variable
varbl1orvarbl2is found to have a changed value. The current programming language setting is COBOL.AT CHANGE (varbl1, varbl2) PERFORM QUERY LOCATION; GO; END-PERFORM; - When storage at the hex address 22222 changes, print a message
in the log. Eight bytes of storage are to be watched. The current
programming language setting is C.
AT CHANGE %STORAGE (0x00022222, 8) LIST "Storage has changed at hex address 22222"; - Set two breakpoints when storage at the hex address 1000 changes.
The variable
xis defined at hex address 1000 and is 20 bytes in length. In the first breakpoint, 20 bytes of storage are to be watched. In the second breakpoint, 50 bytes of storage are to be watched. The current programming language setting is C.AT CHANGE %STORAGE (0x00001000, 20) /* Breakpoint 1 set */ AT CHANGE %STORAGE (0x00001000, 50) /* Breakpoint 2 set */ AT CHANGE x /* Replaces breakpoint 1, since x is at */ /* hex address 1000 and is 20 bytes long */ - Stop when a variable reaches a value that is greater than 200.
AT CHANGE MYVAR WHEN MYVAR > 200 ;MYVAR > 200is a condition. Every time the value ofMYVARchanges, the conditionMYVAR > 200is evaluated. Changes toMYVARdo not trigger theAT CHANGEbreakpoint. Only whenMYVARchanges and the conditionMYVAR > 200becomes true is theAT CHANGEbreakpoint triggered.
Refer to the following topics for more information related to the material discussed in this topic.
- Related tasks
- "Controlling how z/OS Debugger handles invalid comparisons" in the IBM® z/OS Debugger User's Guide
- Related references
- address
- every_clause syntax
- references
- PLAYBACK commands
- z/OS Debugger commands supported in Debug Tool compatibility mode
