Documentation and forums often say CHAR when they mean character fields—the bytes that store names, codes, and messages. In Easytrieve source, that role is filled by the single letter A on DEFINE and FILE lines, not a spelled-out CHAR keyword like some SQL dialects use. Learning to read 20 A as twenty-byte alphanumeric prevents confusion when migrating from COBOL PIC X or from languages with explicit char types. This page focuses on the syntax pattern for declaring CHAR-equivalent fields, optional parameters that apply only to A, and examples you can paste into Library sections.
After field length on DEFINE or FILE, the next token is the data type letter. A signals alphanumeric: each byte is a character in the active code page. Contrast with N for zoned numeric, P for packed, B for binary. The letter is always uppercase in manuals; lowercase a may compile but violates style guides. 30 A means thirty character bytes, not thirty characters of a different encoding width—DBCS uses K or M instead.
123456FILE ORDERS FB(100 1000) ORDERID 1 10 A SHIPTO 11 35 A COUNTRY 46 3 A DEFINE WS-BUFFER W 132 A
Working storage character fields use W as location instead of a record position. Required tokens: field-name, W, length, A. Optional: VALUE literal, HEADING, MASK, VARYING, OCCURS, INDEX. Omit DEFINE keyword when fields immediately follow their FILE—the field line alone suffices in Library section FILE blocks.
| Definition | Meaning |
|---|---|
| WS-FLAG W 1 A | Single-byte Y/N flag |
| WS-MSG W 40 A VALUE 'READY' | 40-byte message initialized |
| WS-LINE W 80 A | Full print line buffer |
| WS-CODE W 5 A HEADING 'CODE' | Report column heading set |
| WS-VAR W 252 A VARYING | Max 250 data + 2 length bytes |
FILE field lines list name, starting byte position, length, A. Positions are one-based within the record. Sequential fields must not overlap unless intentional overlay. Character length must match external layout—if COBOL copybook shows PIC X(20) at byte 100, Easytrieve declares position 100 length 20 type A.
123* COBOL: 05 CUST-NAME PIC X(30) at byte offset 10 FILE CUSTFILE FB(80 800) CUSTNAME 10 30 A
VALUE accepts quoted alphanumeric literals matching field length or shorter with padding rules on assignment. HEADING supplies default report titles. MASK edits output—character masks use A in mask identifier lists like MASK (A BWZ 'text'). VARYING applies only to A for variable-length SQL-style fields. DECIMALS and EVEN are invalid on A. INTEGER, ROUNDED, TRUNCATED on assignment apply to numeric receives, not to declaring A.
Minimum length 1 byte. Maximum 254 bytes for standard A fields. Report LINE width and LINESIZE may display fewer characters than defined length—truncation is a report layout issue, not a DEFINE error. When BUFFER spans multiple physical records, declare separate FILE fields or use OCCURS with INDEX for table character slots.
COBOL PIC X(n) maps to n A in Easytrieve with matching position. PIC A(n) alphabet only still uses A type in Easytrieve—validation of alphabetic-only content is application logic, not type enforcement. PIC X with VALUE SPACES parallels A working storage default blanks. Group items in COBOL become multiple A fields or one large A spanning the group length depending on whether you need subfields addressable.
Assign character fields from quoted literals or other A fields. MOVE 'ABC' TO WS-CODE fills bytes; shorter literals pad with spaces in longer fields per assignment rules. Assigning numeric fields to A may produce edited character digits in the receive field—useful for DISPLAY without separate picture clauses. Assigning A to numeric types requires numeric content or conversion errors.
12345DEFINE F1A W 4 A DEFINE F2N W 4 N 0 VALUE 1234 F1A = F2N * F1A may contain edited character digits per assignment examples
MASK controls how character fields print. Mask literals in quotes define punctuation positions. BWZ suppresses leading zeros on numeric-looking character data. Report LINE uses MASK from DEFINE when present. Test masks with small DISPLAY statements before batch runs producing thousands of pages—mask errors are visible immediately in SYSPRINT.
CHAR is what grown-ups call the A sticker on a storage box. The sticker says this box holds letters, not special money-number packing. The number before A tells how many letter slots are in the box—like 20 A means twenty slots. You write the letter A in your instruction book because Easytrieve does not spell out CHAR in the rules.
1. On a DEFINE line, letter A means:
2. Valid DEFINE for 10-byte character working storage:
3. CHAR fields in FILE statements need:
4. VALUE on an A field accepts:
5. MASK on A fields controls: