Created On:  07 November 2011


A client was testing an existing legacy application using Visual COBOL in Visual Studio 2010 for the first time. In their code there were a substantial amount of comments in the area after column 72. The comments were not preceded with an asterisk in column 73. What they found was that this area was treated as code rather than as comment. They were wondering if there were any compiler directives/settings etc so that code in column 73 or greater could be treated as comment, regardless of whether they had an asterisk or not.


One thing to be aware of is that SOURCEFORMAT”FREE” is the default in Visual COBOL for Managed projects. For Native projects the default is still SOURCEFORMAT”FIXED, as it was for Net Express, Server Express a Studio EE. SOURCEFORMAT”FREE” means the IDE doesn’t adhere to the standard COBOL format of columns 0-7, 8-72 and 72 and beyond. To test, manually set the SOURCEFORMAT”FIXED” compiler directive in one of your programs: $SET SOURCEFORMAT”FIXED” (with $ in column 7 of the very first line in the source). Notice that as soon as this is entered (the program doesn’t have to be recompiled) the area beyond column 72 is automatically greyed out in the IDE. If you then rebuild the project or solution, anything beyond column 72 should be treated as a comment. If this works you can set this directive either at a project or global level.
Incident #2537986