New to COBOL.. I would like to populate a table. I want it to have two columns and eight rows in each column. I want to "hard code" these different values into the first colum, with one in each field. They are Non-integer fixed point values (Swedish comma notation): 16,0 17,0 18,5 25,0 30,0 35,0 40,0 99,0. The second column should be filled with strings up to 30 charachters in each row/field. I think I've managed to do the table, however, I don't know how to populate it in the best way.
01 BMI_tabell.
05 tabell_columns_highbreak OCCURS 2 TIMES.
10 Cutoffhigh_rows OCCURS 8 TIMES.
15 numBMI_cat_high_break PIC 99.9.
10 BMI_meddelande_kort_rows OCCURS 8 TIMES.
15 BMI_meddelande_kort_cat_X pic X(30).
This is in the "data division." under "working-storage section."
I tried initializing each table item individually, according to IBM documentation, but did not get it to work due to the "nested" nature of the table.
To access multi-dimensional tables in
PROCEDURE DIVISION- just separate it by comma:In any case: Check if you really do want edited fields - the
.withinPIC 99.9or if you want to use fields that can be used for calculation which would bePIC 99v9... and possibly have a look atDECIMAL-POINT IS COMMAinSPECIAL-NAMESif you want to use a comma instead of a period in decimals.Note: You likely want to place both "fixed" and "variable" content in the same row, that would be:
BTW: To not look "alien" to most COBOL programmers: consider using hyphens
-instead of underscores_in user-defined names (language-wise both are OK, just stick to one).