Open LastAdequateCoder opened 6 months ago
It means that it defines a composite data structure. As in,
01 R.
03 F PICTURE IS 999.
03 G PICTURE IS X.
Will define a record R
with two fields: F OF R
and G OF R
.
Follow up question for this one, would something like this be possible:
Hierarchy is preserved within the Record Variables but the level numeration differs from one Record to another (which I assume is fine as long as the levels themselves are in increasing order)
Seems totally fine to me, except for two fields named N OF LAST
.
Some dialects of COBOL (e.g., GnuCobol) will complain if the top level is not 01
, but internal numeration can differ per record without consequences.
Ye, about the first level, mainly the "01 Working-Storage Area". The paper mentions it is optional, so I assume the line is intended to just "set" the threshhold for levels beyond? Could it be "05 Working-Storage Area" meaning that all levels within the data have to be below 05
In BabyCobol, it could be anything or even nothing at all, just go with your R/Last/Something/…, you can have multiple records and/or fields on level 01.
In COBOL, the DATA DIVISION
consists of sections, and the one with what would have been "local variables", is called WORKING-STORAGE SECTION
(without level). So for instance if you use an online COBOL compiler to check how some of your code behaves, you might need to add that one line just for your BabyCobol code to become valid COBOL code. So the top level record with that name in the paper is just a reference to that section.
For the data-division section it is said that "if neither the PICTURE nor the LIKE clause are used, such an entry defines a record". Does it mean that we can define a variable with no type? If so, how can the PICTURE be defined later in the program for such variable or will it always remain as 'no type'?![image](https://github.com/grammarware/software-evolution/assets/159555546/e03608a1-2dcf-4304-9a1a-7b81cc94721b)