Copyright 1992-2016 by Kevin G. Barkes All rights reserved. This article may be duplicated or redistributed provided no alterations of any kind are made to this file. This edition of DCL Dialogue is sponsored by Networking Dynamics, developers and marketers of productivity software for OpenVMS systems. Contact our website www.networkingdynamics.com to download free demos of our software and see how you will save time, money and raise productivity! Be sure to mention DCL Dialogue! DCL DIALOGUE Originally published May, 1992 A DCL Debugger By Kevin G. Barkes DCL enthusiasts have had an embarassment of riches as of late. First came Channel Island Software's DCL to Fortran Precompiler last fall. Now there's DCL/DBG, an interactive DCL debugger. DCL/DBG is a useful tool for advanced DCL command procedure developers. It allows you to simultaneously edit and debug .COM files or to debug a procedure while you write it. This isn't a complete review of the software; I received it right at deadline and didn't have the opportunity to engage in a rigorous test procedure. Based on a couple hours of stuffing spaghetti-code DCL through it, I'm nonetheless favorably impressed. DCL/DBG isn't for the person whose DCL coding consists of adding a couple lines to LOGIN.COM every month or so. A fairly thorough understanding of DCL concepts is required to use DCL/DBG effectively. Or to read the accompanying documentation, for that matter. While comprehensive, the DCL/DBG manual is tersely written, technically dense and not for the faint-hearted. SMOKE AND MIRRORS Persons familiar with the TPU-based EVE editor will feel right at home with DCL/DBG, mainly because the software is written in TPU and layered on EVE. DCL/DBG works by grabbing lines from the DCL procedure being debugged and passing them, one line at a time, to a VMS subprocess for execution. DCL/DBG handles most of the complications created by this subprocess command redirection by emulating branching and program flow commands such as GOTO, GOSUB, etc., $STATUS handling and procedure depth. On invocation, DCL/DBG displays an EVE-like split screen display. The top portion, the Debug Input Window, shows the procedured being debugged. The Debug Output Window, which occupies the bottom half of the screen, displays the results of the subprocess command execution. Additional information, such as debugging mode, depth level, $STATUS and current executing image, are displayed in a status line at the bottom of the screen. DCL/DBG has "step" and "go" modes, permits the setting of breakpoints, and provides easy methods of changing symbol values. You can change the value of $STATUS returns; "unwind" CALL, @, or GOSUB as well as IF-THEN-ELSE branches; revert to the last GOTO command; change buffers; and enable or disable error handling, to name but a few features. Extensive online help is available. And since DCL/DBG is EVE-based, the user can modify or extend its operation. WORKAROUNDS Because of the EVE/subprocess implementation method, there are limitations to DCL/DBG. INQUIRE and READ SYS$COMMAND cannot be correctly executed, nor can lexical functions which are process context sensitive. For example, F$ENVIRONMENT("PROCEDURE") returns of the name of the subprocess input mailbox rather than the command procedure being debugged. There are workarounds to these limitations, many of which are automatically flagged by the software. Those planning to use DCL/DBG extensively can modify their coding habits to avoid most of these situations. Some may argue that DCL's interpretive nature precludes the need for a debugger. But for those hardy souls who write tactical nuclear DCL on very fast VAXen, DCL/DBG can be a real sanity saver. DCL/DBG is distributed in the U.S. by Computer Metrics, Inc. (214) 783-8558 and in Canada by Compu-Design Group, Inc. (416) 890-7970 (east) or (403) 233-0903 (west). ********************** NOTES FROM THE FIELD Rich McGaughey of Rail Bearing Service, Inc. sent in a little utility he uses as a process identification aid at his site. ID.COM (see Program) is one way to circumvent VMS' method of identifying a user who logs in multiple times. The procedure changes the rather non-informative terminal based identifier to the user's name and an appended number. I made a few minor changes to Rich's procedure for publication. The reader is free to embellish the code with other flourishes, such as using F$ENVIRONMENT to check the actual SET MESSAGE values and control-c trapping. There's a solid foundation there on which to build. I'm always on the lookout for good reader-submitted code. Your procedure should be short (space is at a premium), useful, and contain no site-specific references. Look at the last few installments of this column to avoid submitting something that's already been done. No set default utilities, please. Send your submissions to me at the address at the end of this column. *********************** Kevin G. Barkes is an independent consultant who is also experienced with auto insurance underwriting. Needless to say, he has a son who just turned 16. Kevin lurks on comp.os.vms and can be reached at kgbarkes@gmail.com. ************************** PROGRAM $! ID.COM $! Get the current process' user name: $ USER_NAME = F$EDIT(F$GETJPI("","USERNAME"),"COLLAPSE") $! Get the current process' process name: $ PRC_NAME = F$GETJPI("","PRCNAM") $! If username and process name match, then quit: $ IF USER_NAME .EQS. PRC_NAME THEN EXIT $! Disable default error handling: $ SET NOON $! Initialize counter: $ COUNT = 0 $! Turn off error messages: $ SET MESSAGE/NOF/NOI/NOS/NOT $ SET_PROCESS_NAME: $! Increment counter: $ COUNT = COUNT + 1 $! Limit the number of tries: $ IF COUNT .GT. 6 THEN GOTO NAME_OK $! Try to set the process name: $ SET PROCESS/NAME="''USER_NAME'-''COUNT'" $! Try again if it fails: $ IF .NOT. $STATUS THEN GOTO SET_PROCESS_NAME $! Otherwise turn on error messages and exit $ NAME_OK: $ SET MESSAGE/F/I/S/T $ EXIT *********************************** Addresses and stuff: Computer Metrics, Inc. Suite 507 2007 North Collins Richardson, TX 75080 Comu-Design Group, Inc. #36, 145 Traders Blvd. East Mississauga, Ontario L4Z 2E5 Channel Islands Software P.O. Box 30492 Santa Barbara, CA 93130