Page 2 of 2

Re: Extract lines of code

PostPosted: Fri Nov 16, 2018 12:44 am
by Pedro
I am not that familiar with Cobol syntax... but it seems that your example is missing some separators and delimiters. That is, should it have some commas and maybe a semicolon? My advice would be more complete of the example was also more complete.

After you find the REDEFINES, I think you should search for the prior ' 01 ' and search for the delimiter character that follows REDEFINES.

When I have done such searching, I have made a copy of the data, then blanked out quoted strings and comments. Also, names of objects pose a problem. You want avoid processing your search text that occurs out-of-context, for example:
01 MYREDEFINES PIC X(10)


Make a copy, process the copy, then map that to the original file to extract the lines needed. Yeah, it is non-trivial.