Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 160
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: 1281
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: 160
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: 160
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: 160
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: 6970
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 query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us