Formatting functions answer how should this number look on the report—not what is its mathematical value. Internal payroll files store GROSS as packed decimal with implied decimals; recipients expect 1,234.56 on paper, not hex nibbles. Easytrieve formatting builtins and EDIT-style masks translate storage form into display form: commas, dollar signs, leading zeros suppressed, negative amounts in parentheses or with minus sign, dates as MM/DD/YYYY instead of packed CCYYMMDD. Beginners often PRINT packed fields directly and wonder why columns misalign or show unreadable characters. Separate calculation fields from display fields: compute in P or N types, format into A fields, PRINT the A field. Broadcom Easytrieve Plus Application Reference indexes formatting functions separately from conversion functions because the task differs—pretty output versus type change. This index catalogs formatting families, typical picture characters, assignment keywords like ROUNDED that interact with display, report column alignment patterns, common overflow asterisks, and when procedural MOVE with manual literals beats a function call on sites with limited catalogs.
Batch Easytrieve jobs read files, compute totals, write reports. Numeric integrity lives in packed fields through arithmetic. Formatting is the last mile before human eyes or downstream systems expecting character layouts. TITLE lines show run dates formatted pleasantly. LINE statements list currency right-aligned via edited strings. DISPLAY during development shows readable diagnostics without attaching a hex dump tool. Skipping formatting produces technically correct numbers in wrong clothes—auditors reject reports even when totals reconcile.
The EDIT family—exact invocation spelling varies by release—applies a picture string to a numeric source. Picture characters mirror COBOL conventions: 9 for digit, Z for zero suppress, comma and period as punctuation, $ or currency symbol, S or CR for sign control. A mask Z,ZZZ,ZZ9.99- turns 1234567.8 into 1,234,567.80- when field width accommodates output. Masks must be wide enough; overflow often prints asterisks filling the field—a signal to widen OUT-AMT A 20 before blaming arithmetic.
12345* Illustrative pattern—verify EDIT syntax on your compiler GROSS-EDIT = EDIT(GROSS, 'ZZ,ZZZ,ZZ9.99') NET-EDIT = EDIT(NET, '$$$,$$$,$$9.99CR') LINE GROSS-EDIT NET-EDIT EMP-NAME
| Family | Purpose | Typical use |
|---|---|---|
| Numeric EDIT | Apply picture to packed/zoned amount | Report currency columns |
| Date format | Render date field as text layout | TITLE run date, audit headers |
| Time format | Render time-of-day strings | Batch timestamp on SYSPRINT |
| Sign control | Leading minus, parentheses, CR/DR | Accounting debit/credit display |
| Zero fill / suppress | Leading zeros on codes | Check numbers, control IDs |
Each picture character controls one aspect of output. Combining them builds the display template. Wrong character in one position shifts every column right on the report.
| Character | Meaning | Effect on output |
|---|---|---|
| 9 | Digit position | Always shows digit; leading zero may appear unless Z used |
| Z | Zero suppress | Suppresses leading zeros in that position |
| , | Thousands separator | Inserts comma in fixed position of mask |
| . | Decimal point | Aligns implied decimal with display decimal |
| $ | Currency symbol | Places dollar sign per mask template |
| - | Sign trailing | Minus sign after amount for negatives |
| CR / DR | Credit/debit | Accounting notation for signed amounts |
Define GROSS P 2 for math. Define GROSS-DISP A 18 for EDIT output. After NET = GROSS - TAX, assign GROSS-DISP = EDIT(GROSS, mask). Never round-trip: editing NET into a display field then adding tax back in arithmetic without reconverting corrupts totals. Report LINE lists GROSS-DISP; internal SUM accumulators stay numeric. This pattern prevents the most common formatting bug—accidentally using edited strings in IF GROSS GT LIMIT comparisons where collating order replaces numeric order.
JOB procedural logic prepares working display fields before PRINT selects records. REPORT LINE may reference those fields by name. Some releases allow edit specifications on LINE directly; others require pre-formatted Library fields. TITLE often concatenates literals with formatted date fields: TITLE 'PAYROLL AS OF ' RUN-DATE-EDIT. Keep TITLE within LINESIZE; long masks widen lines and wrap unexpectedly when LINESIZE is tight.
P 2 stores cents in the last two digit positions. Mask must include two 9 or Z positions after decimal point for cents to appear. P 0 amounts need no decimal portion in mask—or use .99 only when policy shows fractional dollars. Misaligned implied decimal produces 100x errors visible only on formatted output while packed math remains internally consistent—a dangerous split-brain state during debugging.
European sites may swap comma and period roles in masks. Legacy programs hard-code dollar sign when multi-currency was not required. When migrating, grep all EDIT masks and verify against business requirements document—not just compile success. EBCDIC display characters for currency differ from ASCII tools used in open-systems editors; test on z/OS spool or viewer matching production code page.
Formatting per record on million-row files adds CPU versus printing raw packed—but human reports require it. Hoist run-date formatting once before JOB loop. Avoid re-editing unchanged fields inside inner IF chains. Cache formatted department name when DEPT code maps to long text via table lookup plus format step. I/O still dominates runtime; clarity of separate DISP fields saves more maintainer time than micro-optimizing EDIT calls.
Formatting is dressing up numbers for a photo. The amount in the piggy bank is the real number. The label you stick on the jar—with dollar sign, commas, and two decimal places—is formatting so grown-ups can read it quickly. You do not pay for candy using the label; you use the coins inside. Easytrieve keeps coins in packed fields and makes labels in character fields before showing them on the report picture.
1. Formatting functions primarily prepare values for:
2. EDIT-style formatting in Easytrieve resembles:
3. Formatting should occur when:
4. Assigning formatted value back into packed arithmetic field without conversion:
5. Formatting function availability: