Page 1 of 1

Doubt in Array datatype

PostPosted: Thu Feb 23, 2012 11:21 pm
by nareshv_99
hi all,
could you clarify my below doubt

consider below variable declaration

GROUP DS 0XL3
GROUP1 DS XL1
GRPVAL EQU X'AA'
GROUP2 DS CL1
GROUP3 DS CL1

so is GROUP variable an array of GROUP1,GRPVAL AND GROUP2 or GROUP1,GROUP2,GROUP3 ?

i believe it GROUP array consists of GROUP1,GROUP2(can have value of x'AA'),GROUP3. could you confirm if i'm correct?

consider below variable declaration
GROUP DS 0XL3
GROUP1 DS XL1
GROUP2 DS CL4

isn't GROUP array contains GROUP1, GROUP2,GROUP+8 ?

Re: Doubt in Array datatype

PostPosted: Thu Feb 23, 2012 11:38 pm
by Robert Sample
Does the assembler output shed any light?
.000018                               38 GROUP    DS    0XL3
.000018                               39 GROUP1   DS    XL1
.                      000AA          40 GRPVAL   EQU   X'AA'
.000019                               41 GROUP2   DS    CL1
.00001A                               42 GROUP3   DS    CL1

Re: Doubt in Array datatype

PostPosted: Fri Feb 24, 2012 2:36 am
by steve-myers
There is no such thing as an "array datatype" in Assembler.

GROUP DS 0XL3

just tells the Assembler there is a storage area named GROUP, and that it is 3 bytes long, but is "repeated" 0 times. In other words it is just the start of storage. As written, it implies that the GROUP1, GROUP2 and GROUP3 are grouped together, but this is not something the Assembler does; it is for the convenience of the programmer. The Assembler makes no connection between GROUP, GROUP1, GROUP2 and GROUP3. If the programmer should insert some storage between say, GROUP2 and GROUP3, the Assembler will be perfectly happy. The program may not be perfectly happy, but that's another issue.

Something like ARRAY DS 10F sort of implies an array, but it does no such thing for the Assembler.