Easytrieve AFTER-SCREEN

Batch Easytrieve dominates tutorials—JOB INPUT, PRINT, REPORT. Enterprise shops also run SCREEN activities where operators query balances, approve adjustments, and trigger reports from terminals. BEFORE-SCREEN prepares labels and default field values before display. AFTER-SCREEN is the hook that runs after the operator fills input and presses enter—validate account number numeric, reject blank amount, READ master file, UPDATE hold record, display error message map, or EXECUTE payroll JOB when approval flag set. AFTER-SCREEN is a reserved PROC label invoked by screen runtime—not PERFORM from unrelated activity. It sits at end of SCREEN activity with other screen PROCs—INITIATION, BEFORE-SCREEN, TERMINATION—following same placement discipline as report PROCs after REPORT. Beginners port batch IF logic into BEFORE-SCREEN when validation belongs in AFTER-SCREEN after input exists. This page teaches screen event lifecycle, validation and update patterns, error messaging, EXECUTE JOB integration, variable RESET on SCREEN boundaries, contrast with report AFTER-LINE, and testing in development terminal regions.

Progress0 of 0 lessons

SCREEN Activity Event Flow

INITIATION PROC once at SCREEN activity entry—open files, ACCESS database, set defaults. Screen cycle repeats: BEFORE-SCREEN maps outgoing fields, runtime displays screen, operator edits, AFTER-SCREEN validates and acts. TERMINATION PROC cleanup at activity end. Multiple screens in one activity chain via GOTO or CASE navigation after AFTER-SCREEN sets next screen id field.

Screen PROC events
PROC nameWhen invoked
INITIATIONSCREEN activity start
BEFORE-SCREENBefore each screen display
AFTER-SCREENAfter operator input received
TERMINATIONSCREEN activity end

AFTER-SCREEN Validation Pattern

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
AFTER-SCREEN. PROC IF ACCT-NO EQ SPACES ERR-MSG = 'Account required' GOTO SAME-SCREEN END-IF IF NOT NUMERIC(ACCT-NO) ERR-MSG = 'Account must be numeric' GOTO SAME-SCREEN END-IF PERFORM READ-MASTER IF NOT-FOUND EQ Y ERR-MSG = 'Account not found' GOTO SAME-SCREEN END-IF PERFORM SHOW-DETAIL-SCREEN END-PROC

BEFORE-SCREEN Versus AFTER-SCREEN

BEFORE-SCREEN loads customer name from file into display field before operator sees screen. AFTER-SCREEN reads operator-entered account number after keypress—cannot validate empty account in BEFORE-SCREEN before operator had chance to type unless clearing prior session residue. Error message field ERR-MSG set in AFTER-SCREEN displays on redisplay via BEFORE-SCREEN on next cycle.

File Updates in AFTER-SCREEN

Approved adjustment: AFTER-SCREEN validates amount range, READ hold record, ADD amount to balance, WRITE or REWRITE per file type, commit if database. Failed validation skips update and redisplays screen with ERR-MSG. Use same FILE definitions as batch Library—online and batch share data dictionary when designed well.

EXECUTE JOB From AFTER-SCREEN

Operator approves report: AFTER-SCREEN sets parms and EXECUTE JOB PRINT-PAYROLL activity batch side generates spool. Operator sees confirmation message. Long-running JOB may async per site—message should set expectations. JCL for EXECUTE must exist in runtime environment documented for SCREEN.

Variable Lifetime on SCREEN

W working storage RESET at SCREEN activity start per variable lifetime rules. Session flags persist across screen cycles within activity unless cleared in AFTER-SCREEN. S fields may carry forward through multiple EXECUTE calls—document semantics for maintainers.

Contrast With Report AFTER-LINE

Report AFTER-LINE hooks printed detail rows in batch report writer. Screen AFTER-SCREEN hooks terminal interaction cycles—completely different runtime. Names parallel BEFORE/AFTER pattern but contexts do not interchange.

Common AFTER-SCREEN Mistakes

  • Validating input in BEFORE-SCREEN before operator entry.
  • PERFORM AFTER-SCREEN from JOB activity.
  • Missing error path redisplay—operator sees blank screen.
  • UPDATE without READ lock or concurrent update check.
  • Long batch EXECUTE blocking terminal without message.
  • Screen PROC placed before SCREEN executable statements incorrectly.

Explain It Like I'm Five

The screen is a form the operator fills out. BEFORE-SCREEN puts the blank form on the desk with today's date filled in. AFTER-SCREEN is the teacher collecting the form and checking answers—if something wrong, hand form back with red marks; if right, file it and show next form.

Exercises

  1. Write AFTER-SCREEN check for blank required field.
  2. Explain ERR-MSG flow across AFTER and BEFORE cycles.
  3. Describe EXECUTE JOB use case from online approval.
  4. List four screen PROC names in activity order.
  5. Contrast AFTER-SCREEN with AFTER-LINE context.

Quiz

Test Your Knowledge

1. AFTER-SCREEN PROC runs:

  • After screen display and operator input cycle
  • Before Library FILE
  • Only in batch JOB
  • At link-edit

2. AFTER-SCREEN is invoked by:

  • Screen activity runtime automatically
  • PERFORM from unrelated JOB
  • JCL only
  • REPORT writer

3. Typical AFTER-SCREEN logic includes:

  • Validate fields and update files
  • Define DD statements
  • SORT keys only
  • REPORT TITLE

4. AFTER-SCREEN compared to BEFORE-SCREEN:

  • BEFORE prepares display; AFTER processes input results
  • Identical
  • AFTER before display
  • Neither uses PROC

5. SCREEN activity PROC placement:

  • At end of SCREEN activity after executable logic
  • Before Environment PARM
  • Inside REPORT
  • Only in JCL
Published
Read time15 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve SCREEN activity AFTER-SCREEN PROC eventSources: Broadcom Easytrieve Programming Guide SCREEN section, Procedures screen eventsApplies to: Easytrieve AFTER-SCREEN screen PROC