Home   Easy-Code    Forum  Updater 
Twitter Facebook



Program to copy the contents of one text file into another text file using cobol

Critics Rating:

Users Rating:

* PROGRAM TO COPY THE CONTENTS OF ONE TEXT FILE INTO ANOTHER TEXT FILE.

***********************************************************************

   IDENTIFICATION DIVISION.

   PROGRAM-ID.

   ENVIRONMENT DIVISION.

   INPUT-OUTPUT SECTION.

   FILE-CONTROL.

      SELECT INFILE ASSIGN TO DISK

      ORGANIZATION IS LINE SEQUENTIAL.



      SELECT OUTFILE ASSIGN TO DISK

      ORGANIZATION IS LINE SEQUENTIAL.

   DATA DIVISION.

   FILE SECTION.

   FD INFILE

      LABEL RECORDS ARE STANDARD

      VALUE OF FILE-ID IS "TEXT.DAT".

   01 INTEXT.

    02 ITEXT PIC X(79).

   FD OUTFILE

      LABEL RECORDS ARE STANDARD

      VALUE OF FILE-ID IS "OUTTEXT.DAT".

   01 OUTTEXT.

    02 OTEXT PIC X(79).

   WORKING-STORAGE SECTION.

   77 EOF PIC 9 VALUE 0.

   PROCEDURE DIVISION.

   MAIN-PARA.

      OPEN INPUT INFILE.

      OPEN OUTPUT OUTFILE.

      READ INFILE RECORD AT END MOVE 1 TO EOF.

      PERFORM X-PARA UNTIL EOF = 1.

      DISPLAY "SEE OUTTEXT.DAT FILE FOR THE TEXT".

      CLOSE INFILE OUTFILE.

      STOP RUN.

   X-PARA.

      WRITE OUTTEXT FROM INTEXT.

      READ INFILE RECORD AT END MOVE 1 TO EOF.

Courtesy, Source, References & Regards: Kishore AVGK

While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright@2009-2011 by KuGuNi.com. All Rights Reserved.