The Timely Talent temporary Help Agency maintains an employee master file that c
ID: 3689091 • Letter: T
Question
The Timely Talent temporary Help Agency maintains an employee master file that contains an employee Id number, last name, first name, address, and hourly rate for each temporary worker. The file has been sorted in employee ID number order. Each week, a trasaction file is created with a job number, address, customer name, employee ID, and hours worked for every job filled by Timely Talent workers. the transaction file is also sorted in employee ID order. a. Design the logic for a program that matches the current week's transaction file records to the master file and outputs one line for each transaction, indicating job number, employee ID number, hours worked, hourly rate, and gross pay. Assume that each temporary worker works at most one job per week. Output one line for each worker, even if the worker has completed no jobs during the current week. b. Modify the help agency program to output lines only for workers who have completed at least one job during the current week. c. Modify the help agency program so that any temporary worker can work any number of seperate jobs during the week. Output one line for each job that week. d. Modify the help agency program so that it accumulates the worker's total pay for all jobs in a week and outputs one line per worker.
Explanation / Answer
IDENTIFICATION DIVISION.
PROGRAM-ID. FILCMPR.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
OBJECT-COMPUTER. IBM-390.
SOURCE-COMPUTER. IBM-390.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT MASTFIL ASSIGN TO DD1
FILE STATUS IS FS1.
SELECT TRANFIL ASSIGN TO DD2
FILE STATUS IS FS2.
SELECT MCHFILE ASSIGN TO DD3
FILE STATUS IS FS3.
DATA DIVISION.
FILE SECTION.
FD MASTFIL.
01 MASREC.
05 EID1 PIC X(05).
05 FILLER PIC X(01).
05 EFNAME1 PIC X(06).
05 FILLER PIC X(01).
05 ELNAME1 PIC X(06).
05 FILLER PIC X(01).
05 ESAL1 PIC 9(05).
05 FILLER PIC X(55).
FD TRANFIL.
01 TRANREC.
05 JOBNUM PIC 9(05).
05 FILLER PIC X(01).
05 JOBADD PIC X(20).
05 FILLER PIC X(01).
05 CUSNAME PIC X(20).
05 FILLER PIC X(01).
05 W_EID PIC X(05).
05 FILLER PIC X(01).
05 HRS_WRK PIC 99.99.
05 FILLER PIC X(24).
WORKING-STORAGE SECTION.
01 FS1 PIC X(02).
01 FS2 PIC X(02).
01 FS3 PIC X(02).
01 SWITCH1 PIC X(01).
88 EOF1 VALUE 'Y'.
88 NOT-EOF1 VALUE 'N'.
01 SWITCH2 PIC X(01).
88 EOF2 VALUE 'Y'.
88 NOT-EOF2 VALUE 'N'.
01 WS-MASREC.
05 WS-EID PIC X(05).
05 FILLER PIC X(01).
05 WS-EFNAME1 PIC X(06).
05 FILLER PIC X(01).
05 WS-ELNAME1 PIC X(06).
05 FILLER PIC X(01).
05 WS-ESAL1 PIC 9(05).
05 FILLER PIC X(55).
01 WS-TRANREC.
05 WS-JOBNUM PIC 9(05).
05 FILLER PIC X(01).
05 WS-JOBADD PIC X(20).
05 FILLER PIC X(01).
05 WS-CUSNAME PIC X(20).
05 FILLER PIC X(01).
05 WS-W_EID PIC X(05).
05 FILLER PIC X(01).
05 WS-HRS_WRK PIC 99.99.
05 FILLER PIC X(24).
PROCEDURE DIVISION.
SET NOT-EOF1 TO TRUE
PERFORM OPEN-PARA.
PERFORM READ-PARA UNTIL EOF1.
PERFORM CLOSE-PARA.
STOP RUN.
OPEN-PARA.
OPEN INPUT MASTFIL.
OPEN INPUT TRANFIL.
DISPLAY ' MASTFIL OPEN STATUS ' FS1.
DISPLAY ' TRANFIL OPEN STATUS ' FS2.
READ-PARA.
IF FS1 = '00' && FS2 = '00
READ TRANFILE
AT END
SET EOF2 TO TRUE
NOT AT END
MOVE W_EID1 TO WS-EID1
MOVE TRANREC TO WS-TRANREC
SET NOT-EOF2 TO TRUE
PERFORM DISPLAY_PARA1
PERFORM DISPLAY_PARA2
PERFORM CLOSE-OUT-PARA
END-READ
END-IF.
DISPLAY_PARA1.
DISPLAY " EMPLOYEE NAME IS ' WS-EID1.
DISPLAY " EMPLOYEE JOB ID ' WS-JOBNUM.
DISPLAY " HOURS WORKED ' WS-HRS_WRK.
READ MASTFIL UNTIL EOF1
IF WS-EID = EID1
MOVE EFNAME1 TO WS-EFNAME1
MOVE ELNAME1 TO WS-ELNAME1
MOVE ESAL1 TO WS-ESAL1
END-IF.
WS-ESAL1 = WS-ESAL1 * WS-HRS-WRK.
DISPLAY " WEAKLY WAGES FOR EMPLOYEE IS ' WS-ESAL1.
DISPLAY_PARA2.
READ MASTFIL UNTIL EOF1
MOVE MASTREC TO WS-MASTREC
READ TRANFIL UNTIL EOF2
IF DATA_NOT_FOUND
DISPLAY " THE EMPLOYEE NEVER WORKED THIS WEEK" WS-EID1.
CLOSE-OUT-PARA.
CLOSE MASTFILE
CLOSE TRANFILE
DISPLAY ' OUTFILE CLOSE STATUS ' FS1.
DISPLAY ' MCHFILE CLOSE STATUS ' FS2.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.