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

convert date (YYMMDD) to number of days


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mahua Mitra

New User


Joined: 26 Apr 2007
Posts: 49
Location: Delhi

PostPosted: Tue Dec 11, 2007 12:56 pm
Reply with quote

Hi
How can I convert Date (YYMMDD) to number of days.
One way is to change it to Julian and get the number of days.
I want to know if there is a direct way of doing it.

Thanks
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Dec 11, 2007 1:20 pm
Reply with quote

Mahua,

Refer the manuals to see whether the DATE intrinsic functions can be used for your requirement.
Back to top
View user's profile Send private message
roopannamdhari
Warnings : 1

New User


Joined: 14 Sep 2006
Posts: 71
Location: Bangalore

PostPosted: Wed Dec 19, 2007 4:55 pm
Reply with quote

Hi Mitra,

Here i am posting code to generate number of days for given date, but here date should be in the formate YYYYMMDD . it may help you i think

Code:
DATA DIVISION.                                         
WORKING-STORAGE SECTION.                               
                                                       
01  NUMBER-OF-DAYS            PIC 9(10).               
01  INPUT-DATE                PIC 9(8).               
                                                       
                                                       
PROCEDURE DIVISION.                                   
                                                       
PROGRAM-START.                                         
                                                       
    MOVE  "19990222"  TO INPUT-DATE.                   
    DISPLAY "INPUT-DATE==>" INPUT-DATE.               
    COMPUTE NUMBER-OF-DAYS                             
            = FUNCTION INTEGER-OF-DATE (INPUT-DATE).   
    DISPLAY "NUMBER-OF-DAYS==>" NUMBER-OF-DAYS.       
    STOP RUN.                                         
[img][/img]

Thanks,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Dec 19, 2007 9:17 pm
Reply with quote

Hello,

Maybe i misunderstand the question. . .

Is the requirement to calculate the Julian date?

When a "number of days" is mentioned, it usually refers to the number of days between 2 dates. . .
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top