Easytrieve Constants Overview

Easytrieve gives you two constant worlds. Named constant fields are working storage locations you DEFINE with VALUE—TAX-RATE, MAX-RECS, OK-CODE. System constants are reserved words the product understands in IF field class conditions, MOVE statements, and file logic: ZERO, ZEROS, ZEROES, SPACE, SPACES, HIGH-VALUES, LOW-VALUES, EOF, DUPLICATE, and FIRST-DETAIL. You do not DECLARE ZERO as a field. You write IF GROSS NOT ZERO or MOVE SPACES TO OUT-NAME. Each system constant has rules about which field types it applies to and what bytes it represents on z/OS. Misusing HIGH-VALUES on a packed amount or testing ZERO on a blank name field produces logic bugs that compile cleanly. This overview maps every major constant family, points to detail pages, and contrasts system constants with VALUE constant fields from the field definitions chapter.

Progress0 of 0 lessons

Two Kinds of Constants

Named constant fields vs system reserved constants
AspectConstant field (VALUE)System constant
DeclarationDEFINE TAX-RATE W 3 P 4 VALUE 0.0825No DEFINE—reserved word
Typical useBusiness rates, codes, limitsIF tests, MOVE fill, EOF checks
ExamplesMAX-RECS, DFLT-STATZERO, SPACE, HIGH-VALUES, EOF
Can renameYou choose field nameFixed vocabulary

Field Class Condition Constants

IF field-name class tests whether a field contains a class of data. No relational operator appears—syntax is IF NAME ALPHABETIC or IF GROSS NOT ZERO. NOT inverts the test. Each constant inspects bytes differently.

Field class constants and what they test
ConstantWhat is testedDetail page
ALPHABETICLetters A–Z or space in each byteLiterals and data types
NUMERICDigits in format for field type including valid sign on N and PNumeric data type
SPACE, SPACESSpace character in each byteconstants/space
ZERO, ZEROS, ZEROESZero value per field typeconstants/zero
HIGH-VALUESX'FF' in each byteconstants/high-values
LOW-VALUESX'00' in each byteconstants/low-values
text
1
2
3
4
5
6
7
8
JOB INPUT PAYFILE IF NAME ALPHABETIC IF EMPL# NUMERIC IF GROSS NOT ZERO PRINT DETAIL-RPT END-IF END-IF END-IF

MOVE and Assignment Constants

MOVE and assignment accept system constants as sources. MOVE ZERO TO WS-COUNT clears a numeric counter. MOVE SPACES TO OUT-NAME blanks an output name before PUT. MOVE HIGH-VALUES TO KEY-FIELD sets sort-high keys for VSAM positioning in shop patterns. MOVE LOW-VALUES initializes binary areas. Targets must match constant semantics—do not MOVE SPACES to packed amount expecting numeric zero.

File Processing Constants

EOF file-name tests end of file during RETRIEVE and JOB INPUT loops. DUPLICATE signals duplicate key on indexed or VSAM adds per file status handling. Combine with file-name:FILE-STATUS for robust error branches. FIRST-DETAIL appears in report control break context—marks first detail line after a break. Detail pages cover each constant.

text
1
2
3
4
5
6
7
8
JOB INPUT PAYFILE IF EOF PAYFILE DISPLAY 'END OF PAYFILE' END-IF IF PAYFILE:FILE-STATUS NOT ZERO DISPLAY 'I/O ERROR' PAYFILE:FILE-STATUS STOP END-IF

Type Awareness

System constants are type-aware for ZERO and NUMERIC tests. Packed GROSS ZERO checks packed zero—not the same bytes as alphabetic field filled with character 0. SPACE tests all blanks on alphabetic fields; use ZERO for numeric zero. HIGH-VALUES and LOW-VALUES are byte tests independent of numeric type—useful for initialized key areas and flag bytes.

Spelling Variants

Broadcom accepts synonyms: ZERO, ZEROS, ZEROES; SPACE, SPACES. Choose one spelling per shop coding standard for readability. All forms invoke the same semantics in field class conditions per CA-Easytrieve Plus reference material.

Constants in Report Processing

FIRST-DETAIL helps TITLE and LINE procedures detect first detail after control break. BWZ on MASK blanks numeric fields when zero at print time—related to ZERO display semantics but a MASK option not a constant. SUM and control totals skip or include zero values per field definition decimals.

NULL and Special Values

NULL handling in Easytrieve ties to SQL and varying fields in database access—see constants/null detail page. Distinct from LOW-VALUES binary init and from SPACE blank fill on character fields.

Version and Deprecated Constants

Release-to-release, reserved word lists grow slowly. Constants-by-release and deprecated-constants pages document migrations from legacy CA-Easytrieve Plus manuals to Broadcom 11.6. When upgrading compilers, scan for obsolete spellings in migrated macros.

Common Mistakes

  1. DEFINE field named ZERO or SPACE—reserved conflict.
  2. IF NAME ZERO on blank name—use SPACE for all blanks on type A.
  3. MOVE HIGH-VALUES to packed field expecting numeric max.
  4. Ignoring FILE-STATUS after EOF assumption.
  5. Confusing constant field TAX-RATE with system ZERO.

Explain It Like I'm Five

System constants are magic words the teacher already knows. When you say IF CUP ZERO, the teacher checks if the cup has no marbles left—in the right way for that cup type. Named constant fields are labels you put on your own jar at home. Both are about special values, but magic words are built into the game rules; jars are yours to name.

Exercises

  1. Write IF chain with ALPHABETIC, NUMERIC, and NOT ZERO.
  2. MOVE SPACES and MOVE ZERO to appropriate field types before PUT.
  3. Handle EOF and nonzero FILE-STATUS on input file.
  4. List which constant tests bytes vs numeric value.
  5. Contrast DEFINE MAX-RECS VALUE with IF COUNT ZERO.

Quiz

Test Your Knowledge

1. ZERO in IF GROSS ZERO is:

  • A field class condition testing zero value
  • A field name you DEFINE
  • JCL return code
  • Compile directive

2. HIGH-VALUES tests each byte for:

  • X'FF'
  • X'00'
  • Space character
  • Digit 9

3. MOVE SPACES TO NAME fills NAME with:

  • Blank characters in each byte
  • Zeros
  • HIGH-VALUES
  • Null pointer

4. EOF PAYFILE in IF tests:

  • End of file on PAYFILE
  • Zero balance
  • Duplicate key
  • Compile end

5. Constant fields with VALUE differ from system constants because:

  • VALUE names user fields; ZERO SPACE are reserved words in conditions and MOVE
  • They are identical
  • VALUE is JCL only
  • System constants cannot appear in IF
Published
Read time14 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 field class conditions EOF FILE-STATUS constantsSources: Broadcom Easytrieve 11.6 Language Reference IF conditions, CA-Easytrieve Plus Application GuideApplies to: Easytrieve system reserved constants