grammarware / software-evolution

Software Evolution
MIT License
1 stars 0 forks source link

Composite arithmetic on sub-composite elements #15

Open MrDurion opened 8 months ago

MrDurion commented 8 months ago

For the ADD and SUBTRACT statements, we are required to also add composite data, adding sub-elements if they have the same name. However, it is unclear what should happen when the sub-elements are different data structures.

We have 4 cases that can occur, and have assumed behavior for two of them, but we are unsure what should happen for the other two.

An example where this would occur:

IDENTIFICATION DIVISION.
    PROGRAM-ID. EXAMPLE.
DATA DIVISION.
    01 A.
    02 C PICTURE OF 99 VALUE 11.
    01 B.
    02 C PICTURE OF 9 VALUE 2.
    02 D PICTURE OF 99 VALUE 33.
    01 E.
    02 C.
    03 Q PICTURE OF 999 VALUE 44.
PROCEDURE DIVISION.
    ADD A TO E.
    STOP

How are we supposed to handle this?

grammarware commented 8 months ago