Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Error code -303 - cursor fetch

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging
View previous topic :: :: View next topic  
Author Message
sm_2009

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Mon May 11, 2009 11:47 am    Post subject: Error code -303 - cursor fetch
Reply with quote

hi

i am getting an error code of -303 while fetching record from a table using cursor.

cursor declaration -

EXEC SQL DECLARE MEMCUR CURSOR FOR
SELECT POLICY_NBR,
SUBSC_NBR,
SUBSC_SSN,
SUBSC_NAME,
SUBSC_TYPE,
ID_CARD_IND
FROM MEMBER
END-EXEC

fetch using cursor -

EXEC SQL FETCH MEMCUR
INTO :DCLMEM-POLICY-NBR,
:DCLMEM-SUBSC-NBR,
:DCLMEM-SUBSC-SSN,
:DCLMEM-SUBSC-NAME,
:DCLMEM-SUBSC-TYPE,
:DCLMEM-ID-CARD-IND
END-EXEC

please help me to debug this.

thanks
Back to top
View user's profile Send private message

sm_2009

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Mon May 11, 2009 11:55 am    Post subject: Reply to: Error code -303 - cursor fetch
Reply with quote

the reason for this error code i found as - A VALUE CANNOT BE ASSIGNED TO OUTPUT HOST VARIABLE NUMBER position-number BECAUSE THE DATA TYPES ARE NOT COMPARABLE


but here i am not using any comparison.

then why this error is coming. please help.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon May 11, 2009 11:57 am    Post subject:
Reply with quote

What did the -303 say when you looked it up?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon May 11, 2009 12:00 pm    Post subject:
Reply with quote

I posted before seeing your post. -303 is saying that one or more of your host variables is not the same data type as the column that's being fetched into it. Show us your DCLGEN for the columns and the definition of your host variables. Can any of the columns be NULL?
Back to top
View user's profile Send private message
sm_2009

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Mon May 11, 2009 12:10 pm    Post subject: Reply to: Error code -303 - cursor fetch
Reply with quote

Member Table:

POLICY_NBR INTEGER NOT NULL,
SUBSC_NBR INTEGER NOT NULL,
SUBSC_SSN INTEGER NOT NULL,
SUBSC_NAME CHAR(15) NOT NULL,
SUBSC_TYPE CHAR(10) NOT NULL,
SUBSC_ADDR CHAR(40) NOT NULL,
ANNUAL_PREMIUM DECIMAL(5, 2) NOT NULL,
ID_CARD_IND CHAR(1) NOT NULL

and DCLMEM -

DCLMEM-POLICY-NBR PIC S9(9) USAGE COMP.
DCLMEM-SUBSC-NBR PIC S9(9) USAGE COMP.
DCLMEM-SUBSC-SSN PIC S9(9) USAGE COMP.
DCLMEM-SUBSC-NAME PIC X(15).
DCLMEM-SUBSC-TYPE PIC X(10).
DCLMEM-SUBSC-ADDR PIC X(40).
DCLMEM-ANNUAL-PREMIUM PIC S9(3)V9(2) USAGE COMP-3.
DCLMEM-ID-CARD-IND PIC X(1).


I think the cols i am using in FETCH have the same declaration

pls guide
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon May 11, 2009 12:13 pm    Post subject:
Reply with quote

It looks correct to me, but I would prefer to see the DCLGEN via a cut and paste instead your keying the info and please use BBCode when pasting (see FAQ). Also, paste the actual portion of your sysout that shows the -303 SQLCODE.
Back to top
View user's profile Send private message
sm_2009

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Mon May 11, 2009 12:22 pm    Post subject: Reply to: Error code -303 - cursor fetch
Reply with quote

hi Terry

sorry . I am not able to use BBCode, may be after some days i will be able to use those. i checked FAQ also.

please find the sysout -

Code:
********************************* TOP OF DATA **********************************
IN A1000 PARA                                                                   
IN A2000 PARA                                                                   
IN A3000 PARA                                                                   
ERROR IN Y1000 PARA                                                             
    -303                                                                       
