ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Using the debugger with /copy and SQL

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

  • Using the debugger with /copy and SQL

    I have a copy member that contains some SQL code. I retrieve this into an RPGLE program using /COPY. When I try to debug the program, RDI debugger only shows the /COPY statement and not the SQL code, so I can't step through the SQL code. I believe there is something that has to be specified on the compile of the SQL program but I am not sure what (I cold be wrong about this).

    Any suggestions?

  • #2
    Hi.

    Have you tried with parameter *LIST in parameter DBGVIEW?

    Comment


    • #3
      Originally posted by inigo.redin View Post
      Hi.

      Have you tried with parameter *LIST in parameter DBGVIEW?
      There is no *LIST option for SQLRPGLE compiles, only *SOURCE and *NONE and I am using *SOURCE. It brings in the SQL statements in the main program just not the ones in the /COPY member. CRTBNDRPG has a *LIST option (and several others) for DBGVIEW but CRTSQLRPGI only has the ones I mentioned.

      Comment


      • #4
        Originally posted by gregwga50 View Post

        There is no *LIST option for SQLRPGLE compiles, only *SOURCE and *NONE and I am using *SOURCE. It brings in the SQL statements in the main program just not the ones in the /COPY member. CRTBNDRPG has a *LIST option (and several others) for DBGVIEW but CRTSQLRPGI only has the ones I mentioned.
        Sorry, you're right.

        I'll wait for an useful answer too.

        Comment


        • #5
          Compiling SQLRPGLE source with DBGVIEW(*SOURCE) is actually ALL the debug options combined. Hit F15=Select View in STRDBG or DSPMODSRC. Maybe you want the COPY VIEW, if RDI can use that.

          _ SQL Root Source View
          _ SQL Output View
          _ ILE RPG Listing View
          _ ILE RPG Copy View

          Compiling SQLRPGLE with DBGVIEW(*NONE) just gives this view:

          _ ILE RPG Listing View

          Ringer

          Comment


          • #6
            Originally posted by gregwga50 View Post
            There is no *LIST option for SQLRPGLE compiles, only *SOURCE and *NONE and I am using *SOURCE.
            Not quite true. Though I haven't needed to use it for debugging, you can pass parameters to the RPG compiler through the pre-compiler:
            Code:
            CRTSQLRPGI   OBJ( ... )
            .
            .
                         DBGVIEW(*NONE)
                         COMPILEOPT('dbgview(*all)')
            Rather than *LIST, that example does *ALL. Possibly a wasted effort unless the intermediate *SOURCE is saved, or maybe not. Try it to test.
            Tom

            There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

            Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

            Comment


            • #7
              Originally posted by tomliotta View Post

              Not quite true. Though I haven't needed to use it for debugging, you can pass parameters to the RPG compiler through the pre-compiler:
              Code:
              CRTSQLRPGI OBJ( ... )
              .
              .
              DBGVIEW(*NONE)
              COMPILEOPT('dbgview(*all)')
              Rather than *LIST, that example does *ALL. Possibly a wasted effort unless the intermediate *SOURCE is saved, or maybe not. Try it to test.
              For the final RPGLE source member that actually gets compiled, using CRTSQLRPGI COMPILEOPT('dbgview(*all)') has the same effect as using CRTSQLRPGI DBGVIEW(*SOURCE). Both cause the RPGLE source to be compiled with DBGVIEW(*ALL). The only difference is that with the COMPILEOPT version, you _can't_ debug from the original SQLRPGLE source. With the DBGVIEW(*SOURCE) version, you have the choice of debugging from either the SQL source or the listing view.

              The Copy View isn't relevant for copy files with SQL statements. The SQL precompiler merges the copy files into the RPGLE source, so even though the compiler creates the copy view, there are no /COPY statements in the final RPGLE compile.

              The SQL Output View shows the RPGLE source that is the final compile step. That view is available whether or not the temporary source from QTEMP is there. But I don't think RDI supports this view, so the listing view is probably the best one to see all the source, except that the SQL statements will have been turned into comments plus the RPG code to call the SQL program that handles the SQL statements.

              Comment


              • tomliotta
                tomliotta commented
                Editing a comment
                Thanks, Barbara. That's the first time I've seen a clear description. The help text isn't as informative as your comment.

            • #8
              I am curious as to why I am getting this compile error The following code was from another member that is pulled in to the base member.

              HTML Code:
                 503+    dcl-proc GetPhxCust;                                                       
                 504+     dcl-pi GetPhxCust Packed(7);                                              
                 505+      p_AsiCust Packed(6) Value;                                               
                 506+      p_Locn Char(2) Value;                                                    
                 507+     end-pi;                                                                   
                 508+                                                                               
                 509+    dcl-s PxCust Packed(7);                                                    
              ------------- 4 data records excluded ------------------------------------------------
                 511+     Exec Sql                                                                  
              ======>          aaa                                                                  
              *RNF5347 30 a      000134+ An assignment operator is expected with the EVAL operation.
                 512+     Select XR_PHX_CUS_NO into :PxCust from ASICUSXREF                         
                 513+       where XR_ASI_CUS_NO = :p_AsiCust and Location = :p_Locn;                
                 514+     Return Pxcust;                                                            
                 515+     End-proc;                                                                 
              ------------ 28 data records excluded ------------------------------------------------
                        A d d i t i o n a l   D i a g n o s t i c   M e s s a g e s                 
               Msg id  Sv Number Seq     Message text                                               
              *RNF7030 30    511 000134+ The name or indicator EXEC is not defined.                 
              *RNF7066 00     28 002800  Record-Format FMT1 not used for input or output.           
              *RNF7066 00     29 002900  Record-Format FMT2 not used for input or output.           
              *RNF7030 30    511 000134+ The name or indicator SQL is not defined.
              If I remove the /COPY and copy the code directly into the base source member, it compiles fine.

              HTML Code:
                  502     dcl-proc GetPhxCust;                                                                       
                  503      dcl-pi GetPhxCust Packed(7);                                                              
                  504       p_AsiCust Packed(6) Value;                                                               
                  505       p_Locn Char(2) Value;                                                                    
                  506      end-pi;                                                                                   
                  507                                                                                                
                  508     dcl-s PxCust Packed(7);                                                                    
               ------------ 13 data records excluded ----------------------------------------------------------------
                  519   //*   Exec Sql                                                                               
                  520   //*   Select XR_PHX_CUS_NO into :PxCust from ASICUSXREF                                      
                  521   //*     where XR_ASI_CUS_NO = :p_AsiCust and Location = :p_Locn;                             
               ------------- 9 data records excluded ----------------------------------------------------------------
                  531      Return Pxcust;                                                                            
                  532      End-proc;                                                                                 
               ------------ 45 data records excluded ----------------------------------------------------------------
                         A d d i t i o n a l   D i a g n o s t i c   M e s s a g e s                                 
                Msg id  Sv Number Seq     Message text                                                               
               *RNF7066 00     28 002800  Record-Format FMT1 not used for input or output.                           
               *RNF7066 00     29 002900  Record-Format FMT2 not used for input or output.                           
               *RNF7086 00     28 002800  RPG handles blocking for file ASIACTOPND. INFDS is updated                 
                                          only when blocks of data are transferred.                                  
                * * * * *   E N D   O F   A D D I T I O N A L   D I A G N O S T I C   M E S S A G E S   * * * * *    
              I notice in the 2nd example, the compiler makes comments out of the SQL statements. Both the base source member and copy member are defined as SQLRPGLE

              Comment


              • #9
                You need RPGPPOPT(*LVL1) or RPGPPOPT(*LVL2) when you compile with CRTSQLRPGI.

                Comment

                Working...
                X