Easytrieve Numeric Functions Index

Numeric built-ins and modifiers handle magnitude, bounds, sign, and decimal control on quantitative fields—types N and P with optional implied decimals. ABS supports variance and tolerance checks. MIN and MAX cap or floor values in one expression. Assignment modifiers INTEGER, ROUNDED, and TRUNCATED govern how fractional digits store on assign—not separate function calls but essential numeric toolkit alongside ABS. Payroll and finance jobs depend on correct P scale through expressions; audit finds penny drift when ROUNDED is omitted on tax chains. This index lists numeric capabilities, contrasts function calls with assignment modifiers, explains sign and compare patterns, and separates numeric from math category for roots and logarithms. Verify function names on your Application Reference— Report Generator sites may use operators and modifiers alone without MIN MAX builtins.

Progress0 of 0 lessons

Numeric Types and Scale

DEFINE and FILE describe length, type N packed P or binary B, and decimal count. P 5 2 holds values up to five digits with two after implied decimal—999.99 range pattern. Assignment and functions preserve scale unless INTEGER truncates fractional portion. Mixing P 2 and N 5 in expression promotes per compiler—test boundary amounts .005 for rounding behavior.

Numeric Capabilities Index

Numeric operations index
OperationMechanismExample pattern
Absolute valueABS(expr)WS = ABS(BUDGET - ACTUAL)
MinimumMIN(a, b)APPR = MIN(REQ, LIMIT)
MaximumMAX(a, b)FLOOR = MAX(CALC, 0)
Round on assignROUNDED keywordTAX = GROSS * RATE ROUNDED
Truncate on assignTRUNCATED keywordUNITS = QTY TRUNCATED
Integer portionINTEGER keywordWHOLE = AMT INTEGER
Sign testIF LT 0 / IF GT 0IF BALANCE LT 0 overdraft
AccumulateSUM or = TOTAL + AMTRunning totals in JOB

ABS Absolute Value

Variance reporting: DELTA = ACTUAL - BUDGET then IF ABS(DELTA) GT LIMIT flags material difference regardless of direction. Tolerance bands on measurement error use ABS on instrument reading minus standard. Nested ABS is redundant except obfuscation—ABS(ABS(x)) equals ABS(x). Result field should match source scale for currency.

text
1
2
3
4
5
DELTA = ACTUAL - BUDGET IF ABS(DELTA) GT Tolerance PRINT VARIANCE-EXCEPTION END-IF

MIN and MAX

MIN caps request at policy limit: APPROVED = MIN(REQUEST-AMT, POLICY-LIMIT). MAX floors calculated discount at zero: DISCOUNT = MAX(RAW-DISC, 0) preventing negative discount storage. Multi-argument MIN if documented—else nest MIN(MIN(A,B),C). When builtins unavailable, IF REQUEST GT LIMIT assign LIMIT else REQUEST duplicates logic—prefer MIN when readable on your release.

INTEGER Modifier

Broadcom assignment documentation: INTEGER transfers numerics left of decimal point, ignoring fractional portion per rules. Combined with ROUNDED, rounding occurs before integer extraction. Combined with TRUNCATED default, truncation applies. Valid only on numeric fields—compile error on alphabetic target. Use for whole-unit reporting from fractional calculations.

ROUNDED and TRUNCATED

ROUNDED applies standard rounding to assignment result before store into receive field width. TRUNCATED drops low-order digits that do not fit—default truncation behavior when neither keyword specified varies—document shop standard. Tax and interest chains must use consistent modifier across programs reconciling to general ledger. Penny difference at .005 boundary is classic test case.

text
1
2
3
4
GROSS = HOURS * RATE ROUNDED TAX = GROSS * TAX-RATE ROUNDED NET = GROSS - TAX WHOLE-QT = QTY INTEGER

Sign Handling Without ABS

IF AMOUNT LT 0 detects negative only. IF AMOUNT GT 0 positive only. IF AMOUNT NE 0 non-zero. Two-branch IF replaces ABS compare when direction matters—overpayment versus underpayment different exception codes. ABS simplifies symmetric tolerance.

Numeric Compare and EQ THRU

Relational operators on numeric fields use magnitude with implied decimal. EQ THRU defines inclusive band—IF SCORE EQ 60 THRU 79. Combine with ABS for distance from target: ABS(SCORE - TARGET) LE 5 for near-miss band. Numeric category functions do not replace relational operators—they complement expression computation before compare.

Overflow and Field Length

Sum exceeding receive field length truncates or abends per options—size W totals wider than detail amounts. MIN MAX results fit narrower field if operands fit—verify compile warnings. Increase W define length for accumulators in high-volume money jobs.

Numeric Versus Math Category

Numeric covers everyday business—ABS MIN MAX rounding. Math covers roots, powers beyond simple **, logarithms—statistical jobs. Payroll rarely needs SQRT; variance uses ABS in numeric category. Route advanced transcendental needs to math index.

Common Numeric Mistakes

  • Omitting ROUNDED on tax chain causing ledger mismatch.
  • ABS on alphabetic field—type error.
  • INTEGER when policy requires ROUNDED first.
  • Comparing P 2 to N 5 without testing promotion.
  • MIN MAX unavailable assumed—compile fail on Report Generator.
  • Accumulator field too short for million-record SUM.

Explain It Like I'm Five

Numeric tools measure money and counts. ABS asks how far from zero without caring if below or above. MIN picks the smaller allowance so you never approve too much. ROUNDED is rounding pennies fairly when splitting a bill. TRUNCATED is cutting extra decimal crumbs off without rounding up. These tools keep number boxes the right size and fairness for money math.

Exercises

  1. Write IF ABS(ACTUAL - PLAN) GT 100 exception filter.
  2. Cap REQUEST at 5000 using MIN pattern.
  3. Assign tax with ROUNDED and explain .005 test case.
  4. Contrast INTEGER versus ROUNDED on same fractional input.
  5. Describe when sign-specific IF beats ABS tolerance.

Quiz

Test Your Knowledge

1. ABS(VARIANCE) returns:

  • Magnitude without sign
  • Always negative
  • Alphabetic edit
  • File status

2. INTEGER on assignment:

  • Transfers whole number portion per manual
  • Adds one
  • Opens file
  • Sorts records

3. ROUNDED versus TRUNCATED on currency assignment:

  • ROUNDED rounds; TRUNCATED drops excess decimals
  • Identical always
  • Only for A fields
  • JCL parameters

4. IF ABS(DELTA) GT TOLERANCE detects:

  • Variance exceeding limit either direction
  • Only positive delta
  • Only negative delta
  • Compile error

5. MIN(REQUEST, LIMIT) selects:

  • Smaller of two values
  • Larger value
  • Sum
  • Average only
Published
Read time16 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 assignment INTEGER ROUNDED TRUNCATED; ABS MIN MAX per Application ReferenceSources: Broadcom Easytrieve Report Generator 11.6 Assignment Statement documentationApplies to: Easytrieve numeric functions and assignment modifiers