IBM implemented the COBOL2002 CDF and constant definition - GnuCOBOL supports that, too (actually supported it much longer - before any other compiler) with one exception: >> EVALUATE is not implemented yet - patches welcome.
So in general you should be fine using that. The exact syntax is:
COBOL Crew,
Is there any support conditional compile similar to what is
implemented for IBM here:
https://www.ibm.com/docs/en/i/7.4?topic=cd-conditional-compilation
Or for Micro Focus here:
https://www.microfocus.com/documentation/visual-cobol/vc60/DevHub/HRLHLHCOMP0J.html
Or Micro Focus Constants:
https://www.microfocus.com/documentation/visual-cobol/vc60/DevHub/HRCDRHCDIR24.html
I would like to find a way to make something like this work:
CONSTANT MYSUB 10
01 SOMEVAR PIC X OCCURS MYSUB TIMES.
That is: I can define a constant and then do a replace anywhere in the
code with the specified value.
Similar to what the C preprocessor does with #define.
IBM implemented the COBOL2002 CDF and constant definition - GnuCOBOL supports that, too (actually supported it much longer - before any other compiler) with one exception:
>> EVALUATE
is not implemented yet - patches welcome.So in general you should be fine using that. The exact syntax is:
GnuCOBOL also supports the common extension with level 78 constants:
The programmer's guide likely has documentation on how to use this including how to pass definitions from the command-line.