STORAGE command

The STORAGE command enables you to alter storage. You must be careful when you alter storage because the results can be unpredictable.

Read syntax diagramSkip visual syntax diagramSTORAGE( addressreference'reference' ,offset,length )=value;
address
The address of the first byte of storage that you want to alter.
reference
A variable whose storage location is to be changed. In assembler or disassembly, this operand may be specified as any assembler expression that represents a storage location.
'reference'
A LangX COBOL variable whose storage location is to be changed. In LangX COBOL, reference must be enclosed in apostrophes (').
offset
The decimal or hexadecimal number of bytes indicating the starting offset from the memory location pointed to by reference’s address or the address provided by the user. Offset can be a negative number. If offset is a hex constant, it must follow the same syntax rules as address above. The default is 0.
length
The decimal number of bytes you want to alter. This must equal the length of value.
value
The value you want to store. The notation for value must be one of the following:
  • An address.
  • A hexadecimal value surrounded by apostrophes (') and preceded by "X". You can also use a different notation for the following programming languages:
    • For PL/I, the hexadecimal value enclosed in quotation marks (") or apostrophes (') followed by PX.
    • For assembler, COBOL, LangX COBOL, or disassembly, the hexadecimal value enclosed in quotation marks (") and preceded by "X".
  • A decimal value. For any decimal value, four bytes are altered. For example, STORAGE (H'12345678') = 3 is the same as STORAGE(H'12345678') = H'00000003'.
  • A character string up to 256 bytes long, using the character string notation appropriate for each programming language or, for all programming languages, you can use enclose the string in quotation marks (").

Usage notes

  • If you specify only two parameters, z/OS® Debugger assumes the second parameter is the length.
  • If you specify only one parameter, z/OS Debugger assumes the offset is 0 and that the length is equal to the length of value.
  • The STORAGE command cannot be used while you replay recorded statements by using the PLAYBACK commands.
  • 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.
  • If reference is a pointer, z/OS Debugger changes the contents at the address given by that pointer.

Examples

  • For any programming language, enter the following command to alter two bytes of storage at address X'12345678':
    STORAGE (X'12345678') = 0x1234;
  • For C, enter the following command to alter two bytes of storage at address X'12345678':
    STORAGE (0x12345678) = 0x1234;
  • For COBOL, enter the following command to alter four bytes of storage at address X'12345678':
    STORAGE (H'12345678') = H'1234'
    The command is changed to:
    STORAGE (H'12345678') = H'00001234'
  • For COBOL, enter the following command to alter six bytes of storage at address X'12345678':
    STORAGE (H'12345678') = X'C1C1C1C1C1C1'
  • For PL/I, enter the following command to alter six bytes of storage at address X'12345678':
    STORAGE ('12345678'PX) = 'C1C1C1C1C1C1'X
  • For PL/I enter the following command to alter 23 bytes of storage starting at address X'12345678':
    STORAGE ('12345678'PX) = 'aaaaaaaaaaaaaaaaaaaaaaa'
  • Enter the following command to alter 10 bytes of storage at MYVAR, starting at offset 2:
    STORAGE (MYVAR, 2, 10) = 'new text: ';
  • Enter the following command to alter 4 bytes of storage at address X'20CD0', starting at offset 10:
    STORAGE ('20CD0'PX, 10, 4) = 99;
  • Enter the following command to alter storage at MYVAR, starting at offset 0, for the same number of bytes as the length of variable MYVAR:
    STORAGE (MYVAR) = 10;
  • For C, update the storage pointed by an address 1A3BE910, starting at offset -20 for 20 bytes:
     STORAGE (0x1A3BE910,-20,20) = 'first and last name ';
  • Update 20 bytes of storage pointed by an address 162F0, language is COBOL, offset is 0:
    STORAGE ( H'162F0', 20 ) = 'clear that string ' ;
  • For Assembler, update the storage pointed by address 00020CD0, starting at offset 16 for 4 bytes, and the offset is specified as a hex constant:
     STORAGE ( X'00020CD0', X'10', 4 ) = 5 ;

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