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
 

 

Host variable for Count(*)

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

New User


Joined: 05 Feb 2008
Posts: 5
Location: chennai

PostPosted: Tue Nov 25, 2008 1:30 am    Post subject: Host variable for Count(*)
Reply with quote

Hi,
I am declaring a cursor for the foll. query SELECT COUNT(*),DEPTNO from DEPT GROUP BY DEPTNO.
While fetching i don't have a dclgen variable for this COUNT(*) and hence i used a local variable TEMP-COUNT
But when doing like this i am getting an error "UNDEFINED OR UNUSABLE HOST VARIABLE "TEMP-COUNT".
Is there any way to rectify this or do i need to alter my DCLGEN

Thanks
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Nov 25, 2008 1:41 am    Post subject:
Reply with quote

You need to look in the DB2 Maual and find out what COUNT(*) will return and define a host variable to receive that.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Nov 25, 2008 3:15 am    Post subject:
Reply with quote

Hi,

You may try this:

Code:
.
.
.
WS-REC-COUNT  PIC  S9(09) COMP VALUE +0..
.
.
 SELECT COUNT(*) INTO             
         :WS-REC-COUNT       
 FROM Table
WHERE ..
Back to top
View user's profile Send private message
dsivtina

New User


Joined: 05 Feb 2008
Posts: 5
Location: chennai

PostPosted: Tue Nov 25, 2008 7:06 pm    Post subject: Reply to: Host variable for Count(*)
Reply with quote

Thanks for ur quick response. One thing i need to get clarified. Should i use only comp variable for COUNT(*),if so what is the minimum length can i have??
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Nov 26, 2008 2:05 am    Post subject: Re: Reply to: Host variable for Count(*)
Reply with quote

dsivtina wrote:
Thanks for ur quick response. One thing i need to get clarified. Should i use only comp variable for COUNT(*),if so what is the minimum length can i have??
I think you overlooked this
Quote:
You need to look in the DB2 Maual and find out what COUNT(*) will return and define a host variable to receive that.
from Craig.
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 CICS Transaction attach count of supp... lind sh CICS 1 Wed Jun 21, 2017 1:33 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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