-
Notifications
You must be signed in to change notification settings - Fork 37
/
MERGSORT
32 lines (32 loc) · 1.03 KB
/
MERGSORT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
IDENTIFICATION DIVISION.
PROGRAM-ID. ISORT.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT1 ASSIGN TO INP1.
SELECT INPUT2 ASSIGN TO INP2.
SELECT OUTPUT1 ASSIGN TO OUT.
SELECT WORK ASSIGN TO WRK.
DATA DIVISION.
FILE SECTION.
FD INPUT1.
01 INPUT1-CUSTOMER.
05 CUSTOMER-ID-I1 PIC 9(5).
05 CUSTOMER-NAME-I1 PIC A(25).
FD INPUT2.
01 INPUT2-CUSTOMER.
05 CUSTOMER-ID-I2 PIC 9(5).
05 CUSTOMER-NAME-I2 PIC A(25).
FD OUTPUT1.
01 OUTPUT-CUSTOMER.
05 CUSTOMER-ID-O PIC 9(5).
05 CUSTOMER-NAME-O PIC A(25).
SD WORK.
01 WORK-CUSTOMER.
05 CUSTOMER-ID-W PIC 9(5).
05 CUSTOMER-NAME-W PIC A(25).
PROCEDURE DIVISION.
MERGE WORK ON ASCENDING KEY CUSTOMER-ID-W
USING INPUT1, INPUT2 GIVING OUTPUT1.
DISPLAY 'SORT AND MERGE SUCESSFUL'.
STOP RUN.