cobol-check icon indicating copy to clipboard operation
cobol-check copied to clipboard

[ENHANCEMENT] Array initializer

Open axtens opened this issue 1 year ago • 2 comments

Currenly the test case says

TestCase "Latest score"
        MOVE '100,0,90,30' TO WS-SCORES
        MOVE "latest" TO WS-PROPERTY
        PERFORM HIGH-SCORES
        EXPECT WS-RESULT = 30

In HIGH-SCORES, WS-SCORES needs to UNSTRINGed into a table. Another option is to move '100000090030' to WS-SCORES and decompose the data with working-storage structures.

Assuming a WS-SCORES-TABLE with sufficient space to hold the elements, an instruction 'MOVE-EACH' is suggested that parses the supplied list of values into the table, e.g.

MOVE-EACH 100,0,90,30 TO WS-SCORES-TABLE

If the table is of strings, allow for the MOVE-EACH to handle then viz

MOVE-EACH 'Agaricomycetes','Arthoniomycetes','Coniocybomycetes','Dothideomycetes','Eurotiomycetes','Lecanoromycetes','Lichinomycetes','Sordariomycetes' TO WS-LICHEN-FUNGAL-CLASSES-TABLE

axtens avatar Jun 23 '23 14:06 axtens