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

SQLCODE -303 while running Easytrieve program


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
beck19

New User


Joined: 21 Apr 2009
Posts: 12
Location: philippines

PostPosted: Wed Jul 28, 2010 9:23 am
Reply with quote

Hello Mainframe Masters...
Could someone shed a light on me on this?? icon_question.gif

I'm getting this error when I run my EZT pgm :
Code:
SQL FETCH ERROR
SQLCODE :           303-


Here's a part of my code :

Code:
**********************************************************************
*    CUST PROF CURSOR DECLARATION                                     
**********************************************************************
      SQL DECLARE GET_CUST_INFO CURSOR FOR                           +
         SELECT *                                                    +
         FROM  CTS4.CIS_CUST_PROFILE                                 +
         WHERE CUST_NBR    = :IN-CUST-NBR                            +
         WITH UR                                                     +
         FOR FETCH ONLY                                               


Code:

    SQL FETCH GET_CUST_INFO                       +                     
        INTO  :WS-FETCH-REC                                             
    DISPLAY 'SQLCODE : ' SQLCODE 'ACCOUNT' IN-CUST-NBR                 
    IF SQLCODE EQ 0                                                     
        OUT-REC      = ' '                                             
        OUT-REC      = WS-FETCH-REC                                     
        PUT OUTFILE                                                     
    ELSE                                                               
        WS-TEMP-ACCTP = IN-CUST-NBR                                     
        WS-TEMP-ACCTN = WS-TEMP-ACCTP                                   
        DISPLAY 'SQL FETCH ERROR FOR ACCOUNT ' WS-TEMP-ACCTN           
*       STOP                                                           
    END-IF                                                             
  END-PROC                                                             


Here's how i defined the variables :
Code:
  FILE INFILE                                       
    IN-REC                 1  80 A                 
    IN-MADCODE             6  11 A                 
    IN-MAD-PFX-TXT         6   5 A                 
    IN-MAD-LOC-IND        11   1 A                 
    IN-MAD-LOC-TXT        11   3 A                 
    IN-MAD-SFX-TXT        14   3 A                 
    IN-CUST-NBR           24   4 B 0               
                                                   
  FILE OUTFILE                                     
    OUT-REC                1 300 A                 
                                                   
  WS-TEMP-ACCTP            W                9 P 0   
  WS-TEMP-ACCTN            W                9 N     
  WS-FETCH-REC             W              291 A     
    WS-CUST-NBR          WS-FETCH-REC       4 B 0   
    WS-PRFL-CODE-ID      WS-FETCH-REC  +9  15 A     
    WS-PRFL-CODE-TYP-CD  WS-FETCH-REC +24   5 A     
    WS-PRFL-TXT-NUM-IND  WS-FETCH-REC +29   1 A     
    WS-PRFL-VALUE-NUM    WS-FETCH-REC +30  15 N     
    WS-LST-UPDT-TRAN     WS-FETCH-REC +45  10 A     
    WS-LST-UPDT-UID      WS-FETCH-REC +55  10 A     
    WS-LST-UPDT-TMST     WS-FETCH-REC +65  26 A     
    WS-PRFL-VALUE-TXT    WS-FETCH-REC +91 200 A     


Thanks in advance for your help..[/code]
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jul 28, 2010 9:44 am
Reply with quote

Hello,

I believe you need to change the select * to a select followed by the host variables.

Suggest you experiment with only the first column or 2 until the error is resolved.

You did read about the -303 and learn this:
Quote:
-303 A VALUE CANNOT BE ASSIGNED TO OUTPUT HOST VARIABLE NUMBER
position-number BECAUSE THE DATA TYPES ARE NOT COMPARABLE
icon_neutral.gif
Back to top
View user's profile Send private message
beck19

New User


Joined: 21 Apr 2009
Posts: 12
Location: philippines

PostPosted: Wed Jul 28, 2010 9:55 am
Reply with quote

Thanks for the prompt reply.. Im fairly new to DB2 (was using IMS before). But yes, i've read about

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


I will try to experiment and will let you guys know. icon_biggrin.gif
Back to top
View user's profile Send private message
sambit_mech

New User


Joined: 14 Jul 2010
Posts: 13
Location: India

PostPosted: Wed Jul 28, 2010 11:05 am
Reply with quote

I hope that WS-FETCH-REC is a group variable. Hence you should omit ":" before WS-FETCH-REC. It will work.
Back to top
View user's profile Send private message
beck19

New User


Joined: 21 Apr 2009
Posts: 12
Location: philippines

PostPosted: Wed Jul 28, 2010 11:27 am
Reply with quote

Hi sambit_mech, yes. WS-FETCH-REC is a group variable.

Anyhow, my code is working now. Following Dick's suggestion, my FETCH statement now looks :

Code:
SQL FETCH GET_CUST_INFO                       +   
    INTO  :WS-PRFL-CODE-ID,                   +   
          :WS-PRFL-CODE-TYP-CD,               +   
          :WS-PRFL-TXT-NUM-IND,               +   
          :WS-PRFL-VALUE-NUM,                 +   
          :WS-LST-UPDT-TRAN,                  +   
          :WS-LST-UPDT-UID,                   +   
          :WS-LST-UPDT-TMST,                  +   
          :WS-PRFL-VALUE-TXT                     
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jul 28, 2010 7:18 pm
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top