COBOL Record description entry I cannot decipher

124 Views Asked by At

I am examining this example in Cobol 85 from the NIST TestSuite:

007700 WORKING-STORAGE SECTION.                                         SQ4014.2
007800                                                                  SQ4014.2
007900 01 VARIABLES.                                                    SQ4014.2
008000                                                                  SQ4014.2
008100     03 VKEY                                                      SQ4014.2
008200     XXXXX086.                                                    SQ4014.2
008300                                                                  SQ4014.2
008400                                                                  SQ4014.2
008500 PROCEDURE DIVISION.                                              SQ4014.2
008600                                                                  SQ4014.2

To me it seems wrong because the the record description entry 03 VKEY should be followed by some keyword, like VALUE. It is instead followed by an identifier (XXXXX086) which I do not know how to interpret. What does it mean in this context?

2

There are 2 best solutions below

1
cschneid On

As written, that is a compile error. Which may be what is being tested by that particular member of the test suite.

It's also possible it is intended to be modified via a preprocessor. Note other members of the NIST suite with non-standard characters in column 7.

Not all members of the NIST test suite are valid COBOL.

2
Simon Sobisch On

I'm not sure where you got the sample from, it looks like it was directly taken from newcob.val. If extracted "as expected" the COBOL line is:

007700 WORKING-STORAGE SECTION.                                         SQ4014.2
007800                                                                  SQ4014.2
007900 01 VARIABLES.                                                    SQ4014.2
008000                                                                  SQ4014.2
008100     03 VKEY                                                      SQ4014.2
008200     PIC X(8).                                                    SQ4014.2
008300                                                                  SQ4014.2
008400                                                                  SQ4014.2
008500 PROCEDURE DIVISION.                                              SQ4014.2

so it is as cschneid said: it is to be preprocessed before it is compiled and otherwise would raise an error.

A side note: the test programs say in the header what they test for, this one says:

000400*THE FOLLOWING PROGRAM TESTS THE FLAGGING OF HIGH                 SQ4014.2
000500*SUBSET FEATURES THAT ARE USED IN SEQUENTIAL                      SQ4014.2

so it does not expect any errors.

The easiest option to extract it I know of is to get a copy of GnuCOBOL and ideally run the configure part, then running make test in the "tests/cobol85" subdirectory (or use the perl scripts in there to extract the files manually). You'll end up with one subdirectory for each module of the test suite.