Defining Storage and Constants:
To define empty storage:
Format: label DS rSLn
r repetition factor
- number of n length storage classes to repeat
- optional decimal number
- default: 1
Ln length
- n is the number of bytes of the storage area
- optional decimal number
- L must be coded if n is going to be specified
- default: depends on the storage class
S storage class
- type of data that will be stored
- two types
F - fullword data
- numbers to do arithmetic with
- default length: 4 bytes
- data type: 32-bit twos complement integer
- alignment: fullword boundary
absolute address divisible by 4
NUM1 DS F ==> 1 fullword ==> 4 bytes
NUM2 DS 5F ==> 5 fullwords ==> 20 bytes
NUM3 DS FL3 ==> 3 bytes
NUM4 DS 4FL2 ==> 8 bytes
C - Character data
- default length: 1 byte
- data type: EBCDIC characters (1 character/byte)
- alignment: none
TEXT1 DS CL4 ==> 4 bytes
TEXT2 DS 10CL6 ==> 60 bytes
TEXT3 DS 10C ==> 10 bytes
To define a constant:
Format: label DC rSLn‘value’
r repetition factor
S storage class
Ln length
value constant (or initial) value
- enclosed in single quotes
In storage:
NUM1 DC F’27’ 0000001B
NUM2 DC F’-1’ FFFFFFFF
NUM3 DC F’2,-1,18' 00000002FFFFFFFF00000012
NUM4 DC 3F’1’ 000000010000000100000001
TEXT1 DC C’HELLO’ C8C5D3D3D6
TEXT2 DC CL8’HELLO’ C8C5D3D3D6404040
TEXT3 DC CL3’HELLO’ C8C5D3
TEXT4 DS CL4’BYE’ F5F5F5F5 <- empty storage
NOTE: a ‘value’ may be specified on a DS statement, but it will be ignored