View previous topic :: View next topic
|
Author |
Message |
vishnu.priya
New User
Joined: 28 Nov 2007 Posts: 11 Location: hyderabad
|
|
|
|
Hi All,
I have a date calculation done in our system as below
COMPUTE WS-CALC-C-DAYS = ((CURRENT-DATE-CCYY * 365.25) +
(CURRENT-DATE-MM * 30.4375) +
CURRENT-DATE-DD).
I want to know what the above conversion of date is for.
(Declaration of WS-CALC-C-DAYS is PIC 9(07)V99 VALUE ZEROS.
CURRENT-DATE_CCYY,CURRENT-DATE-MM,CURRENT-DATE-DD as declared as 9(02). and we are accepting system date into this field)
Please let me know about it
Thanks |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why don't you ask somebody at YOUR SITE? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
and, if someone was to guess:
every four years, 1 day is added to the calender
and there are 7 of 12 months that are 31, 4 that are 30 and 1 that is 28
probably somebody figured it was an easier way to determine the number of days since jan 1, 0000. |
|
Back to top |
|
|
earsha
New User
Joined: 16 Mar 2007 Posts: 17 Location: Pune
|
|
|
|
it must be something your project specific not the general one so better ask in your team |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
CURRENT-DATE_CCYY,CURRENT-DATE-MM,CURRENT-DATE-DD as declared as 9(02). |
and this makes no sense.
if you want help, you need to be exact with your descriptions.
your question has nothing to do with cobol,
more to do with thinking.
welcome to monday. |
|
Back to top |
|
|
GlobalGyan
New User
Joined: 31 Jan 2006 Posts: 28
|
|
|
|
like dbzTHEdinosauer says, it appears to be the "rought estimate" of number of days since Jan 01, 0000.
Just curious, what system/domain are you working on?Why would you need the number of days since 0000.
Also, this is not an exact calculation of the number of days since 0000. I remember long time back in school, I had worked on an astronomical code in BASIC, and used a lot more calculation than what you have wirtten here. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You'd have to ask someone at your site -- the calculation is completely nonsense in the real world since it does not account for the calendar differences over the years. Only someone who works at your site and knows the routine could possibly give you the rational behind such a bogus piece of code. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
vishnu.priya wrote: |
COMPUTE WS-CALC-C-DAYS = ((CURRENT-DATE-CCYY * 365.25) +
(CURRENT-DATE-MM * 30.4375) +
CURRENT-DATE-DD). [/b]
I want to know what the above conversion of date is for.
(Declaration of WS-CALC-C-DAYS is PIC 9(07)V99 VALUE ZEROS.
CURRENT-DATE_CCYY,CURRENT-DATE-MM,CURRENT-DATE-DD as declared as 9(02). and we are accepting system date into this field) |
If I keep all the pieces of your post togther - you are counting the total number of days from year 0000 - but then because you accept only the year part (pic 9(02)) and not the century -- 28 March, 2011 and 28 March 1911 will give you the same compute answer, which might be pretty specific to your own application, as Dick has usgested to get in touch with someone at your site might help you to understand it better - the business significance actually; you already know - what it's doing per the code though! |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
Peter Nancollis
New User
Joined: 15 Mar 2011 Posts: 47 Location: UK
|
|
|
|
hope its not my bank ! |
|
Back to top |
|
|
|