ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SQLRPG Debugging

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQLRPG Debugging

    I am trying to debug my connect program (to another site) and I am having trouble getting into the debug source. This is just a test program for the connect there more to it but I am starting to test with the connect part.
    I compile the SQLRPG program with *xref in the precompiler
    and I STRDBG with update prod data = yes
    But I do not get the source at the time I call the PRogram
    What I am missing?
    BTW this is my second time creating a sqlrpg program
    Help!

    Program
    C/EXEC SQL CONNECT TO MTP USER :USERID USING :PASSWD
    C*
    C/END-EXEC
    C*
    C*
    C/EXEC SQL
    C+ DECLARE mppo CURSOR FOR
    C+ SELECT pdupmj, pddoco, pdlitm
    C+ FROM F4311
    C+ FROM F4311
    C+ WHERE pdan8 = 11015 AND PDNXTR < '900'
    C+ AND pduopn > 0
    C+ GROUP BY pdupmj, pddoco, pdlitm
    C+ ORDER BY pdupmj
    C/END-EXEC
    C*
    C*
    C *INLR CABEQ'1' EOJ
    C*
    C*
    C SQLCOD IFNE *ZEROS
    C SETON LR
    c*
    C ENDIF
    C*
    C *INLR CABEQ'1' EOJ
    C*
    C*
    C EOJ TAG
    C* ------ ---
    C/EXEC SQL DISCONNECT MTPDS01
    C*
    C/END-EXEC
    C********************************

    If you see this web site it will give you the process to compile


    Debugging RPG/400 (OPM and ILE) with Embedded SQL Statements
    Technote

    This document describes the procedure for debugging RPG/400 and ILE RPG programs containing embedded SQL statements. The command CRTSQLRPG and its ILE counterpart CRTSQLRPGI offer no parameters to generate optional debugging views. To produce a debugger-viewable version of the source code, do the following:

    OPM RPG/400 Procedure:

    CRTSQLRPG PGM(member_name) OPTION(*NOGEN)

    This expands the embedded SQL statements into RPG specifications and creates a member of type RPG in QTEMP/QSQLTEMP. The new member will have the same name as the original SQLRPG member.

    CRTRPGPGM PGM(QTEMP/member_name) SRCFILE(QTEMP/QSQLTEMP) OPTION(*LSTDBG)
    or
    CRTRPGPGM PGM(QTEMP/member_name) SRCFILE(QTEMP/QSQLTEMP) OPTION(*SRCDBG)

    This creates a debugger-viewable RPG program object, which can be debugged using STRDBG .

    ILE RPG/400 Procedure:

    CRTSQLRPGI PGM(member_name) OPTION(*NOGEN)

    This expands the embedded SQL statements into RPG specifications and creates a member of type RPGLE in QTEMP/QSQLTEMP1. The new member will have the same name as the original SQLRPGLE member.

    CRTBNDRPG PGM(QTEMP/member_name) SRCFILE(QTEMP/QSQLTEMP1) DBGVIEW(*ALL)

    This creates a debugger-viewable ILE RPG program object, which can be debugged using STRDBG .

    Note: STRDBG has to be used for both OPM and ILE programs. ISDB (which only operates on OPM programs) will bring up the original (not the preprocessed) version of the source code from the SQLRPG member; this mismatch between the program object and the source code retrieved by the debugger may cause errors during the debugging session (notably MSGCPF1920 when trying to set breakpoints with the function key).
    Last edited by hvazquez; October 1, 2008, 02:48 PM. Reason: Problem solved

  • #2
    Re: SQLRPG Debugging

    1/ Compile the OPM source with embedded SQL in debug mode
    Code:
    CRTSQLRPG PGM(...)  OPTION(*NOSRC [B]*LSTDBG[/B])
    2/ Start debug and add breakpoints
    Code:
    STRDBG PGM(...) [B]OPMSRC(*YES)[/B]
    3/ Call the program
    Code:
    CALL PGM(...) ...
    Philippe

    Comment


    • #3
      Re: SQLRPG Debugging

      Mercury

      Thanks

      for the information it work to perfection - It gave the source and I was able to debug.

      hvazquez

      Comment

      Working...
      X