Easytrieve Multiplication Operator (*)

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.

Progress0 of 0 lessons

Basic Syntax

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.

text
1
2
3
BONUS = GROSS * 0.05 TAX = GROSS * TAX-RATE ROUNDED PAY = (REG-HRS + OT-HRS) * HOURLY-RATE

Percentage Patterns

Common rate literals
LiteralMeaningExample
0.05Five percentBONUS = GROSS * 0.05
0.10Ten percentTAX = GROSS * 0.10
0.075Seven and half percentSTATE = GROSS * 0.075
1.5One and half timesOT-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.

Precedence Over Addition

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.

Intermediate Field Sizing

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.

text
1
2
3
DEFINE PROD-HOLD W 11 P 4 PROD-HOLD = GROSS * TAX-RATE TAX-AMT = PROD-HOLD ROUNDED

ROUNDED on Multiply Assignment

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.

Hours Times Rate

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.

Multiply by Zero

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.

Multiply in IF Conditions

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.

Relation to Division

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.

Common Multiplication Mistakes

  • Literal 10 instead of 0.10 for ten percent.
  • Undersized target after product.
  • Missing ROUNDED on currency tax line.
  • Wrong precedence with add—use parens.
  • Multiply on unvalidated FILE packed field.
  • Confusing * with exponentiation **.

Explain It Like I'm Five

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.

Exercises

  1. Compute five percent bonus with ROUNDED.
  2. Evaluate A + B * C for sample values by hand.
  3. Size PROD-HOLD for two P 2 operands multiply.
  4. Write OT pay with rate times 1.5 factor.
  5. IF condition testing ten percent gross against limit.

Quiz

Test Your Knowledge

1. BONUS = GROSS * 0.05 multiplies gross by:

  • Five percent when 0.05 is rate literal
  • Five dollars always
  • Zero
  • Compile error

2. In A + B * C multiplication runs:

  • Before addition
  • After addition
  • Never
  • Only in IF

3. PAY = HOURS * RATE computes:

  • Product of hours and rate fields
  • Sum
  • String concat
  • File status

4. Product of two P 2 fields may need:

  • Wider intermediate field before ROUNDED into target
  • Alphabetic target
  • JCL change
  • No storage

5. ROUNDED on TAX = GROSS * RATE:

  • Rounds product when storing into target
  • Rounds GROSS only
  • Skips multiply
  • JCL only
Published
Read time15 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 multiplication operator in assignmentSources: Broadcom Easytrieve 11.6 Language Reference arithmetic operatorsApplies to: Easytrieve multiplication operator