fhg
Volume 6, Number 32 -- August 30, 2006

Undocumented Debugger Function

Published: August 30, 2006

Hey, Ted:

Here's a tip for those readers who, like me, still have to use the full-screen, green-screen debugger. I accidentally discovered that RPG supports a debugging option that is not documented in either the help text or the RPG programmer's guide.

If you want to break a program or procedure when a variable has a certain value, you can use a conditional breakpoint. In the following example, the program breaks at statement 12 if variable STATE has the value TX.

break 12 when state = 'TX'

Suppose you want to stop when part of a field contains a certain value? The debugger provides a substring function that can accomplish that task. Here's the command to break if the fourth and fifth characters of ITEMNUMBER are G3.

break 12 when %substr(ItemNumber 4 2) = 'G3'

You can also use the substring function to look at part of a variable.

eval %substr(ItemNumber 4 2)

This is especially handy when you only want to see part of a long string. Also, you can change part of a character string.

eval %substr(itemnumber 7 3) = 'ABC'

It was an accident that I discovered that RPG supports substrings. The CL examples of conditional break points in the help text mention the %SUBSTR function, but the RPG examples do not, so I assumed that RPG did not support substringing. Then one day I forgot that %SUBSTR was only supported for CL and used it for RPG without thinking what I was doing.

I wonder what other undocumented features the debugger might have.

--Dominic Lefevre



Sponsored By
T.L. ASHFORD

BARCODE400 by T.L. Ashford is the easiest, fastest way to create and print Compliance Labels directly from the AS/400 and iSeries.

Ashford's comprehensive library of Compliance formats is available to Barcode400 users. AIAG labels for Ford and Motorcraft, GM, and many more are available.

BARCODE400 is backed by the best Technical Support Team in the industry.

FREE Guide to Bar Code Labeling
www.tlashford.com
or call 800.541.4893



Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

Lakeview Technology:  A new standard for ease of use in iSeries High Availability
Computer Keyes:  Rapidly convert *SCS printer files into black and white or full color PDF documents
COMMON:  Join us at the Fall 2006 conference, September 17-21, in Miami Beach, Florida

 


 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement