apthorpe

Mystery COBOL example code

Apr 10th, 2020
779
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         IDENTIFICATION DIVISION.
  2.         PROGRAM-ID. sample_1nn.
  3.         ENVIRONMENT DIVISION.
  4.         INPUT-OUTPUT SECTION.
  5.         FILE-CONTROL. SELECT EMPLOYEE-DATA    ASSIGN TO "EMP.DAT".
  6.                       SELECT PAYROLL-LISTING  ASSIGN TO "PAY.OUT".
  7.         DATA DIVISION.
  8.         FILE SECTION.
  9.         FD  EMPLOYEE-DATA.
  10.         01  EMPLOYEE-RECORD.
  11.             05  EMPLOYEE-NAME-IN    PICTURE X(20).
  12.             05  HOURS-WORKED-IN     PICTURE 9(2).
  13.             05  HOURLY-RATE-IN      PICTURE 9V99.
  14.         FD  PAYROLL-LISTING.
  15.         01  PRINT-REC.
  16.             05                      PICTURE X(20).
  17.             05  NAME-OUT            PICTURE X(20).
  18.             05                      PICTURE X(10).
  19.             05  HOURS-OUT           PICTURE 9(2).
  20.             05                      PICTURE X(8).
  21.             05  RATE-OUT            PICTURE 9.99.
  22.             05                      PICTURE X(6).
  23.             05  WEEKLY-WAGES-OUT    PICTURE 999.99.
  24.         WORKING-STORAGE SECTION.
  25.         01  ARE-THERE-MORE-RECORDS  PICTURE XXX VALUE 'YES'.
  26.         PROCEDURE DIVISION.
  27.         100-MAIN-MODULE.
  28.             OPEN INPUT EMPLOYEE-DATA
  29.                  OUTPUT PAYROLL-LISTING
  30.             PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO '
  31.                 READ EMPLOYEE-DATA
  32.                     AT END
  33.                         MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
  34.                     NOT AT END
  35.                         PERFORM 200-WAGE-ROUTINE
  36.                 END-READ
  37.             END-PERFORM
  38.             CLOSE EMPLOYEE-DATA
  39.                   PAYROLL-LISTING
  40.             STOP RUN.
  41.         200-WAGE-ROUTINE.
  42.             MOVE SPACES TO PRINT-REC
  43.             MOVE EMPLOYEE-NAME-IN TO NAME-OUT
  44.             MOVE HOURS-WORKED-IN  TO HOURS-OUT
  45.             MOVE HOURLY-RATE-IN   TO RATE-OUT
  46.             MULTIPLY HOURS-WORKED-IN BY HOURLY-RATE-IN
  47.                 GIVING WEEKLY-WAGES-OUT
  48.             END-MULTIPLY
  49.             WRITE PRINT-REC
  50.             END-WRITE.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×