View previous topic :: View next topic
|
Author |
Message |
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Hi,
I am retrieving current system date from the following syntax in COBOL:
Accept ws-date from date.
Now my requirement is to get yesterday's date.
So can you please tell me on how to get that.
Any kind of help will be really appreciated.
- Mohit |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Easiest would be to subtract one from INTEGER-OF-DATE of the current date followed by DATE-OF-INTEGER.... |
|
Back to top |
|
|
kgumraj2
New User
Joined: 01 Aug 2007 Posts: 42 Location: Hyderabad
|
|
|
|
Hi,
If you use, db2 use
EXEC SQL
SELECT ( CURRENT DATE -1 DAY)
INTO :<wS-VAR>
FROM SYSIBM.SYSDUMMY1
END-EXEC. |
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
CICS Guy wrote: |
Easiest would be to subtract one from INTEGER-OF-DATE of the current date followed by DATE-OF-INTEGER.... |
I could not understand by 'subtract one from INTEGER-OF-DATE of the current date followed by DATE-OF-INTEGER' ..
Can you please give some more idea on this . |
|
Back to top |
|
|
kgumraj2
New User
Joined: 01 Aug 2007 Posts: 42 Location: Hyderabad
|
|
|
|
Hi,
Please find following code that might be of some use.
Code: |
This converts date into integer.
compute DIFFERENCE-OF-DATES =
(FUNCTION INTEGER-OF-DATE (DT1) - 1)
This converts interger into date
compute DATE-var =
(FUNCTION DATE-OF-INTEGER(DIFFERENCE-OF-DATES )
|
Thanks. |
|
Back to top |
|
|
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Thanks all for all the inputs. |
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
Hi All,
I have one doubt,If you subtract one from date integer up to 2 of the month it will be okay, If it is 1st of month then if you subtract 1 from date it will becomes zero then your logic will not work.
we have take care of the year, month and the date integer too. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
Back to top |
|
|
|