COBOL program to allot grade for students overwriting previous file.


THIS PROGRAM USES THE DATA FILE ("MARK.DAT")  MADE BY PREVIOUS PROGRAM TITLED COBOL program to make sequential file for student's marks .
   
IDENTIFICATION DIVISION.
       PROGRAM-ID." SEQFILE".
       AUTHOR."KUNAL".
       DATE-WRITTEN."18/01/12".
       DATE-COMPILED."18/01/12".
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER. M8.
       OBJECT-COMPUTER. M8.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
       SELECT MARK ASSIGN TO DISK
       ORGANIZATION IS SEQUENTIAL
       ACCESS MODE IS SEQUENTIAL.
       DATA DIVISION.
       FILE SECTION.
       FD MARK
          LABEL RECORDS ARE STANDARD
          VALUE OF FILE-ID IS "MARK.DAT".
       01 MARK-REC.
       02 NAME PIC X(15).
       02 ROLL PIC 9(3).
       02 MARKS.
         03 S1 PIC 9(3).
03 S2 PIC 9(3).
03 S3 PIC 9(3).
03 S4 PIC 9(3).
03 S5 PIC 9(3).
       02 GRADE PIC 999.
         88 A VALUES ARE 299 THRU 375.
88 D VALUES ARE 376 THRU 425.
88 M VALUES ARE 426 THRU 500.
       02 GR PIC X.  
       WORKING-STORAGE SECTION.
       77 PER PIC 9(3).
       77 TOTAL PIC 9(3).
       PROCEDURE DIVISION.
           OPEN INPUT MARK.
           DISPLAY "------------------------------------------------------------".
   DISPLAY "NAME          ROLL DPFS SE  DPPL DAA IME PER(%) GRADE ".
           DISPLAY "-----------------------------------------------------------".  
           READ-PARA.
           READ MARK AT END GO TO LAST-PARA CLOSE MARK.
           COMPUTE TOTAL = S1 + S2 + S3 + S4 + S5.
           COMPUTE PER = TOTAL /5.
           MOVE TOTAL TO GRADE.
  IF A MOVE "A" TO GR
           ELSE
           IF D 
  MOVE "D" TO GR
  ELSE
  IF M MOVE "M" TO GR.
            DISPLAY NAME ROLL S1 S2 S3 S4 S5 PER GR.
           END-PARA.
           GO TO READ-PARA.
           LAST-PARA.
           STOP RUN.
Previous
Next Post »