The asterisk is the multiplication operator. It scales a value—gross times tax rate, hours times pay rate, quantity times unit price—or forms products of two numeric fields. Percentage calculations dominate beginner payroll: BONUS = GROSS * 0.05 applies five percent when literal expresses decimal rate. Multiplication binds tighter than addition and subtraction, so A + B * C computes B * C before adding A unless parentheses override. Products widen numeric magnitude and decimal precision—multiplying two P 2 fields can need four decimal places internally before ROUNDED into P 2 target. Overflow in undersized intermediate field corrupts results silently or abends. This page teaches rate literals versus rate fields, hours-times-rate patterns, intermediate hold sizing, ROUNDED assignment, multiply in IF conditions, and divide relationship for average recovery.
TARGET = operand1 * operand2. PAY = HOURS * RATE. TAX = GROSS * TAX-RATE. Literal 0.10 means multiply by one-tenth—ten percent. Literal 10 means multiply by ten—not ten percent. Beginners confuse 0.10 versus 10—document rate conventions in program header comments.
123BONUS = GROSS * 0.05 TAX = GROSS * TAX-RATE ROUNDED PAY = (REG-HRS + OT-HRS) * HOURLY-RATE
| Literal | Meaning | Example |
|---|---|---|
| 0.05 | Five percent | BONUS = GROSS * 0.05 |
| 0.10 | Ten percent | TAX = GROSS * 0.10 |
| 0.075 | Seven and half percent | STATE = GROSS * 0.075 |
| 1.5 | One and half times | OT-PAY = BASE * 1.5 |
Rate fields TAX-RATE W 3 P 4 may store 0.0825 for eight and quarter percent—multiply GROSS * TAX-RATE without literal. VALUE on DEFINE can seed default rate. Rates change by tax year—field rate easier to update than recompile literals when driven from parm dataset in advanced patterns.
RESULT = A + B * C evaluates B * C first. NET = GROSS + BONUS * PCT adds bonus product to gross—not gross plus bonus times pct unless grouped: NET = (GROSS + BONUS) * PCT for different business rule. IF GROSS * 0.10 GT LIMIT multiplies before GT comparison. Parentheses document intent when mixing operators.
DEFINE PROD-HOLD W 11 P 4 before TAX = GROSS * RATE ROUNDED into W 7 P 2 TAX. Multiplying 9999999.99 by 0.9999 needs digit room—product hold wider than operands prevents overflow. Rule of thumb: hold digits sum of operand integer digits plus decimal places plus guard.
123DEFINE PROD-HOLD W 11 P 4 PROD-HOLD = GROSS * TAX-RATE TAX-AMT = PROD-HOLD ROUNDED
Currency tax lines often use ROUNDED: TAX = GROSS * RATE ROUNDED stores cents per policy. Without ROUNDED, extra fraction digits truncate or convert per default rules—penny drift across thousands of employees matters. Match ROUNDED usage to COBOL legacy if migrating parallel systems.
PAY = HOURS * RATE classic timecard. OT-PAY = OT-HRS * RATE * 1.5 chains two multiplies— evaluate left to right at same * precedence: (OT-HRS * RATE) * 1.5. Parentheses clarify OT = OT-HRS * (RATE * 1.5) when rate already includes factor—different shop rules.
PRODUCT = AMOUNT * 0 yields zero—valid. IF RATE EQ 0 may guard before downstream divide by rate. Zero gross times rate yields zero tax—branch may skip PUT detail line.
IF GROSS * 0.10 GT LIMIT tests whether ten percent of gross exceeds limit—common tier bonus gate. Ensure GROSS NUMERIC before multiply in condition on FILE data. Display GROSS * 0.10 in debug only via assignment to hold—IF cannot DISPLAY inline product without prior assign in classic batch.
Multiply and divide share precedence level—left to right among them. A / B * C may parse as (A / B) * C. Recover original from percent: if TAX = GROSS * RATE then GROSS = TAX / RATE when RATE non-zero—division page covers guard.
Times means copies of a pile. Three times four is four added three times. Percent is a special small times number—0.10 times your dollars means ten cents per dollar. Times goes before plus unless parentheses say do the plus part first. The answer box must be big enough for the big pile you get.
1. BONUS = GROSS * 0.05 multiplies gross by:
2. In A + B * C multiplication runs:
3. PAY = HOURS * RATE computes:
4. Product of two P 2 fields may need:
5. ROUNDED on TAX = GROSS * RATE: