Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program to writes the records reside in the input file and displays on the screen

Posted By: Morgan Brown     Category: Cobol     Views: 2178

Write a program to writes the records reside in the input file and displays on the screen.

Code for Program to writes the records reside in the input file and displays on the screen in Cobol

       IDENTIFICATION DIVISION.
       PROGRAM-ID. FWT1.
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT FILEWRITE1 ASSIGN TO DISK
           ORGANIZATION IS LINE SEQUENTIAL.  
       DATA DIVISION.
       FILE SECTION.
       FD FILEWRITE1
           VALUE OF FILE-ID IS "F:\MCAFY\MCA138\WFI.TXT".
       01 DATA2.
             02 SNAME PIC X(10).
             02 AMT PIC 9(5).
             02 I PIC 9.
       WORKING-STORAGE SECTION.
       01 EOF PIC X VALUE "N".
       01 EOF PIC X VALUE "Y".
       PROCEDURE DIVISION.
       DISP1.
           OPEN EXTEND FILEWRITE1.
           PERFORM VARYING I FROM 1 BY 1 UNTIL I>5
           DISPLAY "ENTER NAME = "
           ACCEPT SNAME
           DISPLAY "ENTER AMOUNT ="
           ACCEPT AMT             
           WRITE DATA2
           END-PERFORM.
           CLOSE FILEWRITE1.
           STOP RUN.
      
/*********************************************************************************
OUTPUT
*********************************************************************************/
PREM 001006 AMIT 005641 BHAVESH 000551 KHILAN 005642 KAPIL 005453 ANKIT 004544
  
Share: 



Morgan Brown
Morgan Brown author of Program to writes the records reside in the input file and displays on the screen 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!