Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM GET AND CREATE STUDENTS DETAILS USING FILE READ AND WRITE OPERATION

Posted By: Adelheide Fischer     Category: Cobol     Views: 8224

WRITE A PROGRAM GET AND CREATE STUDENTS DETAILS USING FILE READ AND WRITE OPERATION.

Code for PROGRAM GET AND CREATE STUDENTS DETAILS USING FILE READ AND WRITE OPERATION in Cobol

       IDENTIFICATION DIVISION.
       PROGRAM-ID. FI3.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
         SELECT INP-FILE ASSIGN TO DISK
         ORGANIZATION IS LINE SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.

       FD INP-FILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "RESULT.TXT".
       01 STU-FILE.
        05 SNO    PIC 9(2).
        05 SNAME  PIC X(8).
        05 BDP    PIC 99.
        05 BMA    PIC 99.
        05 FOP    PIC 99.
        05 FCO    PIC 99.
        05 DMS    PIC 99.
       
       01 STU-FILE2.
        05 SNO2    PIC 9(2).
        05 SNAME2  PIC X(8).
        05 BDP2    PIC 99.
        05 BMA2    PIC 99.
        05 FOP2    PIC 99.
        05 FCO2    PIC 99.
        05 DMS2    PIC 99.
       

       WORKING-STORAGE SECTION.
       01 EOF PIC X.
       01 DASH PIC X(30) VALUE ALL '='.
       01 STU-FILE1.
        05 STNO   PIC X(4) VALUE "STNO".
        05 FILER  PIC XXXX.
        05 STNAME PIC X(8) VALUE "STNAME".
        05 FILER  PIC XXXX.
        05 BDP1   PIC X(4) VALUE "BDP".
        05 FILER  PIC XXXX.
        05 BMA1   PIC X(4) VALUE "BMA".
        05 FILER  PIC XXXX. 
        05 FOP1   PIC X(4) VALUE "FOP".
        05 FILER  PIC XXXX. 
        05 FCO1   PIC X(4) VALUE "FCO".
        05 FILER  PIC XXXX. 
        05 DMS1   PIC X(4) VALUE "DMS".
        05 FILER  PIC XXXX.
       
       01 STU-FILE1.
        05 STNO   PIC 9(2).
        05 FILER  PIC X.
        05 STNAME PIC X(8).
        05 FILER  PIC X.
        05 BDP1   PIC 99.
        05 FILER  PIC X.
        05 BMA1   PIC 99.
        05 FILER  PIC X. 
        05 FOP1   PIC 99.
        05 FILER  PIC X. 
        05 FCO1   PIC 99.
        05 FILER  PIC X. 
        05 DMS1   PIC 99.
         
       PROCEDURE DIVISION.
       PARA1.
            OPEN INPUT INP-FILE
            PERFORM UNTIL EOF = 'N'
            READ INP-FILE
             AT END 
               MOVE 'N' TO EOF
             NOT AT END 
               MOVE STU-FILE TO STU-FILE1
               DISPLAY STU-FILE1
            END-READ
            END-PERFORM
            CLOSE INP-FILE.
            
            PERFORM PARA2.
           
       PARA2.
            
            OPEN EXTEND INP-FILE.
            MOVE 'Y' TO EOF.
            WRITE 
            PERFORM UNTIL EOF = 'N'
            
            DISPLAY " ENTER STUDENT NAME : "
            ACCEPT SNAME2
            DISPLAY " ENTER STUDENT ROLL NUMBER : "
            ACCEPT SNO2
            DISPLAY " ENTER BDP MARKS : "
            ACCEPT BDP2 
            DISPLAY " ENTER FCO MARKS : "
            ACCEPT FCO2
            DISPLAY " ENTER FOP MARKS : "
            ACCEPT FOP2
            DISPLAY " ENTER BMA MARKS : "
            ACCEPT BMA2 
            DISPLAY " ENTER DMS MARKS : "
            ACCEPT DMS2
          
            WRITE STU-FILE2
            MOVE STU-FILE2 TO STU-FILE1
            DISPLAY DASH
            DISPLAY STU-FILE1
               
         
            DISPLAY " DO YOU WANT TO MORE RECORDS : "
            ACCEPT EOF
         
            END-PERFORM.
            CLOSE INP-FILE. 
           
           STOP RUN.  
              
/*********************************************************************************************
OUTPUT FILE - RESULT.TXT
*********************************************************************************************/
90premk 1250169056 10vishal 4595847525 12vd 2619628756 39amit 7654306242 45chintu 8136514975
  
Share: 



Adelheide Fischer
Adelheide Fischer author of PROGRAM GET AND CREATE STUDENTS DETAILS USING FILE READ AND WRITE OPERATION is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!