IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem while fetching


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Problem moving a cobol program into E... COBOL Programming 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
Search our Forums:


Back to Top