View previous topic :: View next topic
|
Author |
Message |
Susanta
Active User
Joined: 17 Nov 2009 Posts: 126 Location: India
|
|
|
|
Hi,
I am trying to subtract the days from current date,
where WS-ACK-PRD pic 9(3) contains the days.
I tried with below code but not working.
Please help.
EXEC SQL
SET :WS-CURRDT-MINUS-ACKPRD-DT = CURRENT DATE
- DAY(:WS-ACK-PRD )
END-EXEC |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
This is very close to a null content statement. Do you mean:
1. the statement is accepted but not producing results?
2. the statement is accepted but producing incorrect results?
3. the statement is not accepted by DB2?
4. the statement caused DB2 to crash?
5. the statement caused an abend?
6. something else? if so, what?
Since you did not specify which of these possibilities occurred, are we to guess? Maybe solve your problem, maybe not? Wait for more information? Wait for you to learn how to pose a question? |
|
Back to top |
|
|
Susanta
Active User
Joined: 17 Nov 2009 Posts: 126 Location: India
|
|
|
|
Thanks everyone ,
It got solved now, I have corrected it by trial and error .
The correct syntax is as below..
EXEC SQL
SET :WS-CURRDT-MINUS-ACKPRD-DT = CURRENT DATE
- WS-ACK-PRD DAY
END-EXEC |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
try
- DAY(:WS-ACK-PRD) DAYS |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
are you sure it is:
- WS-ACK-PRD DAY
and not
- :WS-ACK-PRD DAY |
|
Back to top |
|
|
Susanta
Active User
Joined: 17 Nov 2009 Posts: 126 Location: India
|
|
|
|
Initially i tried with - :WS-ACK-PRD DAY
but gave compilation error.
Then I tired with - WS-ACK-PRD DAY
and it worked. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Susanta,
thx for the feedback. |
|
Back to top |
|
|
Susanta
Active User
Joined: 17 Nov 2009 Posts: 126 Location: India
|
|
|
|
Really sorry to say that it gave bind error saying WS-ACK-PRD is not a known db2 column.
At last i used as below and compilation and bind was successfull.
SELECT CURRENT DATE - AC_PRD DAY
INTO :WS-CURRDT-MINUS-ACKPRD-DT
FROM TABL1
WHERE CNUM= :WS-CNUM |
|
Back to top |
|
|
|