Advertisement
abbyjones72

Untitled

Dec 12th, 2019
3,413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 2.21 KB | None | 0 0
  1.       ******************************************************************
  2.       * Author: ABBY JONES
  3.       * Date: 11DEC2019
  4.       * Purpose: LEARNING
  5.       * Tectonics: cobc
  6.       ******************************************************************
  7.        IDENTIFICATION DIVISION.
  8.        PROGRAM-ID. EMPLOYEE-WAGES.
  9.        ENVIRONMENT DIVISION.
  10.        INPUT-OUTPUT SECTION.
  11.        FILE-CONTROL.
  12.            SELECT EMPLOYEE-DATA ASSIGN TO "C:/Users/abbyr/EMP-DAT".
  13.            SELECT PAYROLL-LISTING ASSIGN TO PRINTER.
  14.        DATA DIVISION.
  15.        FILE SECTION.
  16.        FD  EMPLOYEE-DATA.
  17.        01  EMPLOYEE-RECORD.
  18.            05  EMPLOYEE-NAME-IN        PICTURE X(20).
  19.            05  HOURS-WORKED-IN         PICTURE 9(2).
  20.            05  HOURLY-RATE-IN          PICTURE 9V99.
  21.        FD  PAYROLL-LISTING.
  22.        01  PRINT-REC.
  23.            05                          PICTURE X(20).
  24.            05  NAME-OUT                PICTURE X(20).
  25.            05                          PICTURE X(10).
  26.            05  HOURS-OUT               PICTURE 9(2).
  27.            05                          PICTURE X(8).
  28.            05  RATE-OUT                PICTURE 9.99.
  29.            05                          PICTURE X(6).
  30.            05  WEEKLY-WAGES-OUT        PICTURE 999.99.
  31.        WORKING-STORAGE SECTION.
  32.        01  ARE-THERE-MORE-RECORDS      PICTURE XXX VALUE "YES".
  33.        PROCEDURE DIVISION.
  34.        100-MAIN-MODULE.
  35.            OPEN INPUT EMPLOYEE-DATA
  36.                OUTPUT PAYROLL-LISTING
  37.            PERFORM UNTIL ARE-THERE-MORE-RECORDS = "NO "
  38.                READ EMPLOYEE-DATA
  39.                    AT END
  40.                        MOVE "NO " TO ARE-THERE-MORE-RECORDS
  41.                    NOT AT END
  42.                        PERFORM 200-WAGE-ROUTINE
  43.                END-READ
  44.            END-PERFORM
  45.            CLOSE EMPLOYEE-DATA
  46.                  PAYROLL-LISTING.
  47.             STOP RUN.
  48.        200-WAGE-ROUTINE.
  49.            MOVE SPACES TO PRINT-REC
  50.            MOVE EMPLOYEE-NAME-IN TO NAME-OUT
  51.            MOVE HOURS-WORKED-IN TO HOURS-OUT
  52.            MOVE HOURLY-RATE-IN TO RATE-OUT
  53.            MULTIPLY HOURS-WORKED-IN BY HOURLY-RATE-IN
  54.                     GIVING WEEKLY-WAGES-OUT
  55.            WRITE PRINT-REC.
  56.        END PROGRAM EMPLOYEE-WAGES.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement