identification division. program-id. Program1. environment division. input-output section. File-Control. Select PayRollM assign to "E:\cobol\PayRollM.txt" organization is line sequential. Select PayRollT assign to "E:\cobol\PayRollT.txt" organization is line sequential. Select UPayRollM assign to "E:\cobol\UPayRollM.txt" organization is line sequential. Select ControlL assign to "E:\cobol\ControlL.txt" organization is line sequential. configuration section. data division. fd PayRollM. 01 Employee. 05 Emp-No pic 9(5). 05 pic x(24). 05 Ann-Sal pic 9(6). 05 pic x(45). fd PayRollT. 01 EmployeeT. 05 Emp-No-T pic 9(5). 05 pic x(24). 05 Ann-Sal-T pic 9(6). 05 pic x(45). fd UPayRollM. 01 EmployeeUP. 05 Emp-No-UP pic 9(5). 05 pic x(24). 05 Ann-Sal-UP pic 9(6). 05 pic x(45). fd ControlL. 01 EmployeeCL. 05 pic xx. 05 Emp-No-C pic 9(5). 05 pic x(13). 05 Old-Ann-Sal pic $ZZZ,ZZZ.99. 05 pic x(13). 05 New-Ann-Sal pic $ZZZ,ZZZ.99. 05 pic x(8). 05 Action pic x(16). working-storage section. 01 activeKey pic xxxxx. 01 trans-key pic 99999 value 0. 01 masterkey pic 99999 value 0. 01 endofilem pic xxx value 'NO'. 01 endofilet pic xxx value 'NO'. * 01 END-OF-FILES pic xxx value 'NO'. 01 DateOfDoc. 05 CurrentYear pic 9(4). 05 CurrentMonth pic 99. 05 CurrentDate pic 99. 01 LINECOUNT PIC 99 VALUE 0. 01 updated pic xxx value 'YES'. 01 Header. 05 pic x(18) value spaces. 05 pic x(34) value 'CONTROL LISTING FOR PAYROLL UPDATE'. 05 pic x(4) value spaces. 05 fullDate. 10 date1 pic 99. 10 pic x value '/'. 10 month2 pic 99. 10 pic x value '/'. 10 year2 pic 9(4). 05 pic x(3) value spaces. 05 pic xxxx value 'Page'. 05 pic x value Spaces. 05 PageNum pic 99 value 1. 01 HEADER2. 05 PIC X(12) VALUE "EMPLOYEE NO.". 05 pic x(8) value spaces. 05 pic x(22) value "PREVIOUS ANNUAL SALARY". 05 PIC XX VALUE SPACES. 05 PIC X(17) VALUE "NEW ANNUAL SALARY". 05 PIC XXXX VALUE SPACES. 05 PIC X(12) VALUE "ACTION TAKEN". procedure division. 100-main. open input PayRollT PayRollM output ControlL UPayRollM PERFORM 600-PRINTHEADER perform 205-ReadPayRollT perform 200-ReadPayRollM * perform 310-choosekey perform 500-compare until activeKey = HIGH-values CLOSE PayRollT PayRollM UPayRollM ControlL goback. 200-ReadPayRollM. * if not endofilem = 'YES' then READ PayRollM at end Display "END M" display emp-no Move 'YES' to endofilem not AT END Display "Employee: " Employee END-READ * end-if . 205-ReadPayRollT. * if not endofilet = 'YES'then READ PayRollT At end Display "END T" display emp-no-t move 'YES' to endofilet not AT END Display "EmployeeT: " EmployeeT END-READ * end-if . 300-Update. * Display "up" Move spaces to EmployeeUP Move EMp-No-T to EMp-No-Up Move Ann-Sal-T to Ann-Sal-UP write EmployeeUP perform 400-cont. 305-copy. Move spaces to EmployeeUP Move EMp-No to EMp-No-Up Move Ann-Sal to Ann-Sal-UP write EmployeeUP. * 310-choosekey. * if emp-no < emp-no-t then * move emp-no-t to masterkey * move emp-no to trans-key * move emp-no-t to activekey * else if emp-no > emp-no-t then * move emp-no to masterkey * move emp-no-t to trans-key * move emp-no to activekey * end-if * end-if Display trans-key " : " masterkey " : " activekey . 400-cont. * Display "CL" Move spaces to EmployeeCL if updated = 'YES' then Move "Record UPdated" to Action Move Ann-Sal to old-ann-sal else Move "New Record Added" to action move 0 to old-ann-sal end-if Move Emp-No-T to Emp-No-C Move ann-sal-t to new-ann-sal * Display "Updated: " Updated write EmployeeCL ADD 1 TO LINECOUNT. 500-compare. if endofilet = 'YES' and endofilem = 'YES' then move high-values to activekey else Display "in" Display "files: " endofilet " : " endofilem if emp-no < emp-no-t then Display "Fisrt" if endofilem = 'YES' then Move 'NO' to updated perform until endofilet = 'YES' perform 300-update perform 205-readpayrollt end-perform else perform until emp-no >= emp-no-t perform 305-copy perform 200-readpayrollm end-perform end-if else if emp-no > emp-no-t then Display "Second" if endofilet = 'YES' then perform until endofilem = 'YES' perform 305-copy perform 200-readpayrollm end-perform else Move 'NO' to updated perform 300-update perform 205-readpayrollt end-if else if emp-no = emp-no-t then * if not ann-sal = ann-sal-t then Move 'YES' to updated Display "third" perform 300-update * else * perform 305-copy * end-if perform 205-readpayrollt perform 200-readpayrollm * else * if emp-no-t > emp-no then * Display "fourth" * Move 'NO' to updated * perform until endofilet = 'YES' * perform 300-update * perform 205-readpayrollt * end-perform * else if emp-no > emp-no-t then * Display "fifth" * perform until endofilem = 'YES' * perform 305-copy * perform 200-readpayrollm * end-perform end-if end-if. 600-printHeader. Move Function Current-Date to DateOfDoc Move CurrentDate to date1 Move CurrentMonth to month2 Move CurrentYear to year2 if linecount >= 30 then Add 1 to PageNum Move 0 to linecount end-If if linecount = 0 then Move Header to eMPLOYEECL write EMPLOYEECL After advancing page Move spaces to EMPLOYEECL write EMPLOYEECL end-if Move Header2 to EMPLOYEECL Write EMPLOYEECL end program Program1.