MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error (-510) - for Update of (cursor )

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Mon Aug 07, 2006 3:29 am    Post subject: Error (-510) - for Update of (cursor ) Reply with quote

I searched this forum and i found a simillar issue , but the problem with that issue is usage of multiple cursor , i am using a cursor to fetch from the table matching a specific criteria and updating the table where the cursor is currently pointing to.

There is a -510 sql code for the cursor program.

Code:

SELECT OM.ORDNUM,                         
       OM.ORDTYP,                         
       OM.PROCESSCOMPIND1,                 
       OM.PROCESSCOMPIND2,                 
       OC.ORDNUM,                         
       OC.MSGNUM                           
FROM  A0.OCORDHV OM,A0.OMSGV OC           
WHERE OM.ORDNUM = OC.ORDNUM               
AND   OC.MSGNUM = :WS-MSGNUM-VAL           
AND   OM.ORDTYP = :WS-ORDTYP-VAL           
AND   OM.PROCESSCOMPIND1 = :WS-COMPIND1-VAL
AND   OM.PROCESSCOMPIND2 = :WS-COMPIND2-VAL
FOR UPDATE OF PROCESSDTE7,PROCESSCOMPIND2 
END-EXEC.                                 


The Update statement is as follows

Code:

EXEC SQL                                   
  UPDATE A0.OCORDHV                       
    SET PROCESSCOMPIND2 = :WS-COMPIND1-VAL,
        PROCESSDTE7 = :WS-CREATEDTE-OM     
  WHERE CURRENT OF ABC_CURS               
END-EXEC                                   


Is that a problem with the View or the application logic.
Back to top
View user's profile Send private message
CZerfas
Intermediate


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Mon Aug 07, 2006 3:42 am    Post subject: Reply with quote

Hello Mainframemouli,

the cursor you have defined is a not-updateable-cursor, since it contains a join.

The criteria for beeing an updateable cursor is, that your cursor has to use only the base tables, i.e. there have to be no intermediate workfiles build by DB2. These workfiles are built for joins, index-ORing and sorts. Only a pretty limited number of cursors could therefor be used for positioned updating.

regards
Christian
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Aug 07, 2006 3:44 am    Post subject: Reply with quote

mainframemouli,

Can you make info and try to debug:

Programmer Response: The requested UPDATE or DELETE cannot be performed.

1.For a remote table, modify the DECLARE CURSOR andthen rebind the PLAN.
2.For a cursor that uses parallelism, disable parallelism for the query by using the DEGREE(1) BIND option for
static SQL or by setting the CURRENT DEGREE special register to '1' for dynamic SQL.
3.For an ambiguous cursor in an application bound CURRENTDATA(NO), either make the cursor unambiguous (declare it FOR UPDATE OF), or rebind the application CURRENTDATA(YES).
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Mon Aug 07, 2006 4:45 am    Post subject: Reply with quote

Thanks CZerfas.

Shekar,
What CZerfas told is true that a we cannot update a intermedaite table. Only base tables can be updated.

Do you think even then the solutions you suggested can work fine?please suggest me if its possible still.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group