How to get current date in COBOL

1 Answer

0 votes
IDENTIFICATION DIVISION.
PROGRAM-ID. CurrentDateDisplay.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 CurrentDate.
   02  CurrentYear     PIC 9(4).
   02  CurrentMonth    PIC 99.
   02  CurrentDay      PIC 99.

PROCEDURE DIVISION.
Begin.
    ACCEPT CurrentDate FROM DATE YYYYMMDD.
    DISPLAY "Current date: " CurrentDay SPACE CurrentMonth SPACE CurrentYear.
    STOP RUN.
 
 
 
 
# run:
# 
# Current date: 26 08 2022
#

 



answered Aug 26, 2022 by avibootz
edited Aug 26, 2022 by avibootz

Related questions

...