Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Date manipulation in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Date manipulation in Cobol
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 7913
Location: Bellevue, IA

PostPosted: Mon Mar 28, 2011 3:21 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Mar 28, 2011 3:49 pm    Post subject: Re: Date manipulation in Cobol
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Mar 28, 2011 4:01 pm    Post subject: Reply to: Date manipulation in Cobol
Reply with quote

Click below -

http://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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us