Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
PaoloR Honored Contributor.
Honored Contributor.
831 views

WINDOWing syntax

Jump to solution

Using Visual Studio 2017 and Visual COBOL 4.

I'm experimenting with the windowing syntax based on AcuCOBOL-GT which is supposedly supported in Visual COBOL. I placed the $SET preprocess"window1" directive as in the MF documentation and added a simple DISPLAY WINDOW statement to the Procedure Division..

Visual COBOL gives me an error 'COBCH0053 Directive PREPROCESS invalid or not allowed here'.

So how do I get to use windowing syntax?
Thanks.
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: WINDOWing syntax

Jump to solution

According to the documentation for the CLOSE WINDOW statement here; this is the expected behavior.

"The CLOSE WINDOW statement restores the contents of the terminal screen that was in the active window when the corresponding DISPLAY WINDOW statement executed. In other words, the window that was created by that DISPLAY WINDOW statement is removed from the screen and replaced by the contents of the screen which were under that popup window."

When you display a new window with the POP-UP phrase specified it basically saves the underlying screen so that when you close the new window it will be replaced by what was there previously. When window 1 is displayed its popup area will be the blank screen as it was the first one displayed so this is why when you remove window 1 they both disappear.

 

0 Likes
14 Replies
Micro Focus Expert
Micro Focus Expert

Re: WINDOWing syntax

Jump to solution

The ACU Windowing syntax is supported in Visual COBOL for native projects only.

If it is specified with other directives in the $SET statement it should be set as the last one. The following example works fine for me.

      $set preprocess"window1"
       working-storage section.
       78 note-height  value 16. 
       78 note-width  value 41.
       78 no-of-chars  value note-height * note-width.
       01 note-window  pic x(10).
       01 dummy    pic x.
       01 note-data value all "- wallpaper ".
          03 note-char pic x occurs no-of-chars.
       screen section.
       01 input-data highlight.
         03 line 4 column 6 value " Accept and Display positions ".
         03 line 5 column 6 value " are relative to the top left ".
         03 line 6 column 6 value " corner of the window. ".
         03    pic x using dummy.
       01 note-screen  pic x(no-of-chars)
               using note-data prompt " " reverse-video.
       procedure division.
      * Put a blank window on the screen with a border and title
           display window, line 2, column 38, lines note-height,
              size note-width, boxed, erase, reverse
      * Define a reference for this window so that it can be
      * removed and the previous display restored
           pop-up area is note-window
           bottom right title "Press Enter to remove window"
      * Fill the window with the contents of note-screen
           display note-screen
           display input-data
           accept input-data
           close window note-window.

0 Likes
PaoloR Honored Contributor.
Honored Contributor.

Re: WINDOWing syntax

Jump to solution

Chris

It's a native console application and I'm aware of the MFWNOTE.CBL and MFWCALC.CBL demo  programs. I am trying to simply extract the basic windowing syntax minus all of the extraneous function key/key handling etc in the demo programs so I had:

$SET preprocess"window1"
 identification division.
 program-id. wintest.

 environment division.
 configuration section.

 data division.
 working-storage section.
 01 nothing            pic x.
 01 win-save-area      pic x(10).

 procedure division.
     display window, line 2, column 38, lines 12,
             size 12, boxed, erase, reverse
             pop-up area is win-save-area
      accept nothing
      stop run.
 end program wintest.

Apart from not displaying anything within the window this code was lifted from MFWNOTE.CBL (as you will have noticed) so I don't understand why I get the error described.

I don't know if it helps but Intellisense has a ~ under the final 's' in preprocess,  which normally indicates some sort of error.

Thanks

Paul

 

 

0 Likes
PaoloR Honored Contributor.
Honored Contributor.

Re: WINDOWing syntax

Jump to solution

Very strange. I was under the impression that $SET directives had to start in column 7.

With the $SET directive starting in column 7  I get the error. If I place the $ in column 8 the program compiles without errors.

 

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: WINDOWing syntax

Jump to solution

Which Patch Update version of V4.0 do you have installed?

I am testing with Patch Update 7 and I can compile your program just fine whether the $SET begins in column 7 or 8.

Are you setting any other directives within your project properties or perhaps in a COBOL.DIR file sitting in your project folder?

0 Likes
PaoloR Honored Contributor.
Honored Contributor.

Re: WINDOWing syntax

Jump to solution

Chris

The patch update file I downloaded is titled vcvs2017_40_patch-update01_189260.exe which, if I remember correctly, was the latest one shown on the VC download website when I renewed my PE license.

