SQL Code 00000050J NEED HELP



IBM's flagship relational database management system

SQL Code 00000050J NEED HELP

Postby swathi.nelaturu » Wed Apr 14, 2010 12:27 pm

hI FRIENDS,
I am Swathi.
I am the begginer in DB2.
I got a doubt.
After select query i am getting the sql code 00000050J
I am not understanding the meaning for that.

My code is

 ID DIVISION.                       
 PROGRAM-ID. PG1.                   
 ENVIRONMENT DIVISION.               
 INPUT-OUTPUT SECTION.               
 DATA DIVISION.                     
 WORKING-STORAGE SECTION.           
     EXEC SQL                       
        INCLUDE SQLCA               
     END-EXEC.                       
     EXEC SQL                       
        INCLUDE USR                 
     END-EXEC.                       
     EXEC SQL                       
        DECLARE QD CURSOR WITH HOLD 
        FOR                         
        SELECT PWD FROM USR7         
        WHERE UID = :HV-UID
        FOR UPDATE OF PWD               
     END-EXEC.                         
 PROCEDURE DIVISION.                   
     MOVE 'SWATHI' TO HV-UID.           
     EXEC SQL                           
      OPEN QD                           
     END-EXEC.                         
     EXEC SQL                           
      FETCH QD INTO :HV-PWD             
     END-EXEC.                         
     EVALUATE SQLCODE                   
       WHEN 0                           
         MOVE 'RADHIKA' TO HV-PWD       
         EXEC SQL                       
           UPDATE USR7 SET PWD = :HV-PWD
           WHERE CURRENT OF QD         
         END-EXEC                       
      WHEN OTHER       
        DISPLAY SQLCODE
    END-EVALUATE.       
    EXEC SQL           
      CLOSE QD         
    END-EXEC.           
    STOP RUN.         


Can any one plzz help meee...........

Thanks in Advance,
Swathi.
swathi.nelaturu
 
Posts: 1
Joined: Wed Apr 14, 2010 12:17 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SQL Code 00000050J NEED HELP

Postby uday123 » Wed Apr 14, 2010 6:16 pm

Hi Swathi,

Welcome to the forum..
Please confirm if this is SQL code of 501 or SQL CODE 50J.

If its sql code 501 , then you are trying to fetch the rows when the cursor is closed.
Cursor needs to be opened , before the rows are fetched.


Hope this helps ..

Regards
Uday
uday123
 
Posts: 29
Joined: Fri Feb 06, 2009 6:13 am
Has thanked: 0 time
Been thanked: 0 time

Re: SQL Code 00000050J NEED HELP

Postby dick scherrer » Wed Apr 14, 2010 11:32 pm

Hello,

50J is a -501. . .
Hope this helps,
d.sch.

These users thanked the author dick scherrer for the post:
tivrfoa (Sat Nov 17, 2018 11:06 pm)
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: SQL Code 00000050J NEED HELP

Postby dick scherrer » Wed Apr 14, 2010 11:37 pm

Hello and welcome to the forum,

Suggest you practice with the "Code" tag (which will preserve alignment and improve readability) - your pgm has been "Code'd"..

If you only learn one thing this week, you need to look at the sql return code after EVERY EXEC SQL statement. I suspect the cursor open failed. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post