CURSOR issue in AS/400

30 pts.
Tags:
AS/400
SQL Cursors
SQLRPGLE
STRSQL
Hi Friends please someone help me on the below issue.
I have a SQL query which I ran in STRSQL. Initially it's showing 17 records in first page and pressed Page down to go to 2nd page then it's showing second set of 17 records. And then If I press page up to go to 1st page again I could see that the first record in the first page is getting duplicated. And I have checked the file, there are no duplicate records in it. I am not able to understand why it's not showing any duplicate records initially, but it's showing duplicate records when I do a page down and page up.
And the actual problem is, we are using the same query as a CURSOR to display the records in a Single page subfile. Initially I thought it's a PAGEUP, PAGEDOWN issue with the Subfile, but I have debugged the program so many times and could see that the cursor itself fetching the duplicate data and displaying the same in subfile.
Note: We are using a Join logical file in the cursor. And we are facing this issue in first time access only. If you run the Query once in STRSQL and came back and you run it again we are not able to replicate the Scenario.
I haven't seen this type of behavior of a Query before. And no one in my team faced this type of issue before. And some one saying that it’s some SQL package issue.
Please someone suggest on this issue.

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    What does you SQL command look like?
    92,960 pointsBadges:
    report
  • SatishKumar007
    Hi 

    SELECT * FROM F1 WHERE F1.OTYPGI = 'I' and SUBSTR(F1.GRTPGI, 1, 1) <> 'Y'
    ORDER BY F1.LNAMGI, F1.FNAMGI                    

    This is the query which we use... Where F1 is a Join logical file.
    30 pointsBadges:
    report
  • deepu9321
    Query seems to be simple and shouldn't be problem with Cursor.

    Problem can be either with Subfile Program or Join Logical file. 

    Post your Subfile Loading logic to see if its fine.
    4,955 pointsBadges:
    report
  • ToddN2000
    The SQL looks good. We would need to see your sub file build code to see if there is a problem. I would check the initialization process and see how it handles the RRN. Post the code if it's not to large.
    92,960 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: