Easytrieve Tables Overview

Payroll prints department 903; readers expect OPERATIONS, not a naked integer. State codes, product classes, tax brackets, and error messages appear millions of times in batch reporting—translating codes to text is table work. Easytrieve tables are in-memory reference files: you declare FILE name TABLE with ARG and DESC field layouts, supply rows instream in source or from an external sequential dataset at JOB start, then call SEARCH table WITH key GIVING result wherever JOB, PROGRAM, or SCREEN activities need decode. Broadcom 11.6 documents TABLE as a FILE parameter, not a standalone TABLE verb—tutorial indexes still name the topic TABLE because that is how shops describe the pattern. This overview maps the tables chapter: definition versus searching, binary search prerequisites, INSTREAM versus external maintenance, memory limits, comparison with LOOKUP statement tutorials, SQL ACCESS for large relational masters, and OCCURS arrays for programmer-controlled indexing. Beginners leaving this page should know when a table fits, where definitions live, and which follow-on tutorials drill into syntax details.

Progress0 of 0 lessons

Problem Tables Solve

Without tables you hard-code IF chains or perform disk READ on a small master for every transaction line—readable for five codes, unmaintainable for five hundred. Tables centralize reference data: one definition, many SEARCH calls, O(log n) lookup per row when ARG is sorted. Report LINE statements print GIVING fields after successful SEARCH. File maintenance jobs validate codes with IF NOT table presence tests. Screen activities decode dropdown values before DISPLAY. The pattern is decode, not transactional update—tables are read-only for the run after load.

Core Components

Table building blocks
ComponentRole
FILE ... TABLEDeclares searchable reference file in Library
ARG fieldSearch key layout in each table row
DESC fieldValue returned on match via GIVING
INSTREAM / external dataRow content loaded at compile or JOB initiation
ENDTABLETerminates instream row section
SEARCHRuntime lookup WITH key GIVING result

Minimal End-to-End Example

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
FILE PAYROLL FB(80) DEPT 1 3 N AMOUNT 10 5 P 2 FILE DEPTTAB TABLE INSTREAM ARG 1 3 N DESC 5 20 A 901 HUMAN RESOURCES 902 FINANCE 903 OPERATIONS ENDTABLE JOB INPUT PAYROLL SEARCH DEPTTAB WITH DEPT GIVING WS-DEPT-NAME IF NOT DEPTTAB WS-DEPT-NAME = 'UNKNOWN' END-IF PRINT RPT1

DEPTTAB loads at compile from instream rows. Each payroll GET triggers SEARCH. IF NOT DEPTTAB handles invalid department codes without aborting the run. WS-DEPT-NAME feeds report LINE or procedures. This is the archetype every table tutorial variant extends—external files, multiple tables, longer ARG/DESC, max-table-entries sizing.

Chapter Map — What to Read Next

Tables tutorial path
PageFocus
Table definitionFILE TABLE syntax, INSTREAM, external, ENDTABLE, limits
Table searchingSEARCH WITH GIVING, presence tests, error paths
LOOKUP / statements/tableStatement-level reference and SQL comparison
Binary searchWhy ARG order matters algorithmically
Table performanceMemory, row counts, when not to use TABLE

INSTREAM Versus External — Overview

INSTREAM tables ship inside the load module—ideal for static codes that change only when developers recompile. Operations edits require source change and promote through compile pipelines. External tables read a sequential reference file at JOB initiation—operations refreshes data without recompile when layout is stable. Specify max-table-entries on external FILE declarations to reserve memory and catch overflow when row count grows past capacity. Both require ascending ARG and no duplicates at load time.

Tables Versus Other Lookup Mechanisms

Choose the right lookup tool
MechanismBest forAvoid when
FILE TABLE + SEARCHSmall static code lists in batchMillions of keys or frequent relational joins
INDEXED FILE READVolatile master with one key per READTiny static list where TABLE memory is cheaper than disk I/O
SQL ACCESSLarge relational referenceTen-row code table needing zero DB overhead
OCCURS + loopCustom indexing logicStandard decode—reinventing binary search

Data Quality Rules Every Table Shares

  • ARG keys ascending before load—sort external files in a preprocessing step.
  • No duplicate ARG values in one table.
  • WITH and GIVING field lengths match ARG and DESC definitions.
  • ARG and DESC maximum 254 bytes each on table files.
  • Nullable fields invalid for table search results.
  • ENDTABLE required after instream rows with correct column placement.

Where Tables Appear in Activities

JOB INPUT loops issue SEARCH per detail record—most common pattern. PROGRAM activities decode parameters or shared working storage before calling other logic. SCREEN activities translate codes before terminal DISPLAY. Tables are not opened with GET—the runtime loaded them at initiation. Presence test IF table-file after SEARCH is mandatory when business rules require valid codes; skipping it prints blank or stale GIVING buffers on miss.

Memory and Scope

Entire table resides in memory for the execution pass. Hundreds or thousands of rows are typical; tens of thousands may be acceptable on generous regions. Millions of keys belong in database or indexed master files, not TABLE. Instream tables slightly increase object size; external tables add one sequential read at startup—usually negligible versus main file GET volume. Multiple tables in one program are normal—SEARCH each independently per key domain.

Common Beginner Mistakes

Table pitfalls
MistakeConsequence
Unsorted instream ARG keysWrong SEARCH matches or misses
Expecting TABLE statement keywordCompile errors—use FILE TABLE
No IF NOT table after SEARCHSilent bad descriptions on miss
Duplicate ARG rowsUndefined binary search behavior
Oversized reference in TABLERegion abend or overflow

Explain It Like I'm Five

A table is a poster on the wall with two columns: secret codes and real words. Before work starts, the computer memorizes the poster. When a payroll line says code 903, the computer looks at the poster and finds OPERATIONS. The poster must be in order from smallest code to biggest, and each code appears once. SEARCH is asking the poster a question; IF NOT table means the code was not on the poster so you pick a backup answer like UNKNOWN.

Exercises

  1. Sketch Library section with one input FILE and two TABLE files—label ARG/DESC roles.
  2. Choose TABLE versus INDEXED READ for ten-row state codes versus million-row customer master.
  3. List validation checks before promoting an external table file to production.
  4. Write narrative explaining ENDTABLE placement to a peer who omitted it.
  5. Map which tables chapter pages you will read for a new decode requirement.

Quiz

Test Your Knowledge

1. In Easytrieve 11.6, TABLE is documented as:

  • A parameter on the FILE statement
  • A standalone verb like GET
  • A JCL DD keyword only
  • A SCREEN map directive

2. SEARCH uses which table field for matching?

  • ARG
  • DESC
  • TITLE
  • LINE

3. Table ARG values must be:

  • Ascending order with no duplicate keys
  • Descending with duplicates allowed
  • Random order
  • Sorted only for external tables

4. INSTREAM tables are loaded:

  • At compile time from source rows
  • Only on first GET
  • From VSAM KSDS
  • By WRITE statement

5. When reference data is large and relational, prefer:

  • ACCESS or SQL over TABLE
  • TABLE with million rows
  • PRINTER TABLE
  • SCREEN TABLE only
Published
Read time16 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve Report Generator 11.6 Table Processing, FILE TABLE, SEARCHSources: Broadcom Easytrieve 11.6 Table Processing; FILE Statement; SEARCH StatementApplies to: Easytrieve TABLE reference data overview