Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SQLCODE -303 while running Easytrieve program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: SQLCODE -303 while running Easytrieve program
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

Site Director


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

PostPosted: Wed Jul 28, 2010 9:44 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Jul 28, 2010 7:18 pm    Post subject: Reply to: SQLCODE -303 while running Easytrieve program
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Running an REXX EXEC implicitly sho7hills CLIST & REXX 3 Thu Apr 20, 2017 8:14 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts Determine Region with max bandwidth f... seahawk789 COBOL Programming 3 Mon Feb 27, 2017 8:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us