Created On:  22 November 2011

Problem:

A client found an issue during the migration of an application into Visual COBOL managed code that uses character based screen displays in the SCREEN SECTION. In previous versions of Micro Focus COBOL (eg Net Express) if they had a single DISPLAY statement that was required to straddle 2 lines of code in the COBOL source, they were able to use the continuation character (-) in column 7 of the 2nd line to string both lines to be displayed as one.

For example, note the following code, which has a continuation character in column 7 in the 2nd line of the text to be displayed:



      *
       SCREEN SECTION.
      01  SCR-DISPLAY.
     05  LINE 23 BLANK LINE.
     05  LINE 23 “We need to string this line with the next line a
      -                         “nd display it all as 1 line.”.
      *
 
This should display on line 23 as:
 
        We need to string this line with the next line and display it all as 1 line.
 
But, when they put this code into a Visual COBOL managed project it displayed as:
 
        We need to string this line with the next line a
                                                                                                                                nd display it all as 1 line.

So the white space between the end of the last character on the first line and the first character on the second line of the DISPLAY statement is displayed as spaces. The continuation character is ignored. Yet this same code in an unmanaged project displayed as it had in Net Express.

Resolution:

By default SOURCEFORMAT”FREE” is set for Visual COBOL managed projects.  You can change this by setting

        $SET SOURCEFORMAT”FIXED”

This can be set in the source code (if so, this MUST be the first line of the code and the dollar sign must be in column 7) or it can be set as a project directive or in an appropriate directives file (eg cobol.dir).

However, if you want to use SOURCEFORMAT”FREE” but still display the line of code as one line, then you will have to combine the code to be displayed on 1 line. With SOURCEFORMAT”FREE” set you are not constrained to the code finishing in column 72 as you are with FIXED SOURCEFORMAT.

This is not an issue specific to Visual COBOL – if SOURCEFORMAT”FREE” is set in Net Express the result of the DISPLAY statement is the same.