Cobol- Date Function (1 of 2)

Cobol is simple and powerful language. It is evergreen for 100 yrs now.

FUNCTION CURRENT-DATE  ===> will retrieve current date & Time in the below format.

Usage: MOVE FUNCTION CURRENT-DATE(1:8)  TO WS-CURRENT-DATE

By using MOVE and Reference modification we can retrieve the part of  it as needed.

01  WS-CURRENT-DATE-FIELDS.

             05  WS-CURRENT-DATE.

                 10  WS-CURRENT-YEAR        PIC  9(4).

                 10  WS-CURRENT-MONTH   PIC  9(2).

                 10  WS-CURRENT-DAY        PIC  9(2).

             05  WS-CURRENT-TIME.

                 10  WS-CURRENT-HOUR       PIC  9(2).

                 10  WS-CURRENT-MINUTE  PIC  9(2).

                 10  WS-CURRENT-SECOND  PIC  9(2).

                 10  WS-CURRENT-MS           PIC  9(2).

             05  WS-DIFF-FROM-GMT       PIC S9(4).

I wiil add some more in part-2.

Discover more from Srinimf

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Srinimf

Subscribe now to keep reading and get access to the full archive.

Continue reading