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
 

 

Problem while fetching

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

Active User


Joined: 14 Mar 2005
Posts: 123

PostPosted: Sun Jan 08, 2006 11:59 am    Post subject: Problem while fetching
Reply with quote

Hi All,
I am facing a problem on FETCH.

The CUrsor based on a query which contains count(coulumn_name).

In Fetch :
Fetch cursor-name
into :ws-count

When i display ws-count it does n't show any value i.e spaces (i do n't emember exactly it is periods (...).

Note : While running query at QMF its show a value in the count value.But in my program the query is not giving the actual result in the cursor.
Can any body help me why i am not getting the acctual value.
Back to top
View user's profile Send private message

SHIVAREDDY

New User


Joined: 25 Jul 2005
Posts: 20

PostPosted: Mon Jan 09, 2006 4:45 pm    Post subject:
Reply with quote

Hi,

If you want the count, you can check the count in the following variables also after the SQL stament.

SQLERRD(1) |The number of rows in the result table of a cursor when the cursor position |is after the last row (when SQLCODE is equal to +100). This field is not set |for
FETCH [[NEXT | PRIOR | FIRST | LAST | ABSOLUTE n | RELATIVE n] FROM]
cursor_name
[INTO @variable_name1, @variable_name2, ...]
where
dynamic scrollable cursors.

|| |SQLERRD(2) |The number of rows in the result table of a cursor when the cursor position |is after the last row (when SQLCODE is equal to +100). This field is not set |for dynamic scrollable cursors.

|| |SQLERRD(3) |The number of rows in the result table of an INSERT when the SELECT |statement of the cursor contains the INSERT statement.

SQLERRD5 contains an indication that the last row in the table was fetched. It can be used to detect the end-of-data condition in the table being fetched .

Fetch Count for Cursors (BUT I COULDN'T DO USING THIS OPTION)
Normally, the select @@rowcount command returns the number of
rows actually returned to the client as a result of the most recent
request. However, on DB2, when a cursor is open and results are
fetched, select @@rowcount returns the number of rows in the fetch
count for that cursor. This may differ from the number of rows
actually returned, depending upon how the cursor is used.


The sqlerrd's give values in hex i suppose.
please let me know if you could get the count using the above.

CHEERS icon_biggrin.gif
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Jan 09, 2006 8:16 pm    Post subject: Re: Problem while fetching
Reply with quote

Can you please give us the CURSOR definition and the definition of WS-COUNT.

Also. When you do the display of WS-COUNT please give an example of what you expect the count to be, and the HEX value of the corresponding display '....'.

Thanks, We'll see if we can get to the bottom of this.
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 Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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