IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Error code -303 - cursor fetch


IBM Mainframe Forums -> ABENDS & Debugging
Post new topic   Reply to topic
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
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
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
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
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
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
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
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
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: 6966
Location: porcelain throne

PostPosted: Mon May 11, 2009 5:29 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> ABENDS & Debugging

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top