WINDOWing syntax

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.
  • 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.
    
    
  • 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

     

     

  • 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.

     

     

  • 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?

  • 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

     

     

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

  • 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.

     

  • 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

     

  • 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.
  • 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.