TechTalk: Super Debugging!

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

When using interactive debug on an RPG program, sometimes it's convenient to place a breakpoint somewhere besides on an executable C-spec. For instance, with program-described files you can place a breakpoint on either an Input or Output spec for a given file and make the program break, regardless of what portion of the program caused the input/output to occur.

If the breakpoint is placed on a given field, the program is suspended before the field is moved into/out of the I/O buffer. What's more, the I/O buffer itself can be examined by using the reserved name ZZnnBIN or ZZnnBOUT, where nn is the relative order of the file in the program's F-specs, such as 01.

Instead of even naming a statement number, you can set a breakpoint for a given place in the RPG cycle by using one of the RPG routine names: *INIT, *DETL, *GETIN, *TOTC, *TOTL, *OVF, *DETC, or *TERM. You can also give the label of a TAG or BEGSR by name rather than statement number. For RPG op- codes that call functions to perform the operation, you can specify the name of the function; e.g., SQRT, to interrupt the program whenever the specified operation is about to be executed.

All this is fine and great, but one of my favorite tricks--new with V1R3--is the ability to set conditional breakpoints which let you specify that the breakpoint is only to occur if a variable meets a certain condition and/or the statement has been executed a given number of times.

For example, if you wanted to stop a program whenever a given CHAIN failed and 01 was used as the No Record found indicator, you could issue ADDBKP...COND(*IN01 *EQ '1') and specify the statement number following the CHAIN. Or, consider adding a breakpoint with the SKIP(nn) parameter; this variation lets you suppress the breakpoint until the statement has been executed nn times.

Also new with V1R3 is the ability to remotely start debug on a job that is already executing, whether interactive or batch. Simply execute command Start Service Job (STRSRVJOB) for the job in question, then proceed as usual. You can even run debug on a S/36E MRT program by giving the job name as the MRT procedure rather than a requester's name.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: