• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Undocumented Debugger Function

    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

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Midrange Dynamics North America

    Git up to speed with MDChange!

    Git can be lightning-fast when dealing with just a few hundred items in a repository. But when dealing with tens of thousands of items, transaction wait times can take minutes.

    MDChange offers an elegant solution that enables you to work efficiently any size Git repository while making your Git experience seamless and highly responsive.

    Learn more.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    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

    Federal Trade Commission to Weigh In on Net Neutrality Bang for the Buck: Enterprise i5 Servers Versus the Competition

    Leave a Reply Cancel reply

Volume 6, Number 32 -- August 30, 2006
THIS ISSUE SPONSORED BY:

T.L. Ashford
Asymex
COMMON

Table of Contents

  • Undocumented Debugger Function
  • EDTF and End-of-Line Delimiters, Take Two
  • Admin Alert: Four iSeries Access Tips for Windows Professionals

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Public Preview For Watson Code Assistant for i Available Soon
  • COMMON Youth Movement Continues at POWERUp 2025
  • IBM Preserves Memory Investments Across Power10 And Power11
  • Eradani Uses AI For New EDI And API Service
  • Picking Apart IBM’s $150 Billion In US Manufacturing And R&D
  • FAX/400 And CICS For i Are Dead. What Will IBM Kill Next?
  • Fresche Overhauls X-Analysis With Web UI, AI Smarts
  • Is It Time To Add The Rust Programming Language To IBM i?
  • Is IBM Going To Raise Prices On Power10 Expert Care?
  • IBM i PTF Guide, Volume 27, Number 20

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle