ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

GET DIAGNOSTICS and DB2_NUMBER_ROWS

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

  • GET DIAGNOSTICS and DB2_NUMBER_ROWS

    I've used this before and it worked. I'm trying to use it now and it won't return the right number of rows. I ran the query through FROG and got 2 rows which is what I expected...

    Code:
    Exec SQL Declare C1 Insensitive Cursor for  
      select field1, field2
               from myfile                                
               where order = :OrderNumber and                  
                     line = :OrderLine;                       
                                                               
               Exec SQL                                        
                 Open C1;                                      
                                                               
               Exec SQL                                        
                 GET DIAGNOSTICS :mycount = DB2_NUMBER_ROWS;
    The Get Diagnostics returns 0 to mycount. All the sql states and codes are 0, so no errors reported.

    I'm puzzled.
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

  • #2
    Re: GET DIAGNOSTICS and DB2_NUMBER_ROWS

    Did the OrderNumber and OrderLine host variables have the correct values?

    Comment


    • #3
      Re: GET DIAGNOSTICS and DB2_NUMBER_ROWS

      Yep, they were correct.
      Your future President
      Bryce

      ---------------------------------------------
      http://www.bravobryce.com

      Comment


      • #4
        Re: GET DIAGNOSTICS and DB2_NUMBER_ROWS

        Never mind, this last time I ran through debug it started to magically work.
        Your future President
        Bryce

        ---------------------------------------------
        http://www.bravobryce.com

        Comment


        • #5
          Re: GET DIAGNOSTICS and DB2_NUMBER_ROWS

          Originally posted by bryce4president View Post
          Never mind, this last time I ran through debug it started to magically work.
          funny how that happens eh? i've had this type of thing happen several times over the past few years, the program stops working correctly, i run it in debug and the problem goes away. there's some small bug in the runtime environment (IMO) that program objects get corrupted, but something in the debugger sucks it out of the hole. i know of at least 5 times in the last 2 years this has happened. (OS versions v5r2, v5r4 not sure about v5r3 we skipped that one but i'm sure it's there as well) the biggest thing is that it's so "rare" i can't nail it down. if i do i can promise there'll be a call in to Ol' Blue...
          I'm not anti-social, I just don't like people -Tommy Holden

          Comment


          • #6
            Re: GET DIAGNOSTICS and DB2_NUMBER_ROWS

            Originally posted by bryce4president View Post
            Never mind, this last time I ran through debug it started to magically work.
            Did you by any chance signoff or destroy the activation group between tries?
            Regards

            Kit
            http://www.ecofitonline.com
            DeskfIT - ChangefIT - XrefIT
            ___________________________________
            There are only 3 kinds of people -
            Those that can count and those that can't.

            Comment


            • #7
              Re: GET DIAGNOSTICS and DB2_NUMBER_ROWS

              Is your Stored Procedure "Deterministic"?
              "Time passes, but sometimes it beats the <crap> out of you as it goes."

              Comment

              Working...
              X