Home   Easy-Code    Forum  Updater 
Twitter Facebook



Program to write a message into a text file using cobol

Critics Rating:

Users Rating:

* PROGRAM TO WRITE A MESSAGE INTO A TEXT FILE.

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

   IDENTIFICATION DIVISION.

   PROGRAM-ID.

   ENVIRONMENT DIVISION.

   INPUT-OUTPUT SECTION.

   FILE-CONTROL.

      SELECT DATAFILE ASSIGN TO DISK

      ORGANIZATION IS LINE SEQUENTIAL.

   DATA DIVISION.

   FILE SECTION.

   FD DATAFILE

      LABEL RECORDS ARE STANDARD

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

   01 MESSAGE.

    02 TEXT PIC X(79).

   PROCEDURE DIVISION.

   MAIN-PARA.

      OPEN EXTEND DATAFILE.

      DISPLAY "ENTER YOUR MESSAGE".

      ACCEPT TEXT.

      DISPLAY "SEE TEXT.DAT FILE FOR THE GIVEN MESSAGE".

      WRITE MESSAGE.

      CLOSE DATAFILE.

      STOP RUN.

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.