Home   Easy-Code    Forum  Updater 
Twitter Facebook



Program to convert all lower case letters into upper case in a file)np program to sort a student file using cobol

Critics Rating:

Users Rating:

*(PROGRAM TO CONVERT ALL LOWER CASE LETTERS INTO UPPER CASE IN A FILE)NP.

*       PROGRAM TO SORT A STUDENT FILE.

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

   IDENTIFICATION DIVISION.

   PROGRAM-ID.

   ENVIRONMENT DIVISION.

   INPUT-OUTPUT SECTION.

   FILE-CONTROL.

      SELECT DATAFILE ASSIGN TO DISK

      ORGANIZATION IS LINE SEQUENTIAL.



      SELECT MAINFILE ASSIGN TO DISK

      ORGANIZATION IS LINE SEQUENTIAL.

      

      SELECT WORKFILE ASSIGN TO DISK.

   DATA DIVISION.

   FILE SECTION.

   FD DATAFILE

      LABEL RECORDS ARE STANDARD

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

   01 STUDENT.

    02 F PIC X(4).

    02 SNO PIC X(3).

    02 F PIC X(3).

    02 SNAME PIC X(10).

    02 F PIC X(5).

    02 MF PIC Z(3).

    02 F PIC X(7).

    02 MS PIC Z(3).

    02 F PIC X(7).

    02 MT PIC Z(3).

    02 F PIC X(6).

    02 T PIC Z(4).

   FD MAINFILE

      LABEL RECORDS ARE STANDARD

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

   01 STU.

    02 F PIC X(4).

    02 PSNO PIC X(3).

    02 F PIC X(3).

    02 PSNAME PIC X(10).

    02 F PIC X(5).

    02 PMF PIC Z(3).

    02 F PIC X(7).

    02 PMS PIC Z(3).

    02 F PIC X(7).

    02 PMT PIC Z(3).

    02 F PIC X(6).

02 PT PIC Z(4).

   SD WORKFILE.

   01 WORK.

    02 F PIC X(4).

    02 WSNO PIC X(3).

    02 F PIC X(3).

    02 WSNAME PIC X(10).

    02 F PIC X(5).

    02 WMF PIC Z(3).

    02 F PIC X(7).

    02 WMS PIC Z(3).

    02 F PIC X(7).

    02 WMT PIC Z(3).

    02 F PIC X(6).

02 WT PIC Z(4).

   WORKING-STORAGE SECTION.

   77 EOF PIC A VALUE "N".

   PROCEDURE DIVISION.

   MAIN-PARA.

      DISPLAY "FILE BEFORE SORTING :".

      DISPLAY "---------------------"

      OPEN INPUT DATAFILE.

      PERFORM X-PARA UNTIL EOF = "Y".

      CLOSE DATAFILE.

      MOVE "N" TO EOF.

      SORT WORKFILE ON DESCENDING KEY WT

      USING DATAFILE GIVING MAINFILE.

      DISPLAY " ".

      DISPLAY "FILE AFTER SORTING :".

      DISPLAY "--------------------".

      OPEN INPUT MAINFILE.

      PERFORM Y-PARA UNTIL EOF = "Y".

      CLOSE MAINFILE.

      STOP RUN.

   X-PARA.

      READ DATAFILE RECORD AT END MOVE "Y" TO EOF.

      IF (EOF NOT = "Y")

       DISPLAY STUDENT.

   Y-PARA.

      READ MAINFILE RECORD AT END MOVE "Y" TO EOF.

      IF (EOF NOT = "Y")

       DISPLAY STU.      

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.