IDENTIFICATION DIVISION. PROGRAM-ID. WINCENTER. WORKING-STORAGE SECTION. copy "iscobol.def". copy "isgui.def". copy "isresize.def". 01 screen-coordinates. 03 window-line pic s9(4). 03 window-col pic s9(4). 77 h-sta handle of window. 77 crt-status special-names crt status pic 9(5). 77 screen-idx pic 99. 77 num-monitors pic 99. 77 main-monitor pic 99. 77 win-lines pic 9(4) value 0. 77 win-size pic 9(4) value 0. 77 win-screen-line pic 9(4) value 10. 77 win-screen-col pic 9(4) value 10. 77 e-ef-monitor pic 9. SCREEN SECTION. 01 Mask. 03 label line 2 col 2 size 20 cells title "Switch to Screen#" . 03 ef-monitor entry-field line 2 col 18 size 8 cells enabled e-ef-monitor value screen-idx . 03 push-button line 4 col 2 size 25 cells title "C$CENTERWINDOW" exception-value 2 . 03 push-button line 6 col 2 size 25 cells title "Inquire window position" exception-value 3 . 03 frame line 9 lines 10 col 2 size 50 cells title "Window Position Info" . 03 label line 11 col 4 size 25 cells value "Numer of Monitors" . 03 label line 13 col 4 size 25 cells value "Screen Index is " . 03 label line 15 col 4 size 25 cells value "Screen Line is " . 03 label line 17 col 4 size 25 cells value "Screen column is " . 03 window-info. 05 label line 11 col 22 size 25 cells value num-monitors . 05 label line 13 col 22 size 25 cells value screen-idx . 05 label line 15 col 22 size 25 cells value window-line . 05 label line 17 col 22 size 25 cells value window-col . 03 Pb-exit push-button line 20 col 62 size 8 cells title "Exit" exception-value 27 . PROCEDURE DIVISION. MAIN. accept terminal-abilities from TERMINAL-INFO. perform get-monitor-num. display standard graphical window background-low resizable screen line win-screen-line screen col win-screen-col layout-manager lm-zoom title "Window Handling Test" screen-index main-monitor lines 21 size 70 handle h-sta system menu . display Mask perform until crt-status = 27 perform do-inquire accept mask on exception continue end-accept evaluate crt-status when 2 inquire ef-monitor value screen-idx if screen-idx = 0 or e-ef-monitor = 0 call "W$CENTER-WINDOW" using h-sta else call "W$CENTER-WINDOW" using h-sta screen-idx end-if display mask end-evaluate end-perform destroy Mask destroy h-sta goback . GET-MONITOR-NUM. call "C$MONITOR" using CMONITOR-GET-NO-MONITOR num-monitors main-monitor giving return-code. move main-monitor to screen-idx if num-monitors = 1 move 0 to e-ef-monitor else move 1 to e-ef-monitor end-if . DO-INQUIRE. inquire h-sta screen-index screen-idx inquire h-sta screen line window-line screen col window-col display window-info .