Microsoft KB Archive/36805

Example to ACCEPT & DISPLAY System DATE, TIME, and Julian DAY

PSS ID Number: Q36805 Article last modified on 04-20-1993

3.00 | 3.00 MS-DOS | OS/2

Summary: The working program example below was written in Microsoft COBOL Version 3.0 and will ACCEPT and DISPLAY the DATE, TIME, and Julian DAY from the system. This program needs to be linked to the ADIS, ADISINIT, and ADISKEY files.

More Information: The following is a code example: DATA DIVISION. WORKING-STORAGE SECTION. 01 DATE-LINE. 05 DT-YEAR PIC XX. 05 DT-MONTH PIC XX. 05 DT-DAY PIC XX. 01 TIME-LINE. 05 TL-HOUR PIC 99. 05 TL-MINUTE PIC XX. 05 TL-SECONDS PIC XX. 05 TL-MILLSECS PIC XX. 01 JULIAN-LINE. 05 JL-YEAR PIC XX. 05 JL-DAY PIC XXX. PROCEDURE DIVISION. 000-MAIN-BEGIN. DISPLAY SPACES UPON CRT. ACCEPT DATE-LINE FROM DATE. ACCEPT TIME-LINE FROM TIME. ACCEPT JULIAN-LINE FROM DAY. '' DISPLAY “MM/DD/YY” AT 1010. DISPLAY “HH:MM:SS.xx” AT 1033. DISPLAY “DAY/YR” AT 1060. '' DISPLAY AT 1110 DT-MONTH “/” DT-DAY “/” DT-YEAR. IF TL-HOUR > 12 THEN DISPLAY “PM” AT 1145 SUBTRACT 12 FROM TL-HOUR ELSE DISPLAY “AM” AT 1145. DISPLAY AT 1133 TL-HOUR “:” TL-MINUTE “:” TL-SECONDS “.” TL-MILLSECS. DISPLAY AT 1160 JL-DAY “/” JL-YEAR. STOP RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.