Batch programs read every file record whether anyone is watching. Screen programs wait for people. Input handling is everything that happens from the moment an operator types in a field or presses a PF key until Easytrieve decides what screen comes next, whether master files update, or the activity ends. That cycle spans terminal I/O, UPPERCASE translation if SCREEN requests it, mapping keystrokes into Library DEFINE fields, AFTER-SCREEN validation and branching, KEY handlers for IMMEDIATE actions, and GOTO SCREEN redisplay when input fails validation. BEFORE-SCREEN already ran for this cycle—it prepared data before the panel appeared. Beginners who code validation in BEFORE-SCREEN fight the product flow and hit GOTO SCREEN restrictions. This page teaches input handling end to end: one display-input cycle diagram, Enter versus IMMEDIATE keys, reading field values in AFTER-SCREEN, PF key exit paths, RESET clearing prior input, pseudo-conversational considerations, and patterns for inquiry versus maintenance entry.
| Step | Hook / phase | Input state |
|---|---|---|
| 1 | RESET fields reinitialize | Prior typing cleared on RESET fields |
| 2 | BEFORE-SCREEN | No new input yet—prepare display |
| 3 | Build and send screen | Operator sees panel |
| 4 | Operator types / PF key | Terminal captures keystrokes |
| 5 | UPPERCASE if set | Input normalized |
| 6 | AFTER-SCREEN | Fields contain new values—process here |
| 7 | Branch | GOTO SCREEN, UPDATE, EXIT, or next panel |
Field input maps to DEFINE variables on ROW declarations. Operator tabs between fields, types values, presses Enter to submit panel. PF keys are separate KEY definitions—F1 Help, F3 Exit, F8 Forward—each with NAME label operator sees and action when pressed. Enter submits field content for AFTER-SCREEN processing unless IMMEDIATE key bypasses wait.
1234KEY F1 NAME 'Help' IMMEDIATE KEY F3 NAME 'Exit' EXIT KEY F8 NAME 'Next' IMMEDIATE KEY F12 NAME 'Cancel' EXIT IMMEDIATE
Standard data entry: operator completes fields, presses Enter. Terminal sends field buffer to Easytrieve. Declarative VALUE and MUSTENTER validate at field level. AFTER-SCREEN receives control with updated SCR- fields. Branch on content: inquiry READ, maintenance UPDATE, menu EXECUTE another SCREEN. Enter on empty required field triggers attribute error before AFTER-SCREEN or within declarative validation depending on release behavior—test both paths.
IMMEDIATE on KEY means operator need not press Enter on other fields—PF key action fires immediately. Use for Exit, Cancel, Help that should not submit half-filled maintenance forms. EXIT IMMEDIATE ends activity without waiting. Help IMMEDIATE may PERFORM HELP. PROC and redisplay. Document which keys are IMMEDIATE in operator run book—unexpected IMMEDIATE Cancel loses typed data operators expected to confirm with Enter.
| Aspect | Enter key | IMMEDIATE PF key |
|---|---|---|
| Submits | All entered field values | Key action only—may ignore partial fields |
| Typical use | Form submit, inquiry | Exit, Help, Cancel |
| AFTER-SCREEN | Full validation PROC | Key handler or abbreviated path |
12345678910111213AFTER-SCREEN. PROC EVALUATE SCR-MENU-OPT WHEN 'V' PERFORM VIEW-EMPLOYEE WHEN 'E' PERFORM EDIT-EMPLOYEE WHEN 'X' EXIT WHEN OTHER SCR-MSG = 'Invalid option' GOTO SCREEN END-EVALUATE END-PROC
SCR-MENU-OPT holds operator menu choice after Enter. EVALUATE or IF branches to procedures. Invalid option sets message and GOTO SCREEN redisplays menu. Valid paths may EXECUTE another SCREEN or PERFORM file logic. PF key EXIT may bypass AFTER-SCREEN menu logic when KEY EXIT fires—understand precedence when both KEY and field input active.
SCREEN UPPERCASE translates received data before AFTER-SCREEN. Menu VALUE ('V' 'E' 'X') expects uppercase letters—enable UPPERCASE so operators typing lowercase v still match. Without UPPERCASE, extend VALUE list or compare using uppercase functions in AFTER-SCREEN. Consistent choice across all screens in application reduces operator confusion.
Input DEFINE with RESET clears before BEFORE-SCREEN each cycle—fresh form each display. Maintenance screens that should retain typed data across failed validation may omit RESET on specific fields or MOVE prior values back in BEFORE-SCREEN after failed AFTER-SCREEN—design explicitly. Output ASKIP fields repopulate from files in BEFORE-SCREEN; input fields without RESET may show stale characters from failed submit—often desirable so operator fixes one field not retype all.
12345678910111213AFTER-SCREEN. PROC IF SCR-ACCT EQ ZEROS SCR-MSG = 'Enter account number' GOTO SCREEN END-IF READ CUSTMAST KEY SCR-ACCT IF NOT CUSTMAST SCR-MSG = 'Account not found' GOTO SCREEN END-IF MOVE CUST-NAME TO SCR-NAME MOVE CUST-BAL TO SCR-BAL END-PROC
Single key field drives READ. Success fills protected output fields; operator reviews without editing balance. F8 Forward KEY IMMEDIATE might increment internal index and PERFORM another READ in AFTER-SCREEN for browse-next pattern.
Maintenance collects multiple editable fields—some protected keys, some open amounts or codes. AFTER-SCREEN validates all, confirms with second screen or CONFIRM field Y/N, then UPDATE. Never UPDATE on first keystroke without validation. Consider double-entry for high-risk amounts— operator types amount twice, AFTER-SCREEN compares fields.
Shops often standardize: F1 Help, F3 Exit, F12 Cancel, F8 Next, F7 Previous. Match KEY NAME text to run book. Inconsistent PF labels across screens in same application frustrate operators. EXIT keys should always work—even mid-validation—unless business requires confirm dialog PERFORM before EXIT.
COMMIT TERMINAL default commits around terminal I/O. Task may suspend between screens; next input resumes transaction. AFTER-SCREEN must leave files and context ready for resume—OPEN in INITIATION not each cycle unless documented. Fields without RESET may need COMMAREA-style persistence equivalent per runtime—verify with platform guide when porting TSO design to CICS.
AFTER-SCREEN READ/UPDATE/WRITE uses same FILE verbs as batch. GET in BEFORE-SCREEN for browse screens; READ keyed in AFTER-SCREEN for inquiry submit. Hold record locks and COMMIT timing affect whether second operator sees stale data—coordinate with DBA on online update isolation.
Input handling is what happens when you hand your worksheet to the teacher. BEFORE-SCREEN was the teacher putting the blank worksheet on your desk. You write answers and raise your hand (Enter) or press a special button (PF key). AFTER-SCREEN is the teacher reading what you wrote and saying good job next page, or fix question three and try again.
1. Operator typed input is processed primarily in:
2. KEY F3 NAME Exit EXIT means:
3. IMMEDIATE on KEY means:
4. UPPERCASE on SCREEN affects:
5. RESET on input DEFINE fields: