Thursday, December 8, 2011

COOL: All 01 level items are aligned on double word boundary - Proof


The below simple program proves that all the 01 level items are aligned on double word boundary

WORKING-STORAGE SECTION.
01 A PIC X(3) VALUE 'AAA'.
01 B PIC X(3) VALUE 'BBB'.
01 C PIC 9(2) VALUE 9.
PROCEDURE DIVISION.
DISPLAY A(1:C)

Output
----+----1
AAA      B

You can see that variable "A" takes up 8 positions and value of variable "B" starts in the 9th position.  

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.