View previous topic :: View next topic
|
Author |
Message |
ideas
New User
Joined: 25 May 2005 Posts: 52 Location: India
|
|
|
|
dear all,
if in a program, we make a query on select Count(*) to know the total # of rows in table..it gives an answer..my query is..how to move the value of this Count to a local variable in a program?
thanks! |
|
Back to top |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Hi,
If you want to do it in COBOL
Declare a variable in the Working Storage Section
01 W-MISC.
05 W-FETCH-CNTR PIC S9(07) COMP-3
then
EXEC SQL
SELECT COUNT(*)
INTO :W-FETCH-CNTR
FROM Tablename
WHERE Field = Host variable
END-EXEC
I think this answers your question
Corrcet me If I am Wrong
Thanks
Shri |
|
Back to top |
|
|
ideas
New User
Joined: 25 May 2005 Posts: 52 Location: India
|
|
|
|
Thanks!, I will try this. My query doesn't requires a where clause, thus it could be refined as:
EXEC SQL
SELECT COUNT(*)
INTO :W-FETCH-CNTR
FROM Tablename
END-EXEC |
|
Back to top |
|
|
|