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

How to convert no of days since 1900 to date in mm/dd/yyyy.


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

New User


Joined: 06 Nov 2007
Posts: 36
Location: Bengaluru

PostPosted: Tue Jul 22, 2008 8:40 pm
Reply with quote

In input file i have no of days like 39624 which is equal to 06/26/2008.
I am in search of the code which can convert it in COBOL.
Ex: 39625 is = 06/27/2008.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Tue Jul 22, 2008 9:03 pm
Reply with quote

How do you conclude that 39624 is equal to 06/26/2008 ?
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: Tue Jul 22, 2008 9:12 pm
Reply with quote

Code:
01  WS-DATA-FIELDS.
    05  WS-1899                PIC 9(07) VALUE 0.
    05  WS-CURRENT             PIC 9(07) VALUE 39625.
    05  WS-CURRDATE            PIC 9(07) VALUE 0.
    05  WS-CURR-FULL           PIC 9(08) VALUE 0.

PROCEDURE DIVISION.

     COMPUTE WS-1899 =  FUNCTION INTEGER-OF-DATE (18991231).
     COMPUTE WS-CURRDATE = WS-1899 + WS-CURRENT.
     COMPUTE WS-CURR-FULL =
         FUNCTION DATE-OF-INTEGER (WS-CURRDATE) .
     DISPLAY WS-CURR-FULL .
displays 20080627 as output.
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 Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top