Creation of Line Sequential - Student File with records having REGNO, NAME and MARKS OF THREE SUBJECTS.


       IDENTIFICATION DIVISION.
       PROGRAM-ID. STUDENT-FILE-SEQUENTIAL-FILE.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER.
       OBJECT-COMPUTER.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT STU-FILE ASSIGN TO DISK
           ORGANIZATION IS LINE SEQUENTIAL.
       DATA DIVISION.
       FILE SECTION.
       FD  STU-FILE
           LABEL RECORDS ARE STANDARD
           VALUE OF FILE-ID IS "STU.DAT"
           DATA RECORD IS STU-REC.
       01  STU-REC.
           02 REGNO   PIC 999.
           02 NAME    PIC X(30).
           02 M1      PIC 999.
           02 M2      PIC 999.
           02 M3      PIC 999.
       WORKING-STORAGE SECTION.
       77  NOS        PIC 99.
       PROCEDURE DIVISION.
       MAIN-PARA.
           PERFORM OPEN-PARA.
           DISPLAY "Enter the Number of Students : ".
           ACCEPT NOS.
           PERFORM GET-DATA NOS TIMES.
           PERFORM CLOSE-PARA.
           STOP RUN.
       OPEN-PARA.
           OPEN OUTPUT STU-FILE.
       GET-DATA.
           DISPLAY "Enter the Register  No : ".
           ACCEPT REGNO.
           DISPLAY "Enter the Name : ".
           ACCEPT NAME.
           DISPLAY "Three Marks : ".
           ACCEPT M1.
           ACCEPT M2.
           ACCEPT M3.
           WRITE STU-REC.
       CLOSE-PARA.
           CLOSE STU-FILE.

No comments:

Post a comment