MMCC's PL/B notes v1.10 |
509 Center Bay City, Michigan Sales (989) 892-9242             Support (989) 686-8860 MMCC Programming Standards
|
MMCC DIAGNOSTIC MODE
Sunbelt provides an excellent debugging tool in their system. But it was not always there. MMCC developed their own debugging methodology long ago and continues to use it. We call it DIAGNOSTICC MODE.
In the DOS days all programs were written to trap the SHIFT-F8 key. When sensed, the program would set a common variable called PRIVDIAG to "Y". With PRIVDIAG turned on, the program would display, or print, information about many intermediate steps during proccessing.
When we moved to the Windows GUI environment, the PRIVDIAG came along and grew much more powerful and useful.
In the GUI runtime, Sunbelt provides a "main window" on which the DISPLAY instruction presents its data. This window is visible only when the WINSHOW instruction is executed. It is turned off with the WINHIDE instruction.The main window runs separately from the GUI windows where the user is interacting. You can write DISPLAY instructions throughout your program and they will show up on the main window even as the user is interacting with the GUI screen.
All MMCC menus have a check box on the lower left side of the screen for "Diagnstics". When the user checks that box a WINSHOW is executed. When unchecked, the WINHIDE is executed. The user sees the "blue screen" pop on and off as the box is checked.
Besides doing the WINSHOW/WINHIDE, the program also sets the old PRIVDIAG variable in common. This is passed to all other programs through common. (For loadmods, PRIVDIAG must be passes as a parameter).
Most sub-menus also provide the diagnostic check box.
Some programs offer a "local diag" option. When the program executes it picks up the common PRIVDIAG setting. But the user can then control diags within that one program.
Diagnostic mode offers a very powerful tool. Because the main window is displayed in real-time but in the background from the GUI form, you can run the GUI side and watch what's going on in the main window. The DISPLAY instruction is very powerful and can display lots of information, formatted in the most advantageous manner to illustrate just what's going on as a program executes.
As a general rule, you can embed DISPLAY statements throughout the mainline without worrying about whether DIAG's are set or not. If the main window is not shown, the displays have no effect. By turning on the diags, the DISPLAY's are there and running.
For "processing" programs, those that run jobs rather than just responding to a screen, we've found that it is better to not do the DISPLAYs unless diags are turned on. Even if they don't show with the main window hidden, having them there seems to slightly slow the run. In these programs we'll wrap the DISPLAY statements in an IF (PRIVDIAG = YES) statement.
Back to Standards Index
© 2001 mmcc All Rights Reserved.
Report problems or suggestions to support@mmcctech.com