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 diagram
>>-STORAGE--(--+-address---------+--+--------------------------+--)--=--value--;-><
               +-reference-------+  '-+-----------+--,--length-'                   
               '-'--reference--'-'    '-,--offset-'                                

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

Examples

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