View previous topic :: View next topic
|
Author |
Message |
joney_biswas
New User
Joined: 14 Dec 2005 Posts: 3
|
|
|
|
Hi Friends,
I have written a COBOL program containing embedded DB2 SQL. The SQL is given below,
EXEC SQL
SELECT COUNT(*) INTO :WS-COUNT FROM VM_DATA
END-EXEC.
Now while i am trying to execute the program it is showing error because of the record format of the variable of WS-COUNT. I have tried with the following options,
01 WS-COUNT pic x(18)
- If I use this one then it will show error during the run time saying that record format is not same.
01 WS-COUNT pic 9(18) COMP
- If I use this one then it will show error during the compile time saying that undefinied type for WS-COUNT
01 WS-COUNT pic 9(18) COMP-3
-If I use this one then it will show error during the compile time saying that undefinied type for WS-COUNT
So I need your help to solve this problem. Can anybody please tell me what should be the format for the variable WS-COUNT?
I am waiting for your replies.
Thanks,
Joney Biswas |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Define WS_COUNT as PIC S9(11) comp-3. |
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
hi
use the following code
EXEC SQL
SELECT DIGITS(COUNT(*)) INTO :WS-COUNT FROM VM_DATA
END-EXEC.
and you can define ws-count as numeric... |
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
hi joney
ignore my previous mail. for the sql to rin you cab define the host variable as PIC S9(09) COMP. Think this should also work. If not then you can use my previous reply |
|
Back to top |
|
|
joney_biswas
New User
Joined: 14 Dec 2005 Posts: 3
|
|
|
|
i defined the ws-count as like this
01 ws-count pic s9(11) comp-3.
and it worked fine. thanks for all of your supports.
Thanks,
Joney Biswas |
|
Back to top |
|
|
|