View previous topic :: View next topic
|
Author |
Message |
vin12pr Warnings : 1 New User
Joined: 14 Jun 2006 Posts: 56
|
|
|
|
Hi,
How to get the value of (current date - 1 day) in cobol?
Thanks,
Vin12pr |
|
Back to top |
|
|
ashwinreddy
Active User
Joined: 16 Sep 2004 Posts: 106 Location: Hyderabad
|
|
|
|
Hi,
I am not sure whether this is possible in cobol, i think this cab be possible in db2 as (Date(ws-current) - day(1)).
As we need to consider even the date formats as ISO or jullian or GF (week format) etc.
As we use to call a date routine by passing all the required inputs.
May be some good answers follows from other members.
Cheers
Ashwin |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Vin12pr,
I believe you need little brain storming and programming skills to acheive your requirement.
Accept the DAY value into the variable, deduct 1 and convert the value to date using some logic. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi
I have modified the code from the above link.Plz let us know if it is correct.
Code: |
01 WS-TODAY PIC 9(8).
01 WS-PREV-DATE PIC 9(8).
....
MOVE FUNCTION CURRENT-DATE (1:8) TO WS-TODAY.
COMPUTE WS-PREV-DATE =
FUNCTION DATE-OF-INTEGER(FUNCTION INTEGER-OF-DATE(WS-TODAY) - 1 )
|
Thanks
Arun |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Have you looked at the intrinsic functions in the Enterprise COBOL Reference Manual? |
|
Back to top |
|
|
rz061m
New User
Joined: 03 Mar 2006 Posts: 48 Location: Chennai
|
|
|
|
I am not sure of how the above code is going to work.
My suggestion will be, get the current date; convert it to Julian date and subtract one from it and then convert the julian date to normal for of your choice, PROVIDED YOU KNOW THE UTILITY USED IN YOUR SITE TO CONVERT DATES TO DIFFERENT FORMAT. |
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
Guys,
The intrinsic functions work just fine. We have a sub-program that adds and subtracts from a date - it does not use the intrinsic functions because it was coded years ago - before the functions were available. We wanted to measure whether there would be any performance advantage in using the intrinsic function instead of our own routines. They both performed the same.
So we continue to use our utility.
However - like I said the instrinsic functions work great and are easy to use. |
|
Back to top |
|
|
jasorn Warnings : 1 Active User
Joined: 12 Jul 2006 Posts: 191 Location: USA
|
|
|
|
Yeah, the instrinsic functions make date calculations a snap. |
|
Back to top |
|
|
|