1

Instead of using STRDBG to look at the source, is there an API to retrieve the complete source code from a program compiled with DBGVIEW(*ALL)?
Should I use the debug APIs, or does something simpler exists?

LppEdd
  • 20,274
  • 11
  • 84
  • 139

2 Answers2

1

It seems the only way is to use the exported debug C APIs, as described in this document.

Those C APIs are also exposed through an RPG service program under QSYS/QTEDBGS. This makes it possible to invoke them via JTOpen for example (see ServiceProgramCall).

enter image description here

LppEdd
  • 20,274
  • 11
  • 84
  • 139
1

Easier is a matter of opinion...

One time thing? Perhaps copy & paste from one of the existing graphical debuggers (RDi or System)

Need to extract source from multiple objects, then yeah the debugger API's are the way to go.

But how comfortable are you with working in C? Or at minimum, translating C prototypes to usable RPGLE ones? IBM does provide an RPGLE include file, QSYSINC/QRPGLESRC(QTEDBGS) but it's a machine translation of the C header and not particularly optimized for an RPG developer to use.

The easy way would to break out the checkbook and buy an existing tool do this. I assume some are still around.

Charles
  • 21,637
  • 1
  • 20
  • 44
  • I need this for a tool I'm writing using JTOpen. So a pre-made solution isn't possible. I'm comfortable with all the required languages, but C APIs cannot be called directly from JTOpen so even the unoptimized QTEDBGS is ok. – LppEdd May 03 '21 at 14:39
  • You don't understand how the system works. The API's are in the QTEDBGS *SRVPGM. Regardless of what language is calling them, there's only one set of APIs. There are 2 copies of the `include` files. One for use in C and another for RPGLE. – Charles May 03 '21 at 14:45
  • I know it's the same APIs, but as I wrote it seems it's possible to use the QTEDBGS *SRVPGM with JTOpen's ServiceProgramCall. So I should be fine – LppEdd May 03 '21 at 14:55