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).
       WORKING-STORAGE SECTION.
       77 N PIC X.
       77 TOTAL PIC 9(3).
       77 PER PIC 9(3).
       PROCEDURE DIVISION.
       OPEN OUTPUT MARK.
       GET-PARA.
           DISPLAY "Enter name".
  ACCEPT NAME.
  DISPLAY "Enter roll no:".
  ACCEPT ROLL.
  DISPLAY "Enter DPFS marks:".
  ACCEPT S1.
  DISPLAY "Enter SE marks:".
  ACCEPT S2.
  DISPLAY "Enter DPPL marks:".
  ACCEPT S3.
  DISPLAY "Enter DAA marks:".
  ACCEPT S4.
  DISPLAY "Enter IME marks:".
  ACCEPT S5.
  WRITE MARK-REC.
  DISPLAY "Do u want to continue....PRESS Y".
  ACCEPT N.
  IF N = "Y"
  GO TO GET-PARA.
  END-GET.
  CLOSE MARK.
  OPEN INPUT MARK.
  DISPLAY "-------------------------------------------------------".
  DISPLAY "NAME            ROLL  DPFS SE  DPPL DAA IME TOTAL PER ".
  DISPLAY "-------------------------------------------------------".
  READ-PARA.
  READ MARK AT END GO TO END-PARA.
  COMPUTE TOTAL = S1 + S2 + S3 + S4 + S5.
  COMPUTE PER = TOTAL / 5.
  DISPLAY NAME ROLL S1 S2 S3 S4 S5 TOTAL PER "%".
  GO TO READ-PARA.
  END-PARA.
  CLOSE MARK.
  STOP RUN.        
Previous
Next Post »