SPACE and SPACES are Easytrieve figurative constants for blank character data. They solve two everyday problems: checking whether a complete field is blank and clearing a complete receiving field before it is reused. IF CUSTOMER-NAME SPACES is true only when every byte in CUSTOMER-NAME contains the space character. MOVE SPACES TO OUT-NAME fills every byte of OUT-NAME with blanks, using the receiving field's defined length. The singular and plural spellings are equivalent. That sounds simple, but fixed-width mainframe data makes blank handling easy to get wrong. A twenty-byte name containing nineteen blanks and one letter is not SPACES. A field containing low values is not SPACES. A nullable SQL column whose null indicator is negative is NULL, even if stale bytes happen to look blank. This tutorial explains the byte-level meaning, validation patterns, MOVE behavior, nullable fields, record cleanup, report effects, and differences between SPACE, ZERO, NULL, and LOW-VALUES.
SPACE is not a one-byte field that Easytrieve copies once. It is a figurative constant: Easytrieve expands the idea of a space to the length required by the operation. In a field-class condition, the subject controls how many bytes are inspected. In a MOVE, the first receiving field controls the default sending length, and every receiving field is set to the appropriate blank representation. This lets one statement clear fields of different lengths without coding separate quoted literals containing ten, twenty, or eighty blanks.
12345678DEFINE WS-NAME W 20 A DEFINE WS-ADDRESS W 40 A MOVE SPACES TO WS-NAME WS-ADDRESS IF WS-NAME SPACES DISPLAY 'NAME HAS NOT BEEN ENTERED' END-IF
The MOVE clears all twenty bytes of WS-NAME and all forty bytes of WS-ADDRESS. The IF then inspects all twenty bytes of WS-NAME. It does not merely look for a blank somewhere in the field. Fixed-width names often contain trailing blanks, so a test meaning “contains any blank” would reject almost every normal record. The Easytrieve class condition instead answers the useful question: “Is this whole field blank?”
Broadcom accepts both spellings in field-class conditions and in Format 2 of MOVE. There is no singular-versus-plural length rule. IF CODE SPACE and IF CODE SPACES both inspect the complete CODE field. MOVE SPACE TO NAME and MOVE SPACES TO NAME both blank the complete receiving field. Teams often prefer SPACES because the word visually suggests a repeated fill, while others prefer SPACE because it matches the name of the character class. Pick one in a coding standard so maintenance programmers do not waste time looking for a semantic difference that does not exist.
For single-byte and MIXED-format subjects, Easytrieve tests each byte for the space character. On z/OS using EBCDIC, an ordinary blank is hexadecimal 40. The test does not trim the field, collapse whitespace, or regard tabs and low values as blank. Every byte must match the expected space character. DBCS subjects follow the product's double-byte rules, so applications using Japanese or other DBCS data should confirm the field format rather than treating every character field as single-byte.
| Field content | Result | Why |
|---|---|---|
| Twenty blank characters | True | Every byte is a space |
| SMITH followed by blanks | False | Five bytes are letters |
| Character 0 followed by blanks | False | Character zero is not a blank |
| All X'00' bytes | False | LOW-VALUES differs from spaces |
| SQL NULL indicator is negative | Use NULL test | Null status is not determined by data bytes |
The optional NOT reverses the field-class result. IF NAME NOT SPACES means at least one byte is not blank. That can be useful as a quick presence test, but it does not prove that the contents are valid. A name containing a low value, punctuation, or a single invalid byte is also NOT SPACES. Combine presence validation with ALPHABETIC or a business lookup when data quality matters.
123456789IF CUSTOMER-NAME SPACES ERROR-CODE = 'N01' DISPLAY 'CUSTOMER NAME IS REQUIRED' ELSE IF CUSTOMER-NAME NOT ALPHABETIC ERROR-CODE = 'N02' DISPLAY 'CUSTOMER NAME CONTAINS INVALID DATA' END-IF END-IF
The first branch identifies the precise all-blank condition. The second branch handles nonblank data that does not satisfy the alphabetic class. Keeping these cases separate produces better diagnostics than a single broad test.
Easytrieve does not provide COBOL's group-level INITIALIZE for a hierarchy of fields. Output record layouts are normally cleared field by field or through a parent overlay. Before building a new output record, blank character destinations and zero numeric destinations. Otherwise, bytes left by the previous input record can leak into the next output record when a branch does not assign every field.
12345678910111213PROC CLEAR-OUTPUT. MOVE SPACES TO OUT-NAME OUT-ADDRESS OUT-MESSAGE MOVE ZERO TO OUT-AMOUNT OUT-COUNT END-PROC JOB INPUT CUSTOMER PERFORM CLEAR-OUTPUT OUT-NAME = CUSTOMER-NAME IF ADDRESS-VALID OUT-ADDRESS = CUSTOMER-ADDRESS END-IF PUT OUTPUT-FILE END-JOB
Clearing OUT-ADDRESS matters because ADDRESS-VALID might be false. Without the blank fill, the output could retain the preceding customer's address. This is a data-integrity problem, not merely a display issue.
| Constant | Stored meaning | Typical use |
|---|---|---|
| SPACE / SPACES | Blank character in every position | Empty names, addresses, messages |
| ZERO / ZEROS | Numeric zero in the field type | Amounts, counts, file status |
| LOW-VALUES | X'00' in every byte | Binary sentinels or byte-level initialization |
| NULL | Nullable indicator says no known value | SQL nullable columns |
A blank amount is not necessarily zero. A blank phone number is not necessarily NULL. A low-value-filled key is not blank. Mainframe files often use different sentinels for different business states, so replacing every “empty-looking” value with SPACES can erase meaning. Consult the record layout and database definition before normalizing values.
Broadcom's MOVE rules state that moving spaces or zeros to a nullable receiving field sets that field to NOT NULL. This distinction is essential. MOVE NULL TO PHONE says no known phone value exists. MOVE SPACES TO PHONE says a known value exists and its character bytes are blank. SQL predicates, extracts, and downstream programs can treat those states differently. Use MOVE NULL only when the business value is absent, and MOVE SPACES only when blank data is the intended non-null value.
Alphabetic W and S working-storage fields initialize to blanks when VALUE is omitted. Therefore a newly allocated DEFINE WS-FLAG W 1 A normally satisfies IF WS-FLAG SPACE. Adding VALUE makes a different initial state explicit. RESET on a W field returns it to its initial value at JOB, SCREEN, or SORT execution; if no VALUE is supplied, that means blanks for an alphabetic field.
12345678910DEFINE WS-REASON W 30 A RESET DEFINE WS-SWITCH W 1 A VALUE 'N' RESET JOB INPUT CLAIMS IF WS-REASON SPACES DISPLAY 'NO REASON HAS BEEN SET' END-IF IF WS-SWITCH NOT SPACE DISPLAY 'SWITCH HAS AN EXPLICIT VALUE' END-IF
Fixed-block and variable-block datasets commonly pad character fields on the right. A ten-byte state description might hold ALABAMA followed by three spaces. It is NOT SPACES because letters remain. When comparing a fixed-width field to a literal, Easytrieve handles lengths according to assignment and comparison rules; the SPACE class test is specifically for detecting an entirely blank area. Do not use it as a trim operation.
Blank character fields usually print as empty columns. They still occupy the report position calculated from LINE layout, headings, and spacing options. A field that is SPACES is not automatically omitted from a LINE statement. If an entire line should be suppressed, test the field before PRINT or use report procedures designed for conditional output. Numeric MASK BWZ is a separate feature that suppresses an all-zero numeric print value; it is not a SPACE test.
Legacy extracts may contain a mixture of spaces, zeros, low values, and malformed bytes. Test and count each condition before overwriting it. A cleanup job can display the record key and classify the problem, write rejected records to a separate file, and normalize only after the business owner confirms the mapping. Turning every abnormal byte pattern into spaces makes the output look cleaner but removes evidence needed to identify the producing system.
SPACE and SPACES are long-standing Easytrieve keywords and remain documented in Broadcom Easytrieve Report Generator 11.6. The logical behavior is stable, but byte representation depends on the host character set and field format. On normal EBCDIC single-byte z/OS data, a blank is X'40'. Do not hard-code hexadecimal 40 when SPACE communicates the intent more clearly and lets Easytrieve apply the correct representation. DBCS and MIXED fields have format-specific tests described in the current Field Class Condition documentation.
Imagine a row of twenty boxes for a name. SPACE asks whether every one of the twenty boxes contains a blank card. If even one box contains the letter A, the answer is no. MOVE SPACES replaces every card in the row with a blank card. NULL is different: it is a note saying nobody knows whether there should be a name. LOW-VALUES is also different: it fills the boxes with a special invisible computer marker instead of blank cards.
1. What does IF NAME SPACES test?
2. What does MOVE SPACES TO OUT-NAME do?
3. Which test is correct for an alphabetic field initialized to blanks?
4. How do SPACE and SPACES differ?
5. Moving SPACES to a nullable field also: