Default values answer a simple question before your first assignment runs: what is in the variable right now? For working storage, Easytrieve answers predictably—numeric variables start at zero, alphabetic variables start as blanks. That predictability is why beginners can code WS-COUNT W 4 N and increment immediately without a separate clearing step. FILE variables have no product default in that sense; they mirror whatever bytes the current record holds. VALUE on DEFINE replaces the product default with an explicit literal you choose at compile time. RESET makes that literal—or the product default when VALUE is absent—the restoration target at JOB boundaries. Understanding defaults by data type prevents false assumptions: a packed amount field does not default to spaces, a name field does not default to zero, and a varying name field defaults to zero length until you assign content. This page catalogs default behavior for each variable and type combination beginners encounter in batch report programs and online SCREEN activities.
| DEFINE type | Default content | Beginner notes |
|---|---|---|
| N (zoned numeric) | Numeric zero | Unsigned display numeric; safe counter start |
| P (packed decimal) | Packed zero | Implied decimal positions honored in arithmetic |
| B (binary) | Binary zero | All bits off; mind length for comparisons |
| U / I (floating) | Floating zero | Less common in classic batch; verify shop standards |
| A (alphabetic) | Spaces | Full field length filled with blank characters |
| M / K (DBCS) | Type-appropriate blank or zero fill | Double-byte rules per release; test DISPLAY |
| Varying A | Zero length | No visible characters until assignment or VALUE |
Zoned N, packed P, and binary B working storage fields without VALUE contain numeric zero at program start. For WS-TOTAL W 9 P 2, that means a packed zero with two decimal places implied—not spaces, not LOW-VALUES, not HIGH-VALUES. You can increment WS-TOTAL in the first statement of the first JOB without explicit clearing. Comparison tests behave accordingly: IF WS-TOTAL EQ 0 or IF WS-TOTAL ZERO may succeed before any assignment depending on constant usage in your shop. Contrast with FILE packed fields on input: the first READ may load non-zero garbage if the upstream file was never validated.
12345678DEFINE WS-COUNT W 6 N DEFINE WS-AMT W 7 P 2 DEFINE WS-BITS W 2 B * At program start: * WS-COUNT = 0 (zoned) * WS-AMT = 0.00 (packed) * WS-BITS = X'0000' (binary zero)
A fields initialize to spaces across the entire declared length. WS-NAME W 30 A holds thirty blank characters before any MOVE or assignment. That matters for concatenation, comparison, and report output: an empty name field prints as blanks, not zeros. Tests like IF WS-NAME EQ SPACE or IF WS-FLAG EQ ' ' evaluate against that default state. Trailing spaces in fixed-length fields are normal—not a bug—unless business rules require trimming via edit masks or string functions in advanced topics.
123456DEFINE WS-NAME W 30 A DEFINE WS-FLAG W 1 A IF WS-FLAG EQ ' ' WS-FLAG = 'N' END-IF
VALUE replaces the automatic default with a compile-time literal. DEFINE STATUS W 1 A VALUE Y starts as Y instead of blank. DEFINE RATE W 3 P 2 VALUE 7.50 starts at that packed amount instead of zero. VALUE length must fit the field definition—overlong literals cause compile errors. VALUE becomes the initial state RESET restores on W fields coded with RESET. Without RESET, VALUE still sets only the starting point at allocation; assignments during the run change the live value until the program ends.
123DEFINE ECHO-SW W 1 A VALUE 'Y' RESET DEFINE BASE-RT W 3 P 2 VALUE 8.25 DEFINE WS-CNT W 4 N VALUE 100
ECHO-SW returns to Y at each JOB with RESET. BASE-RT stays 8.25 until overwritten—no RESET on that line. WS-CNT starts at 100 once; without RESET it keeps incrementing across JOBs if your logic adds to it.
W and S fields receive the same product defaults at program allocation. The difference is not the default bytes but what happens later: W with RESET snaps back to VALUE or product default at JOB SCREEN SORT boundaries; S retains whatever value assignments produced unless you clear it. Two DEFINE WS-X W 5 N lines are invalid; one W and one S with the same name also collide. Defaults apply once per allocation per name in the dictionary.
FILE statement field lines do not trigger working storage allocation defaults. NAME 17 20 A on FILE PERSNL is a view into the PERSNL record buffer. Before the first READ, buffer content may be undefined or leftover from a prior operation depending on runtime internals—do not write logic that assumes blanks or zeros on FILE fields pre-READ. After READ, bytes come from the dataset. Before PUT on output files, you assign defaults explicitly in JOB logic if the business requires blank names or zero amounts on new records.
12345JOB INPUT PERSNL IF GROSS NOT NUMERIC GROSS = 0 END-IF END-JOB
Overlay variables share parent storage. HIRE-MM on DATE-OF-HIRE does not get a separate default allocation—it reflects whatever bytes occupy those positions in the parent field. If parent DATE-OF-HIRE is blank on a new output record you cleared with MOVE SPACE, overlays are blank too. If parent holds LOW-VALUES from a bad READ, overlays inherit that bit pattern. Initialize the parent buffer when you need predictable subfield defaults.
OCCURS on W fields allocates each element with the same product defaults as a scalar field of that type—each numeric element zero, each alphabetic element blank. VALUE on an OCCURS definition can supply initial content per documentation rules for your release. RESET on OCCURS W arrays restores every element when the activity starts. Arrays without VALUE behave like repeated scalar defaults across the occurrence count.
ZERO, SPACE, HIGH-VALUES, and LOW-VALUES are language constants for comparisons and MOVE operations—not automatic defaults unless you assign them. A W field does not default to HIGH-VALUES; you must MOVE HIGH-VALUES TO field if that is the sentinel your shop uses for missing data. Confusing constant names with allocation defaults leads to IF tests that never match because the field still holds product zero or blank.
SQL nullable columns do not default host variables to SQL NULL conceptually—indicator variables carry null state. Uninitialized indicators before fetch produce undefined behavior. After fetch with NULL indicator set, host variable bytes may still show prior content; logic must branch on indicator, not on host field default rules. This differs from W allocation defaults and belongs in SQL integration testing checklists.
Default zero numeric fields participate in SUM and arithmetic immediately. Default blank alpha fields print as empty columns on LINE statements. MASK formatting may turn zero amounts into blank display per mask characters—display default differs from storage default. WHEN PRINTING, verify whether business users want zero amounts shown as 0.00 or suppressed; storage still holds zero until assignment changes it.
Core default rules for W and S numeric zero and alphabetic blank are stable across Broadcom 11.x documentation. DBCS M and K defaults and varying field edge cases should be verified against your installation manual if you process double-byte names or variable-length online fields. Deprecated constant behaviors live on the constants-by-release page—not variable default allocation.
Default values are what the computer puts in your box before you touch it. Number boxes get zero marbles. Letter boxes get empty space characters like invisible padding. You can put a sticky note on the box saying start with five marbles—that is VALUE. File boxes do not get prefilled by the computer; they arrive with whatever was shipped in the truck. Little boxes drawn inside a big box copy whatever the big box holds—they do not get their own separate starter pack.
1. Alphabetic W 20 A without VALUE contains at start:
2. Packed decimal W 5 P 2 without VALUE starts as:
3. VALUE on DEFINE changes default by:
4. FILE field defaults are:
5. Varying alphanumeric default length is: