Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM TO WRITE THE STUDENT DETAILS IN STUDENT INFORMATION FILE USING FILE WRITE OPERATION

Posted By: Scarlett Hughes     Category: Cobol     Views: 11677

WRITE A PROGRAM TO WRITE THE STUDENT DETAILS IN STUDENT INFORMATION FILE USING FILE WRITE OPERATION.

Code for PROGRAM TO WRITE THE STUDENT DETAILS IN STUDENT INFORMATION FILE USING FILE WRITE OPERATION in Cobol

       IDENTIFICATION DIVISION.
        PROGRAM-ID. FI2.

       ENVIRONMENT DIVISION.
        INPUT-OUTPUT SECTION.
         FILE-CONTROL.
         SELECT STU-OUT ASSIGN TO DISK
         ORGANIZATION IS LINE SEQUENTIAL.
          
       DATA DIVISION.
       FILE SECTION.
       FD STU-OUT
        LABEL RECORDS ARE STANDARD
        VALUE OF FILE-ID IS "MARKSHEET.TXT".
        01 STU-OUT1. 
          05 SNAME    PIC X(6).
          05 FILER    PIC X.
          05 SNO      PIC 9(2).
          05 FILER    PIC X.
          05 SMARK    PIC 9(3).
 
       WORKING-STORAGE SECTION.
        01 EOF      PIC X VALUE 'Y'.
        01 REC-CNT  PIC 9.
        01 STU-REC. 
         05 PNAME   PIC X(6).
         05 FILER   PIC X.
         05 PNO     PIC 9(2).
         05 FILER   PIC X.
         05 PMARK   PIC 9(3).
        01 DASH     PIC X(33) VALUE ALL '='.
       
       PROCEDURE DIVISION.
        PARA1.
         OPEN EXTEND STU-OUT
          PERFORM UNTIL EOF = 'N'   
             DISPLAY " ENTER STUDENT NAME : "
             ACCEPT SNAME
             DISPLAY " ENTER STUDENT ROLL NUMBER : "
             ACCEPT SNO
             DISPLAY " ENTER STUDENT MARKS : "
             ACCEPT SMARK
             
             WRITE STU-OUT1 
      *       AFTER ADVANCING 1 LINE
               MOVE STU-OUT1 TO STU-REC
      *         MOVE SNAME TO PNAME
      *         MOVE SNO TO PNO
      *         MOVE SMARK TO PMARK
                
               DISPLAY DASH 
               DISPLAY STU-REC
               DISPLAY " DO YOU WANT TO MORE RECORDS : "
               ACCEPT EOF
              
          END-PERFORM.
         CLOSE STU-OUT.
           
           STOP RUN.


/*********************************************************************************
OUTPUT FILE - MARKSHEET.TXT
*********************************************************************************/
PREM 12 032 VISHAL 45 065 JAYANT 65 085 VD 40 056 KAPIL 09 009 KHILAN 08 008 SANJAY 12 012 CHINTAN 12 012
  
Share: 



Scarlett Hughes
Scarlett Hughes author of PROGRAM TO WRITE THE STUDENT DETAILS IN STUDENT INFORMATION FILE USING FILE WRITE OPERATION is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
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!