PROGRAM WHICH TAKE THE INPUT FROM FILE SORT THE ACCORDING KEY AND STORE IN ANOTHER FILE.
IDENTIFICATION DIVISION. PROGRAM-ID.sort1. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT sortin ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL. SELECT sortout ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL. SELECT sortfile ASSIGN TO DISK. DATA DIVISION. FILE SECTION. FD sortin VALUE OF FILE-ID IS "sortin.txt". 01 sortinrec. 05 ino PIC 99. 05 filler PIC x. 05 iname PIC x(10). FD sortout VALUE OF FILE-ID IS "sortout.txt". 01 sortoutrec. 05 ono PIC 99. 05 filler PIC x. 05 oname PIC x(10). SD sortfile. 01 sortrec. 05 sno PIC 99. 05 filler PIC x. 05 sname PIC x(10). PROCEDURE DIVISION. SORT sortFILE ON ASCENDING KEY sno USING sortin GIVING sortout. STOP RUN. *********************INPUT******************************* *SORTIN.TXT *01 JOLLY *05 MANALI *03 SARITA *02 ISHA *********************OUTPUT****************************** *SORTOUT.TXT *01 JOLLY *02 ISHA *03 SARITA *05 MANALI