Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program describes how to use Sort technique

Posted By: Bourke Fischer     Category: Cobol     Views: 2426

Write a program describes how to use Sort technique.

Code for Program describes how to use Sort technique in Cobol

       IDENTIFICATION DIVISION.
        PROGRAM-ID. SORTING.

       ENVIRONMENT DIVISION.

        CONFIGURATION SECTION.
         SOURCE-COMPUTER. IBM-PC.
         OBJECT-COMPUTER. IBM-PC.

        INPUT-OUTPUT SECTION.
         FILE-CONTROL.

           SELECT UNSORTED-FILE ASSIGN TO DISK
           ORGANIZATION IS LINE SEQUENTIAL.

           SELECT WORK-FILE ASSIGN TO SYSWORK.

           SELECT SORTED-FILE ASSIGN TO DISK
           ORGANIZATION IS LINE SEQUENTIAL.

       DATA DIVISION.

        FILE SECTION.

         FD UNSORTED-FILE
           VALUE OF FILE-ID IS "SORT.INP".
         01 IN-REC.
            05 IN-NAME PIC X(7).
            05 FILLER PIC XX.
            05 IN-AGE PIC 99.

         SD WORK-FILE.
         01 WORK-REC.
            05 WORK-NAME PIC X(7).
            05 FILLER PIC X(4).

         FD SORTED-FILE
           VALUE OF FILE-ID IS "SORT1.OUT".
         01 OUT-REC PIC X(80).

        WORKING-STORAGE SECTION.

       PROCEDURE DIVISION.

           SORT WORK-FILE
                ON ASCENDING KEY WORK-NAME
                USING UNSORTED-FILE
                GIVING SORTED-FILE.

           STOP RUN.


/***********************************************************************************************
INPUT FILE - SORT.INP
**********************************************************************************************/
prem 44 ramesh 29 hemang 55 dipesh 16 harshal 74 nitin 34 amit 35 /***********************************************************************************************
OUT FILE - SORT1.OUT
***********************************************************************************************/
amit 35 dipesh 16 harshal 74 hemang 55 nitin 34 prem 44 ramesh 29
  
Share: 


Didn't find what you were looking for? Find more on Program describes how to use Sort technique Or get search suggestion and latest updates.

Bourke Fischer
Bourke Fischer author of Program describes how to use Sort technique is from Frankfurt, Germany.
 
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!