Previous Topic: What You Can DoNext Topic: Directing Processing Flow


Demonstration

Objective

This report compares employee annual earnings to a base of $19,000. Employees earning more than the base amount are considered salaried; those earning less are considered hourly. The report calculates an hourly wage for all nonsalaried employees.

Testing and calculations for this report are on type 7 parameters.

Parameters

01OUT D

D suppresses totals

010 AMOUNT DP=2

AMOUNT is a work field that holds computation results containing two decimal places.

017010 IF SALARY LE 19000 500

IF SALARY LE 19000 500 is a conditional statement that tests for a range less than or equal to 19000. If the test is true, pro- cessing skips to line 500 of the type 7 parameters. If not true, the type 7 state- ments are processed in sequence until TAKE is executed.

017 MOVE 'SALARIED' TO MESSAGE

MOVE 'SALARIED' TO MESSAGE places SALARIED in the MESSAGE work field when SALARY is greater than 19000.

017 MOVE SALARY TO AMOUNT

MOVE SALARY TO AMOUNT places the salary amount in the work field.

017 TAKE

TAKE causes all the type 5 parameter fields to be written to a work file (the extract file) for use in later processing.

017500 MOVE 'HOURLY ' TO MESSAGE

MOVE 'HOURLY ' TO MESSAGE places the word HOURLY in the MESSAGE work field when the salary is less than 19000.

017 COMPUTE (SALARY / 52) / 40 AMOUNT

COMPUTE specifies a two-step computation. The result is placed in the AMOUNT work field.

TAKE

This is an implied TAKE that causes all type 5 fields to be written to a work file (the extract file) for use in later processing. This TAKE is supplied by CA Culprit; it is not required in the code.

Complete Code

col. 2
▼
IN 200 F 400 PS(TAPE)
REC EMPLOYEE        5   25
REC LAST-NAME      15   15
REC DEPARTMENT    115   25
REC SALARY        160    5  3  DP=2
01OUT  D
01SORT LAST-NAME
013 EMPLOYEE COMPENSATION STATUS
010 MESSAGE '        '
010 AMOUNT DP=2
0151*010 EMPLOYEE SZ=20    HH 'EMPLOYEE' 'NAME'
0151*020 MESSAGE           HH 'STATUS'
0151*030 AMOUNT SZ=10  F$  HH 'SALARY'
017010 IF SALARY LE 19000 500
017    MOVE 'SALARIED' TO MESSAGE
017    MOVE SALARY TO AMOUNT
017    TAKE
017500 MOVE 'HOURLY  ' TO MESSAGE
017    COMPUTE (SALARY / 52) / 40  AMOUNT

Result

REPORT NO. 01        EMPLOYEE COMPENSATION STATUS    mm/dd/yy PAGE     1                              EMPLOYEE                                NAME                               STATUS                           SALARY                        ROY       ANDALE                          SALARIED                          $33,500.00                        MICHAEL   ANGELO                          HOURLY                                 $8.65                        HARRY     ARM                             SALARIED                          $46,000.00                        MONTE     BANK                            SALARIED                          $80,000.00                        JUNE      BLOOMER                         HOURLY                                 $7.21                        CHARLES   BOWER                           SALARIED                          $38,500.00                        C.        BREEZE                          SALARIED                          $38,000.00                        RALPH     TYRO                            SALARIED                          $20,000.00                        RICHARD   WAGNER                          SALARIED                          $47,000.00                        ROGER     WILCO                           SALARIED                          $80,000.00                        ROBBY     WILDER                          SALARIED                          $90,000.00                        BETSY     ZEDI                            SALARIED                          $37,000.00