View previous topic :: View next topic
|
Author |
Message |
santosh100678
New User
Joined: 21 Sep 2009 Posts: 55 Location: Kolkatta
|
|
|
|
working storage section
01 ws-count pic 9(01) value 0.
01 ws-co pic X(2).
01 ws-vend pic X(4).
Procedure divison.
SELECT COUNT(*) INTO :WS-COUNT
WHERE CO_CD = :WS-CO from table
AND VEND_NBR = :WS-VEND
this query is in procedure division WS-COUNT,WS-CO ,WS-VEND
are host veriable but during compilation some time copiler throw error message unusable veriable some time it shows sucessful . |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Please use copy/paste to show your SQL (instead of manually keying it), and show all relevant initializing statements for your host variables and the host variable definitions themselves, and the EXACT message you are receiving. Again, do not key the above info. Use copy/paste. And use BBCode (see FAQ). |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Suggest that you check the SQL manual for your version of DB2, PIC 9(01) would not be the proper format for the results of count(*)! |
|
Back to top |
|
|
ajeshrn
New User
Joined: 25 Mar 2009 Posts: 78 Location: India
|
|
|
|
Hi santosh100678,
Please check your query. The syntax is wrong. U have put the where condition before the From.I guess the below query is what you are trying to get.
Code: |
SELECT COUNT(*) INTO :WS-COUNT
from table
WHERE CO_CD = :WS-CO
AND VEND_NBR = :WS-VEND
|
|
|
Back to top |
|
|
|