Assuming this is now not the latest can you give me a link to download the latest patch which avoids the need to reregister my copy of VC?

Thanks

Paul

 

 

0 Likes
PaoloR Honored Contributor.
Honored Contributor.

Re: WINDOWing syntax

Jump to solution

Sorry Chris, forgot to answer your other question. No, I'm not setting any other directives.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: WINDOWing syntax

Jump to solution

I was not aware that you were using the Visual COBOL Personal Edition product. This free product unfortunately does not have any updates available to it. We normally refresh it once a year when a new major release becomes available at which point will will contain all of the fixes made to the previous version. We are scheduled to release V5.0 sometime in June or July.

 

0 Likes
PaoloR Honored Contributor.
Honored Contributor.

Re: WINDOWing syntax

Jump to solution

Chris

OK, understand that. But it would help when a change like $SET in column 7 or 8 was communicated - it's been col 7 for a very long time. Maybe it is communicated, but where?

Re  the windowing syntax:  if I create 2 windows - window 1 and window 2 where window 2 overlaps window 1 - how can I direct code/output to window 1 and bring window 1 to the fore?  The window-save-area is in effect a window handle but I can't see any way of doing this.  I created 2 windows as decribed and, as an experiment,  tried to close window 1 in code (leaving window 2 still showing)  but doing this closed both windows.

Thanks

Paul

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: WINDOWing syntax

Jump to solution

The following works for me:

      $SET preprocess"window1"
       identification division.
       program-id. wintest.
       data division.
       working-storage section.
       01 nothing            pic x.
       01 win-save-area      pic x(10).
       01 win-save-area-2    pic x(10).
       procedure division.
          display window, line 2, column 38, lines 12,
             size 12, boxed, erase, reverse
             pop-up area is win-save-area
          accept nothing line 3 column 5
          display window, line 5, column 40, lines 5,
             size 12, boxed, reverse
             pop-up area is win-save-area-2
          accept nothing line 3 column 5
          close window win-save-area-2
          accept nothing line 3 column 5
          close window win-save-area
          stop run.
       end program wintest.
0 Likes
PaoloR Honored Contributor.
Honored Contributor.

Re: WINDOWing syntax

Jump to solution

Chris

This is what I am trying to do (edited):

           display window line 4 col 25
                   lines win-height size win-width
                   boxed erase 
                   pop-up area is win-01-handle 
                   accept dummy at line 02 col 02  *> window 01

           display window line 6 col 27
                   lines win-height size win-width
                   boxed 
                   pop-up area is win-02-handle                        
                   accept dummy at line 02 col 02 *> in window 02
          
                   close window win-01-handle      *> close initial window
                   accept dummy at line 02 col 02  *>assume window-02 still there
*> but closes both windows close window win-02-handle *> and program ends display "All windows closed" at 0101 accept dummy stop run.

Instead of leaving window-02 still on screen, both windows close and the program ends.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: WINDOWing syntax

Jump to solution

According to the documentation for the CLOSE WINDOW statement here; this is the expected behavior.

"The CLOSE WINDOW statement restores the contents of the terminal screen that was in the active window when the corresponding DISPLAY WINDOW statement executed. In other words, the window that was created by that DISPLAY WINDOW statement is removed from the screen and replaced by the contents of the screen which were under that popup window."

When you display a new window with the POP-UP phrase specified it basically saves the underlying screen so that when you close the new window it will be replaced by what was there previously. When window 1 is displayed its popup area will be the blank screen as it was the first one displayed so this is why when you remove window 1 they both disappear.

 

0 Likes
PaoloR Honored Contributor.
Honored Contributor.

Re: WINDOWing syntax

Jump to solution

Thanks Chris. I read the docs but obviously misinterpreted/misunderstood them.  I was assuming something like Windows MDI functions.

So DISPLAY window01 ->window02 -> window03

then CLOSEwindow03-> window02-window01.

You mentioned earlier that there will be a new Version 5 of VC in June or July. Will this be for Visual Studio 2017 or for Visual Studio 2019 (Community Editions)?

Paul

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: WINDOWing syntax

Jump to solution

Yes, this is character based windowing functionality basically used to display popups that can then be removed.

V5.0 will have support for Visual Studio 2019. I believe that this will most likely be the version which is distributed for the Personal Edition product but I am not sure if the final decision has been made upon that yet.

 

0 Likes
PaoloR Honored Contributor.
Honored Contributor.

Re: WINDOWing syntax

Jump to solution

OK, Chris, thanks for the info.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.