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.
LATEST COMMENTS
MC Press Online