ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SQLRPGLE with /COPY - Debug problem

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

  • SQLRPGLE with /COPY - Debug problem

    Guys,
    I have an SQLRPGLE program with sub procedures and /COPY members in it. When I try to debug the program the line numbers that get executed doesn't match with what is shown in the debug session. Is there a keyword/compiler option that I need to set when compiling so that I can properly step thru the code in debug ?
    Thanks in advance.

  • #2
    Re: SQLRPGLE with /COPY - Debug problem

    I don't have the idea about the keyword to be used here.

    But the sequence numbers in the Debug session will match the sequence numbers of the spool file, created by compiler. You can check by verifiying the spool file.

    Comment


    • #3
      Re: SQLRPGLE with /COPY - Debug problem

      I always use: Option(*SRCSTMT:*NODEBUGIO:*XREF) but I have very few /COPY members.

      Comment


      • #4
        Re: SQLRPGLE with /COPY - Debug problem

        Try
        H Option( *SrcStmt : *NoDebugIO: *NoShowCpy )
        Philippe

        Comment


        • #5
          Re: SQLRPGLE with /COPY - Debug problem

          I will try that. In our shop we have a lot of /Copy members and we should convert them to service Programs.

          Comment


          • #6
            Re: SQLRPGLE with /COPY - Debug problem

            I have written a number of SQLRPGLE's with copy members as well. Try the above recommendations for sure, because they will help. If after that, your numbers don't match up, then your library list is goofed up. Every time I run into this situation the object that is being debugged no longer matches the source in the source file. So either you are pointed at the wrong object, or the source chages have not been compiled.

            Comment


            • #7
              Re: SQLRPGLE with /COPY - Debug problem

              I don't know if you solved this issue, but I would suggest you try F15 function while in debug. Then select RPG source listing. It may display the info needed.
              "What must be done, must be well done."
              My father...

              Comment


              • #8
                Re: SQLRPGLE with /COPY - Debug problem

                I'm not sure if I'm doing this right. I have a LOT of code that is embedded with sql. I'm trying to use the debug but it doesn't seem to be working right. In my code I fetch my data with sql and loop with rpg yet when I debug all the variables appear to be blank. Is there something special that needs to be done since I use embedded sql to retrieve the data?
                Stand up for what you beleive in ...... even if you are standing alone

                Comment


                • #9
                  Re: SQLRPGLE with /COPY - Debug problem

                  we are gonna need to see your code unless you send us all plane tickets and let us sleep over at your place!

                  jamie
                  All my answers were extracted from the "Big Dummy's Guide to the As400"
                  and I take no responsibility for any of them.

                  www.code400.com

                  Comment


                  • #10
                    Re: SQLRPGLE with /COPY - Debug problem

                    Sorry you wouldn't want to come here anyway it's raining and we are expectin g snow for the weekend. Here's a snippet of code.
                    Code:
                    PHP Code:
                    /exec sql
                    + declare master cursor
                    + for select namedatetime
                    from file1
                    where name 'smith'
                    /end-exec

                    /exec sql
                    open master
                    /end-sql

                    /exec sql
                    fetch next
                    from master
                    +i nto :dsaname, :dsadate, :dsatime
                    /end-exec
                                                   dow    sqlstt 
                    <> '02000'
                                                   
                    eval     aname dsaname
                                                   
                    eval    adate dsadate
                                                   
                    eval    atime dsatime
                                                   except  detail
                    /exec sql
                    fetch next
                    from master
                    into :dsaname, :dsadate, :dsatime
                    /end-exec
                                                  enddo
                    /exec sql
                    close master
                    /end-exec
                                                
                    eval   *inlr = *on 
                    Stand up for what you beleive in ...... even if you are standing alone

                    Comment


                    • #11
                      Re: SQLRPGLE with /COPY - Debug problem

                      Emily,

                      Did you make sure your host variables are declared exactly the same format as the resultset from the SQL cursor?
                      IF you compile with DEBUGVIEW(*SOURCE) and then do a STRDBG PGM(PGM_NAME) UPDPROD(*YES) OPMSRC(*YES), you will then be able to hit F15 and choose ILE RPG Listing. Then you will see the SQL precompiler's instructions after each embedded SQL statement.
                      As an example, here' a snippet of how it looks like:

                      Code:
                      /exec sql
                      + fetch next
                      + from master
                      + into :dsaname, :dsadate, :dsatime
                      /end-exec
                      
                      C                   Z-ADD     -4            SQLER6   
                      C                   CALL      SQLROUTE               
                      C                   PARM                    SQLCA    
                      C                   PARM                    SQL_00000
                      C                   PARM                    SQL_00001
                      C                   PARM                    SQL_00002
                      C     SQL_00033     IFEQ      '1'                     
                      C                   EVAL      DSANAME = SQL_00000
                      C                   EVAL      DSADATE = SQL_00001
                      C                   EVAL      DSATIME = SQL_00002
                      IF SQL_00000 contains no data or if SQL_00033 does not equal '1' then your SQL statement did not work and you should try it out in STRSQL.
                      You could also find some answers in your joblog while in debug and stopped after this statement. Some messages are sent to joblog while the execution of SQL statements but are removed after the program has ended either normally or abnormally.
                      Last edited by cybel; April 14, 2008, 06:23 AM.
                      "What must be done, must be well done."
                      My father...

                      Comment


                      • #12
                        Re: SQLRPGLE with /COPY - Debug problem

                        Hi,

                        Use *XREF and try to debug.. and give *source..
                        'Coding = Experience'
                        hsp

                        Comment


                        • #13
                          Re: SQLRPGLE with /COPY - Debug problem

                          Thanks cybel that worked beautifully!!!! I didn't have the updprod *yes and the f15 to the ile rpg listing. This is great since I do almost all my coding with embedded sql and my drawback is I've never been able to use a debugger with much success so I was going to give it one more shot. Sorry hsp didn't mean to leave you out I did have the *xref and the *source thanks!
                          Stand up for what you beleive in ...... even if you are standing alone

                          Comment


                          • #14
                            Re: SQLRPGLE with /COPY - Debug problem

                            Hi Emily,

                            Then increase my rep power..

                            Thanks,
                            Harish
                            'Coding = Experience'
                            hsp

                            Comment


                            • #15
                              Re: SQLRPGLE with /COPY - Debug problem

                              i will increase it just cause you have the KaHOnas to ask
                              All my answers were extracted from the "Big Dummy's Guide to the As400"
                              and I take no responsibility for any of them.

                              www.code400.com

                              Comment

                              Working...
                              X