IN A4000 PARA                                                                   
                               SQLCODE =     -303                               
CEE3204S The system detected a protection exception (System Completion Code=0C4)
         From compile unit G0665PG3 at entry point G0665PG3 at compile unit offs
          at address 0AD2EE86.                                                 
******************************** BOTTOM OF DATA ********************************
DCLGEN -


******************************************************************
* DCLGEN TABLE(MEMBER)                                           *
*        LIBRARY(OPERN.CICS3.DCLGEN(MEMDCL))                     *
*        ACTION(REPLACE)                                         *
*        LANGUAGE(COBOL)                                         *
*        NAMES(DCLMEM-)                                          *
*        QUOTE                                                   *
*        LABEL(YES)                                              *
*        COLSUFFIX(YES)                                          *
* ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS   *
******************************************************************
     EXEC SQL DECLARE MEMBER TABLE                               
     ( POLICY_NBR                     INTEGER NOT NULL,           
       SUBSC_NBR                      INTEGER NOT NULL,           
       SUBSC_SSN                      INTEGER NOT NULL,           
       SUBSC_NAME                     CHAR(15) NOT NULL,         
       SUBSC_TYPE                     CHAR(10) NOT NULL,         
       SUBSC_ADDR                     CHAR(40) NOT NULL,         
       ANNUAL_PREMIUM                 DECIMAL(5, 2) NOT NULL,     
       ID_CARD_IND                    CHAR(1) NOT NULL           
     ) END-EXEC.                                                 
******************************************************************
* COBOL DECLARATION FOR TABLE MEMBER                             *
******************************************************************
 01  DCLMEMBER.                                                   
*    *************************************************************
*                       POLICY_NBR                               
     10 DCLMEM-POLICY-NBR    PIC S9(9) USAGE COMP.               
*    *************************************************************
*                       SUBSC_NBR                                 
     10 DCLMEM-SUBSC-NBR     PIC S9(9) USAGE COMP.               
*    *************************************************************
*                       SUBSC_SSN                                 
     10 DCLMEM-SUBSC-SSN     PIC S9(9) USAGE COMP.               
*    *************************************************************
*                       SUBSC_NAME                               
     10 DCLMEM-SUBSC-NAME    PIC X(15).                           
*    *************************************************************
*                       SUBSC_TYPE                               
     10 DCLMEM-SUBSC-TYPE    PIC X(10).                           
*    *************************************************************
*                       SUBSC_ADDR                               
     10 DCLMEM-SUBSC-ADDR    PIC X(40).                           
*    *************************************************************
*                       ANNUAL_PREMIUM                           
     10 DCLMEM-ANNUAL-PREMIUM  PIC S9(3)V9(2) USAGE COMP-3.       
*    *************************************************************
*                       ID_CARD_IND                               
     10 DCLMEM-ID-CARD-IND   PIC X(1).                           
******************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 8       *
******************************************************************
********************** Bottom of Data ****************************
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Mon May 11, 2009 12:23 pm    Post subject: Reply to: Error code -303 - cursor fetch
Reply with quote

Sm,
Try to select only one column at first if it is successful then add the second column.then third..etc.. so that you can debug them very easily.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon May 11, 2009 5:29 pm    Post subject:
Reply with quote

Sm,

get into the habit of CALLing DSNTIAR when you receive an unwanted Sqlcode.

then,
Quote:
A VALUE CANNOT BE ASSIGNED TO OUTPUT HOST VARIABLE NUMBER position-number BECAUSE THE DATA TYPES ARE NOT COMPARABLE

position-number will have the cardinal number of your Host-variable in error.
then you will know which Host variable you need to change.

and since I trust DB2 more than I trust you, suggest you cut&paste your
CURSOR DECLARATION and FETCH Sql.
you probably miss-spelled something.

by the way, COMPARABLE in the error message means: not the same, or incorrect data-type.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Speed-up/reduce CPU use of code prino PL/I & Assembler 0 Tue Sep 26, 2017 12:05 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us