Page 1 of 1

SQLCODE +354 at the time of multifetch

PostPosted: Tue Sep 15, 2009 9:36 pm
by DNair7
:( :( :( :( :( :( :( :(

Hi,
I am using multi fetch functionality for my DB2 program. below is my sorty card and fetch statement.

EXEC SQL                                                     
   DECLARE CRD-ACCT-CUR CURSOR WITH HOLD                     
                               WITH ROWSET POSITIONING FOR   
      SELECT CA_NO,                                         
             CORP_IND_CD,                                   
             CA_LAST_STMT_DT,                               
             CA_OPENING_BAL_AM,                             
             CA_CANC_CD,                                     
             CA_CANC_DT                                     
      FROM V07_CHARGE_ACCOUNT                               
      WHERE   CA_CANC_CD NOT IN ('0','1','A')               
        AND   SUBSTR(CA_BILL_POINT_CD,1,1) = :WW-CYC-NO     
        AND   CA_BILL_CURR_CD = :WW-CURR-CD                 
        AND   CA_OPENING_BAL_AM < 0                         
        AND ((CA_CANC_DT > :V2327-BILL-DT                   
        AND   CA_CANC_DT <= CA_LAST_STMT_DT)                 
        OR   (CA_CANC_DT IS NULL))                           
END-EXEC.                                                   


EXEC SQL                                             
    FETCH NEXT ROWSET FROM CRD-ACCT-CUR FOR 10 ROWS 
    INTO :WT-CA-NO,                                 
         :WT-CORP-IND-CD,                           
         :WT-CA-LAST-STMT-DT,                       
         :WT-CA-OPENING-BAL-AM,                     
         :WT-CANCELLATION-CODE,                     
         :WT-CANCELLATION-DATE                       
END-EXEC.                                           

EVALUATE SQLCODE                                         
      WHEN ZERO                                           
           MOVE ZERO               TO WW-COUNTER         
           MOVE SQLERRD(3)         TO WW-ROWS-FETCHED     
           PERFORM CA-PROCESS-BASIC-ACCOUNT UNTIL         
                           WW-COUNTER >= WW-ROWS-FETCHED 
      WHEN WC-HUNDRED                                     
           SET EOF-CURSOR          TO TRUE               
           MOVE ZERO               TO WW-COUNTER         
           MOVE SQLERRD(3)         TO WW-ROWS-FETCHED     
           PERFORM CA-PROCESS-BASIC-ACCOUNT UNTIL         
                           WW-COUNTER >= WW-ROWS-FETCHED 
      WHEN OTHER                                         
           MOVE 'C-PROCESS'        TO WP-DB2-SECTION-NAME
           MOVE 'V07_CHARGE_ACCOUNT'                     
                                   TO WP-DB2-TABLE-NAME   
           MOVE SPACES             TO WP-DB2-KEY-DATA     
           MOVE WM-ERR-MESS-06     TO WM-ABEND-MSG-TEXT   
           PERFORM ZB-DB2-ABEND                           
END-EVALUATE.                                             


As i am abending the program if i encounter any sqlcode other than '0' ,'100'. Below is the message i am getting

+354 A ROWSET FETCH STATEMENT MAY HAVE RETURNED ONE OR MORE ROWS OF
DATA. HOWEVER, ONE OR MORE WARNING CONDITIONS WERE ALSO
ENCOUNTERED. USE THE GET DIAGNOSTICS STATEMENT FOR MORE INFORMATION
REGARDING THE CONDITIONS THAT WERE ENCOUNTERED


Can you please help me on this...?

Re: SQLCODE +354 at the time of multifetch

PostPosted: Wed Sep 16, 2009 12:13 am
by dick scherrer
Hello,

First - please use the "Code" tag for readability. . .

Second - did you use "get diagnostics" to see the information? If not, do so :)

Re: SQLCODE +354 at the time of multifetch

PostPosted: Wed Sep 16, 2009 9:48 pm
by DNair7
Hi Dick,

thank a lot for your response, the problem is solved. I didnt use a Null indicator for the Cancellation Date that i am fetching from the database (as it can be null).
Thanks again,
Deepak Nair

Re: SQLCODE +354 at the time of multifetch

PostPosted: Fri Sep 18, 2009 11:59 pm
by dick scherrer
You're welcome - good to hear it is working - thanks for posting the resolution :)

d