View previous topic :: View next topic
|
Author |
Message |
Ankit Kumar Gupta
New User
Joined: 08 Jan 2011 Posts: 16 Location: India
|
|
|
|
Hi,
I have to use a query in cobol code as shown below:
Code: |
EXEC SQL
SELECT COUNT(*)
INTO
:WS-COUNT
FROM table1
WHERE LST_UPDT_DTTM <= CURRENT TIMESTAMP - :WS-X HOURS
END-EXEC
|
Earlier i was using like "- 8 HOURS" and it was working perfect. But now, requirement is to hour from dataset and so, need to subtract like shown above.
It is failing in bind with SQLCODE=-171 SQLSTATE=42815.
WS-X is defined as x(02) in program. Please suggest |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Define it as 9(02)
you can't substract with X(02) |
|
Back to top |
|
|
Ankit Kumar Gupta
New User
Joined: 08 Jan 2011 Posts: 16 Location: India
|
|
|
|
I have tried that... Current Timestamp is system defined as X(26) |
|
Back to top |
|
|
Ankit Kumar Gupta
New User
Joined: 08 Jan 2011 Posts: 16 Location: India
|
|
|
|
when 9(02), it throws compilation error as 'UNDEFINED OR UNUSABLE HOST VARIABLE "WS-X" ' |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Apologise Define it as S9(04) COMP |
|
Back to top |
|
|
Ankit Kumar Gupta
New User
Joined: 08 Jan 2011 Posts: 16 Location: India
|
|
|
|
It worked... THanks a much Pandora... |
|
Back to top |
|
|
|