Easytrieve START Procedure

New maintainers search the Language Reference for START and may not find a standalone statement page—Broadcom documents START as the optional START start-proc-name parameter on the JOB statement. That parameter names a procedure Easytrieve performs during JOB initiation before retrieving the first automatic input record. Think of START as the opening shift checklist: zero counters, DISPLAY a banner, POINT an indexed master to today's key, run SQL SELECT when FILE DEFER delayed cursor open, reposition IMS databases, or load small control tables into working storage. FINISH is the closing checklist after the last record; START is the mirror at the front door. You cannot reference fields from the automatic input file inside START because no input record has been read yet—only working storage, other files already accessible, and environmental values are fair game. This page teaches JOB START syntax, implied execution order with OPEN, GOTO JOB interaction inside START, SQL and POINT patterns, contrast with INITIATION on SCREEN, and mistakes that arise when initialization is coded in the JOB body instead of START.

Progress0 of 0 lessons

Where START Appears

text
1
2
3
4
5
6
7
8
9
JOB [INPUT file-name | NULL | SQL | (sync list)] + [START start-proc-name] + [FINISH finish-proc-name] + [NAME job-name] + ... start-proc-name. PROC * initialization statements END-PROC

Only JOB activities accept START. SORT activities use BEFORE for prescreening, not START. SCREEN activities use INITIATION screen procedure for one-time online setup—a parallel concept with different name and terminal rules. The procedure label must be followed by PROC and closed with END-PROC per standard procedure grammar.

Implied JOB Execution Order

Broadcom documents implied steps when JOB runs with automatic input: open files, optionally PERFORM START procedure, retrieve input in a loop, run FINISH when input ends, wrap reports, proceed to next activity. START therefore runs after OPEN and before the first GET or automatic read places a record in the input buffer. Coding heavy OPEN-dependent logic in START is correct; coding it in the first line of JOB body still runs after first record arrives when INPUT is automatic—too late for positioning that must precede read.

START vs nearby lifecycle hooks
HookWhen it runsActivity
START procedureOnce before first automatic input recordJOB
JOB body loopEach input record (implied GOTO JOB)JOB
FINISH procedureAfter last automatic input recordJOB
INITIATION PROCOnce at SCREEN activity startSCREEN
BEFORE-SCREEN PROCEach screen display cycleSCREEN

Typical START Workloads

Initialize accumulators when VALUE on DEFINE is insufficient—TOT-AMT = 0, RECORD-COUNT = 0, HOLD-FIELDS to SPACES. DISPLAY diagnostic banners in test regions. POINT indexed or relative files to a starting key so automatic INPUT begins mid-file for restart jobs. Issue SQL SELECT on DEFERred SQL FILE so default cursor does not open before your dynamic WHERE clause is built. PERFORM small shared PROCs for table LOAD when external TABLE files feed control data. Issue DLI or database positioning statements in IMS-integrated programs per database chapter examples.

text
1
2
3
4
5
6
7
8
9
JOB INPUT MASTFILE NAME RESTART-JOB START START-PROC * body uses MASTFILE fields after first record arrives PRINT DETAIL-RPT START-PROC. PROC TOT-SALES = 0 DISPLAY 'RESTART JOB BEGIN' POINT MASTFILE KEY RESTART-KEY END-PROC

Restrictions Inside START

You cannot reference fields from the automatic input file—the record buffer is empty. Attempts to IF INPUT-FIELD = value in START read uninitialized buffer content or compile diagnostics depending on reference type. Secondary files not on JOB INPUT may be read if already open rules allow, but automatic input file sequential fields are off limits until the first retrieval. GOTO JOB inside START terminates START immediately per JOB statement documentation—use when aborting initialization branch, understanding JOB then proceeds toward input processing without re-running START unless GOTO JOB loops entire JOB including implied re-init (verify release behavior in test—generally avoid GOTO JOB from START except deliberate early entry to body).

START With JOB INPUT NULL

NULL inhibits automatic input; you GET or READ manually. START still runs first—ideal for setting up before a DO WHILE GET loop. You must STOP or TRANSFER eventually or NULL jobs loop forever. START initialization of EOF flags and counters matters more in NULL jobs because you control every read explicitly.

START With Synchronized INPUT

Synchronized JOB INPUT aligns multiple files on KEY fields. START may POSITION one file or DISPLAY sync start message before first matched tuple arrives. Matching logic itself runs in JOB body with IF MATCHED conditions after records exist—do not expect MATCHED in START.

START Versus INITIATION (SCREEN)

INITIATION is the screen procedure special name at SCREEN activity entry—open online files, set terminal defaults, display welcome once. START is the JOB parameter equivalent for batch. Do not label a batch init PROC as INITIATION unless it lives in a SCREEN activity; cross-naming confuses maintainers and breaks special-name invocation rules.

START Versus FINISH

START opens the job; FINISH closes it gracefully after last record. FINISH displays EOJ totals; START displays BOJ banners. STOP EXECUTE in JOB body skips FINISH but cannot undo START already performed. GOTO JOB inside FINISH terminates FINISH early—mirror caution as with START.

Common START Mistakes

  • Referencing automatic INPUT file fields in START.
  • One-time OPEN logic in JOB body first line instead of START.
  • SQL SELECT in START without FILE DEFER—double cursor open overhead.
  • Expecting START to run again on each implied GOTO JOB iteration—it does not.
  • Naming procedure without PROC/END-PROC envelope.
  • Confusing START with SORT BEFORE prescreening.

Testing START

  1. DISPLAY in START—confirm once per JOB execution in test output.
  2. POINT restart—verify first body record matches intended key.
  3. SQL DEFER file—trace single cursor open when SELECT lives in START.
  4. GOTO JOB from START branch—document whether body runs without re-START.
  5. Compare counter values when START zeroes vs VALUE on DEFINE only.

Explain It Like I'm Five

START is the before-we-begin checklist on a JOB adventure. The teacher reads START start-proc-name on the JOB sign-up sheet, then runs your checklist proc once: wipe the chalkboard counters, open the right book page with POINT, say we are starting on the loudspeaker with DISPLAY. Only after the checklist does the teacher hand you the first worksheet—that is the first input record. You cannot answer worksheet questions on the checklist because you have not received the paper yet.

Exercises

  1. Write JOB with START and FINISH procedure names and empty body comment.
  2. List three valid START tasks and one invalid task involving input file fields.
  3. Explain why GOTO JOB inside START terminates START.
  4. Describe FILE DEFER + SQL SELECT in START pattern in two sentences.
  5. Contrast START with SCREEN INITIATION procedure.

Quiz

Test Your Knowledge

1. START on JOB names:

  • A procedure run before first automatic input record
  • A standalone START statement
  • SCREEN KEY
  • SORT USING

2. Inside START procedure you cannot reference:

  • Fields from automatic input file records
  • Working storage
  • Non-automatic files
  • DISPLAY

3. START procedure runs after:

  • Files open for the JOB (implied open sequence)
  • FINISH procedure
  • Last record processed
  • Link-edit

4. GOTO JOB inside START:

  • Terminates the START procedure
  • Restarts START forever
  • Opens CICS
  • Runs FINISH

5. Typical START tasks include:

  • Initialize counters, POINT indexed file, SQL SELECT in START
  • PRINT report lines
  • SORT keys
  • REPORT TITLE
Published
Read time16 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 JOB START parameter and Activity Input and Output implied PERFORMSources: Broadcom Easytrieve 11.6 JOB Statement, Activity Section Input and Output, OPEN timingApplies to: Easytrieve JOB START initiation procedure