Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM FOR INPUT RECORDS INTO THE FILE USING EXTEND MODE

Posted By: Aimee Hughes     Category: Cobol     Views: 5873

PROGRAM FOR INPUT RECORDS INTO THE FILE USING EXTEND MODE.

Code for PROGRAM FOR INPUT RECORDS INTO THE FILE USING EXTEND MODE in Cobol

     IDENTIFICATION DIVISION.
        PROGRAM-ID. IP.
       
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
        FILE-CONTROL.
           SELECT OUT1 ASSIGN TO DISK
           ORGANIZATION IS LINE SEQUENTIAL.
       
       DATA DIVISION. 
       FILE SECTION.
        
        FD OUT1
           LABEL RECORDS ARE STANDARD
           VALUE OF FILE-ID IS "REPORT.TXT".
        
        01 STD-REC.
         05 NO1    PIC 99. 
         05 FILLER PIC XX.
         05 NAME1  PIC X(10). 
         05 FILLER PIC XX.
         05 MARK1  PIC 999 OCCURS 5 TIMES. 
         05 FILLER PIC XXX.
         05 TOTAL  PIC 999.
         
       WORKING-STORAGE SECTION.  
       
       01 FLAG  PIC X VALUE "Y".
       01 DASH2 PIC X(70) VALUE ALL"=".
       01 J     PIC 9 VALUE 1.
      
       
       PROCEDURE DIVISION.
        PARA1.
         OPEN EXTEND OUT1.
         PERFORM PARA2 UNTIL FLAG="N".
         CLOSE OUT1.
         STOP RUN.
        
        PARA2.
         DISPLAY "ENTER ROLLNO:".
         ACCEPT NO1.
         DISPLAY "ENTER NAME:".
         ACCEPT NAME1.
         
         PERFORM VARYING J FROM 1 BY 1 UNTIL J>5
         DISPLAY "ENTER MARK " J ":"
         ACCEPT MARK1(J)
         ADD MARK1(J) TO TOTAL.
        
         WRITE STD-REC.
         
         DISPLAY "DO U WANT TO ENTER AGAIN?(Y/N):".
         ACCEPT FLAG.
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM FOR INPUT RECORDS INTO THE FILE USING EXTEND MODE Or get search suggestion and latest updates.

Aimee Hughes
Aimee Hughes author of PROGRAM FOR INPUT RECORDS INTO THE FILE USING EXTEND MODE is from London, United Kingdom.
 
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!