Debug functionality in MAGIC NPR
The NPR Procedure Z.ddc comes in very handy for debugging both NPR reports and Customer-Defined Screen Attributes. The 'ddc' stands for Dynamic Debugging Code.
The debugger is launched in the following manner:
The first argument, string, is simply whatever free-text you would like to appear on the screen when the debugger runs.
The second argument, device, is optional. If you enter a device, then the debugger will only launch when run on that device.
The third argument, user, is also optional. If you enter a user, then the debugger will only launch when run for that user. This comes in very handy as many users have habit of leaving the debug code in their software even after fixing a problem. Specifying a user for the debug makes sure that the rest of the users at your facility are not adversely affected.
The following are the commands available at the debug prompt.
- > Returns the number of bytes used by the all of the symbol tables, as well as the number of bytes available.
- ` or `` Copies the contents of the / prefix to your Windows clipboard.
- . Brings up the Node(s) prompt for viewing contents of prefixes.
- .. Brings up the Node(s) prompt for viewing contents of prefixes, but first beings up a Print On prompt.
- < Displays screen as it appeared immediately before the debugger program ran.
- ? Returns a list of all symbols in the current symbol table.
- ?? Returns a list of all symbols in all symbol tables.
- symbol Typing the name of any symbol from the current symbol table returns the value of that symbol.
- CHX(symbol) Returns a list of each character of the symbol along with its ASCII codes.
- symbol|piece Returns the queued piece of a packed-piece of data. If symbol is a queued-string of values, this will return the piece of data
- signified by non-negative integer piece.
- ;code Semi-colon can be followed by any valid MAGIC code and it will be executed.
- ;; Repeats the last code entered in by the ;code command.
You can simply press <Enter> at the debug prompt to allow your report/attribute to move on to the next line of code.