Home > Software > Mainframe > Cobol
Interview Questions   Tutorials   Discussions   Programs   

Cobol - How include time & date in the report generation in Cobol programming?




502
views
asked mar September 6, 2014 01:49 PM  

How include time & date in the report generation in Cobol programming?


           

1 Answers



 
answered By Mswami   0  

CURRENT-DATE is COBOL intrinsic function to get current date, time and difference between current location time and Greenwich Mean Time.

MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-DATA

This function returns a 20-character alphanumeric field in the below format.

01  WS-CURRENT-DATE-DATA.
           05  WS-CURRENT-DATE.
               10  WS-CURRENT-YEAR  PIC 9(04).
               10  WS-CURRENT-MONTH PIC 9(02).
               10  WS-CURRENT-DAY   PIC 9(02).
           05  WS-CURRENT-TIME.
               10  WS-CURRENT-HOURS PIC 9(02).
               10  WS-CURRENT-MINUTE PIC 9(02).
               10  WS-CURRENT-SECOND PIC 9(02).
               10  WS-CURRENT-MILLISECONDS  PIC 9(02).
           05  WS-DIFF-FROM-GMT PIC S9(04).

    WS-CURRENT-DATE-DATA contains : 2010111917542857+0800

Probably the most useful intrinsic function is CURRENT-DATE which is a replacement for ACCEPT DATE and ACCEPT TIME. CURRENT-DATE is Y2K-compliant, having a 4-digit year.

flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert