Easytrieve MASK

Storage and display are different problems. A packed salary field stores nybbles efficient for arithmetic; a report row should show commas, decimal point, dollar sign, or credit indicator for humans. The MASK parameter on DEFINE attaches an edit pattern to a field name so LINE, TITLE, and DISPLAY format output without changing bytes on disk. MASK accepts a literal in quotes with digit placeholders, optional mask identifier letters A through Y for reuse, BWZ to blank zero amounts, and HEX for hexadecimal debug view. Wrong mask—too few nines for field width—truncates printed columns. Wrong mask on alphabetic field fails or misleads. This page teaches edit mask characters, standard patterns for money phone and date, negative indicators, default system masks for quantitative fields, and identifier reuse across large Library dictionaries.

Progress0 of 0 lessons

MASK Parameter Syntax

On DEFINE: MASK followed by optional identifier letter, optional BWZ, quoted literal, or HEX keyword. Examples: MASK '$$,$$9.99', MASK M 'Z9/99/99', MASK BWZ, MASK HEX. Multiple options combine per documentation—BWZ with literal suppresses all-zero formatted output entirely.

text
1
2
3
4
5
PAY-GROSS 94 4 P 2 MASK '$$,$$9.99' PHONE W 10 N MASK '(999) 999-9999' HIRE-DATE 136 6 N MASK Z 'Z9/99/99' DEBUG-FLD W 2 P MASK HEX ZERO-SUP W 5 P 2 MASK BWZ '$$,$$9.99'

Edit Mask Characters

Common edit mask characters
CharacterMeaningEffect
9One digit from field999 formats three digits
ZDigit with leading zero suppressZ9 shows 7 not 07
*Asterisk replaces leading zerosCredit protection checks
$Floating currency symbolBefore first nonzero digit
-Minus before first nonzeroNegative indicator
,Comma at mask positionSuppressed if value too small

Every digit in numeric field must have corresponding mask character—nine or Z typically. Literal punctuation like slashes and parentheses prints at fixed mask positions. Commas suppress when value magnitude does not reach that grouping level per Getting Started rules.

Money and Credit Masks

Standard money mask '$$,$$$,$$9.99' with optional CREDIT or minus at end for negative values. Protected check amount pattern '*,***,***,999.99-' uses asterisks for leading digit protection. BWZ on payroll exception lines hides zero adjustments readers might misinterpret as missing data versus intentional zero.

Standard mask patterns from Getting Started
Mask literalUsed for
'(999)999-9999'Telephone number
'999-99-9999'Social Security style grouping
'Z9/99/99'Date with slashes
'$$,$$$,$$9.99 CREDIT'Money with credit word
'-,---,--9.99'Negative number with commas

Negative Value Indicators

Mask all digit positions first, then append negative indicator at right end—minus sign, CR for credit, or DB for debit per shop standard. Indicator prints only when value negative. Field with contents -012345678 and mask ending in minus produces formatted negative display without separate IF logic on reports.

Mask Identifiers A Through Y

First field MASK M '$$,$$9.99' registers mask under letter M. Later field MASK M alone retrieves same pattern without repeating literal—reduces Library size and ensures consistent payroll formatting across dozens of amount fields. Do not assign different literals to same letter in one program. Options table may predefine site-standard mask letters.

BWZ Blank When Zero

BWZ suppresses entire formatted output when field is all zeros—useful for optional columns on dense reports. Combine BWZ with literal mask. BWZ alone also valid per DEFINE documentation. Stored value remains zero—only print line blank. IF logic still sees zero unless you also use BWZ-style display semantics only on output path.

MASK HEX

HEX displays contents in double-digit hexadecimal—essential for packed and binary debugging. Up to fifty bytes. Not allowed on VARYING fields. Pair with DISPLAY in test jobs before promoting FILE layout changes. Alphanumeric fields may use HEX where numeric masks invalid.

Default Masks Without MASK

Quantitative fields with decimal positions receive system default edit masks—commas and decimal point on totals. PAY value 1000 on P 7 2 may print with default pattern per documentation table. Override when business requires credit indicators or floating dollar signs default lacks.

MASK vs Stored Value

Assignment and file READ change stored bytes. MASK never alters storage—only output formatting path. Assigning edited display back from report to field requires separate unedit logic—not automatic reverse of mask. Report writers format at print time from raw numeric internal form.

Common MASK Mistakes

  1. Too few nines for field length and decimals—truncated print.
  2. Numeric mask on type A field—unsupported or wrong.
  3. Reusing mask letter M for two different literals.
  4. Expecting MASK to fix wrong P decimal positions.
  5. HEX on VARYING field—disallowed.

Explain It Like I'm Five

MASK is a stencil you lay on top of a number when showing it to people. The number in the box stays the same, but the stencil adds dollar signs, commas, and slashes so it looks like a check or phone number. BWZ means if the number is all zeros, show nothing—leave the line blank instead of printing zero dollars.

Exercises

  1. Add phone MASK to ten-digit N field.
  2. Define money mask with BWZ on bonus field.
  3. Register mask under letter T and reuse on second field.
  4. Explain difference between MASK and changing stored GROSS.
  5. Add MASK HEX to packed debug field.

Quiz

Test Your Knowledge

1. MASK on DEFINE primarily affects:

  • Display and print formatting
  • Stored field bytes on disk
  • JCL CLASS
  • Compile order

2. Character 9 in a numeric edit mask means:

  • Format one digit
  • Literal nine always
  • Nine bytes
  • Comment

3. BWZ on MASK means:

  • Blank when zero
  • Binary when zero
  • Bold width zero
  • Block write zone

4. MASK HEX displays field as:

  • Double-digit hexadecimal
  • Decimal only
  • Alphabetic upper case
  • Julian date

5. Mask identifiers A through Y allow:

  • Reuse named masks on other fields
  • Only one use ever
  • JCL references
  • Binary only

Related Pages

Published
Read time14 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 MASK parameter BWZ HEX identifiersSources: Broadcom Easytrieve 11.6 DEFINE Statement, Getting Started edit masksApplies to: Easytrieve MASK edit patterns on DEFINE