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
 

 

DB2 Row positining fetch giving error

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Fri Nov 20, 2009 12:41 pm    Post subject: DB2 Row positining fetch giving error
Reply with quote

Hi ,
im using the rowset positioning of a cursor to get the rows from my table butthe rows returned are 'NONE'
below is my fetch cursor
Code:
   01 ws-ar-data.
                   05 ws-ar-a1    pic x(02) occurs 15 times.
                   05 ws-ar-a2    pic x(02) occurs 15 times.

              DECLARE A1_CUR CURSOR WITH
               ROWSET POSITIONING FOR
                   SELECT
                              A1,A2
                   INTO :A1,:A2
                FROM  A1_TABLE
                WHERE
                     AX_1 = :AX-1
       
                     
               


im then openening my curor ande fetching it.
Code:
  EXEC SQL
                      OPEN A1_CUR
                    END-EXEC.
               
                   EXEC SQL
                      FETCH NEXT ROWSET FROM A1_CUR FOR 15 ROWS
                     INTO :WS-AR-A1
                             ,:WS-AR-A2
                    END-EXEC.
               
                  EXEC SQL
                     GET DIAGNOSTICS :WS-COUNT = ROW_COUNT
                  END-EXEC.

               
                       




it is returning me a sqlcode +100 while there are 15 rows in that table and also the WS-COUNT is holding zeroes in it.

Please help me ,where i have made any mistakes if any present in this code.
Back to top
View user's profile Send private message

sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri Nov 20, 2009 2:46 pm    Post subject:
Reply with quote

Hi Tecnokrat,

Put
Code:
DISPLAY SQLCODE.

After every EXEC SQL ... END-EXEC. statement and checkout the sqlcodes. Also check SQLERRD(3) infomation.

Let us know what happens ?


Sushanth
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Fri Nov 20, 2009 2:56 pm    Post subject:
Reply with quote

he knows what happens : sqlcode = +100 and row-count = 0

check out definition and content of :ax-1.
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Fri Nov 20, 2009 3:31 pm    Post subject:
Reply with quote

AX-1 is defined as pic s9(09).

and the where condition holds good as all the 15 rows are present in the table ...
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri Nov 20, 2009 3:55 pm    Post subject:
Reply with quote

Tecnokrat,
In my example mult-row fetch program, i have declared cursor in the following format.
Code:
EXEC SQL
   DECLARE A1_CUR CURSOR WITH ROWSET POSITIONING
   FOR
           SELECT A1,A2
                FROM  A1_TABLE
                WHERE AX_1 = :AX-1

END-EXEC.


Check it out.


Sushanth
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Fri Nov 20, 2009 4:35 pm    Post subject:
Reply with quote

i have also given the same thing but i dint metioned here in the example in myt post
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri Nov 20, 2009 4:40 pm    Post subject:
Reply with quote

Tecnokrat,

Check your package QUALIFIER, whether its pointing to the right database.

Sushanth
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Tue Nov 24, 2009 12:14 pm    Post subject:
Reply with quote

Put a display and make sure AX-1 has desired value before opening the cursor.
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Tue Nov 24, 2009 12:34 pm    Post subject:
Reply with quote

resolved my problem as one of the key field was not included in the WHERE clause.
icon_sad.gif sorry for the trouble.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Nov 24, 2009 5:27 pm    Post subject:
Reply with quote

tecnokrat,

thanks for getting back; and kudos for one of the few honest solutions.
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 OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm


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