I need to parse some legacy COBOL-85 files that exhibit some lines that are shorter than the expected 80 chars. An example is below.
WORKING-STORAGE SECTION. 00000000<-- line ends here
01 VAR1 PIC S9. 00000000<-- line ends here
* COMMENT 1 00000000<-- line ends here
COPY SQLCA. 00000000<-- line ends here
* COMMENT 1 00000000<-- line ends here
COPY COPY1. 00000000<-- line ends here
COPY COPY2. 00000000<-- line ends here
* COMMENT 1 00000000<-- line ends here
* COMMENT 2 00000000<-- line ends here
05 FILLER PIC X(10). <-- line ends here
05 VAR2. 00000000<-- line ends here
10 VAR3 PIC X(8). 00000000<-- line ends here
Is this a special format/dialect? Some files have IBM-4381 as SOURCE-COMPUTER, some others have IBM-3090.
By the way, I tried to treat specially the case of the 59 chars line, but other source files in the same program are different, with no comment area or spaces at the end, having length <= 80 chars. So in these files a line can have 59 characters, but is not parsable as the special line, expecting to have the comment area at the end.