Saturday, 1 March 2014

COBOL Program to display TIME



COBOL Program to display TIME
 PROGRAM:  
       IDENTIFICATION DIVISION.
       PROGRAM-ID TIME.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
           77 STUDENTID PIC 9(8).
           77 STUDENTNAME PIC X(20).
           77 COURSECODE PIC X(4).
           77 GENDER PIC X.
       01 CURRENTTIME.
           02 CURRENTHOUR PIC 99.
           02 CURRENTMINUTE PIC 99.
           02 FILLER PIC 9(4).
       PROCEDURE DIVISION.
       BEGIN.
           DISPLAY "ENTER STUDENT DETAILS USING TEMPLATE BELOW".
           DISPLAY "ENTER-ID:".
           DISPLAY "ENTER STUDENT NAME:".
           DISPLAY "COURSE CODE:".
           DISPLAY "ENTER GENDER:".
           ACCEPT STUDENTID.
           ACCEPT STUDENTNAME.
           ACCEPT COURSECODE.
           ACCEPT GENDER.
           ACCEPT CURRENTTIME FROM TIME.
           DISPLAY "ID IS:", STUDENTID.
           DISPLAY "NAME IS:", STUDENTNAME.
           DISPLAY "COURSECODE:", COURSECODE.
           DISPLAY "GENDER:", GENDER.
           DISPLAY "THE TIME IS", CURRENTHOUR ":" CURRENTMINUTE.
           STOP RUN.

No comments: