IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Date manipulation in Cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vishnu.priya

New User


Joined: 28 Nov 2007
Posts: 11
Location: hyderabad

PostPosted: Mon Mar 28, 2011 12:15 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 28, 2011 12:44 pm
Reply with quote

Quote:
in our system


why don't you ask somebody at YOUR SITE?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 28, 2011 12:56 pm
Reply with quote

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
View user's profile Send private message
earsha

New User


Joined: 16 Mar 2007
Posts: 17
Location: Pune

PostPosted: Mon Mar 28, 2011 12:58 pm
Reply with quote

it must be something your project specific not the general one so better ask in your team
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 28, 2011 1:01 pm
Reply with quote

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
View user's profile Send private message
GlobalGyan

New User


Joined: 31 Jan 2006
Posts: 28

PostPosted: Mon Mar 28, 2011 1:42 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Mar 28, 2011 3:21 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Mar 28, 2011 3:49 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Mar 28, 2011 4:01 pm
Reply with quote

Click below -

ibmmainframes.com/viewtopic.php?p=249707&highlight=#249707

Bill
Back to top
View user's profile Send private message
Peter Nancollis

New User


Joined: 15 Mar 2011
Posts: 47
Location: UK

PostPosted: Wed Mar 30, 2011 5:11 am
Reply with quote

hope its not my bank !
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top