|
I want to use SQL in an RPG400 program. And I want to be able to use
STRDBG OPMSRC(*YES) to debug the SQLRPG program same as I debug an RPG
program. Problem is, STRDBG works on the compiled SQLRPG program only from
the job that compiled the program. Using STRDBG OPMSRC(*YES) from another
job returns the message "OPM source cannot be accessed".
How to enable the debugger to always be able to access the OPM source?
Here are the commands used to compile the SQLRPG code. Since there is no
debug option on CRTSQLRPG, the trick is to run CRTSQLRPG with *NOGEN. This
creates the RPG source code for the SQLRPG program in QTEMP/QSQLTEMP. Then
CRTRPGPGM from the code in qtemp/qsqltemp with option(*SRCDBG). After
running those two commands I run STRDBG OPMSRC(*YES) and the source
debugger opens up. But only from the job that ran CRTSQLRPG and CRTRPGPGM.
PGM
dcl&srcmbr *char 10
dcl&srcfName *char 10
dcl&srcfLib *char 10
dcl&pgmlib *char 10
chgvar&srcmbr 'BOLSCNR2'
chgvar&srcfname 'QRPGSRC'
chgvar&srcfLib 'SRINV'
chgvar&pgmlib 'SRINV'
/* first, compile with *nogen to get the crtrpgpgm command to */
/* create the sql -> rpg code in qtemp/qsqltemp. */
CRTSQLRPG PGM(&SRCMBR) SRCFILE(&SRCFLIB/&SRCFNAME) +
SRCMBR(&SRCMBR) COMMIT(*NONE) OPTION(*NOGEN)
/* compile the source in qtemp/qsqltemp with *srcdbg option. */
CRTRPGPGM PGM(&pgmLIB/&srcmbr) +
SRCFILE(QTEMP/QSQLTEMP) SRCMBR(&srcmbr) +
OPTION(*SOURCE *SRCDBG)
endpgm
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.