Screen messages are how your program talks back to the operator. When someone leaves a required field blank, types letters where digits belong, or successfully posts a transaction, a short line of text tells them what happened and what to do next. In an Easytrieve SCREEN activity these messages live in a message field you populate in code and paint on a message line, most often near the bottom of the screen. Good messages turn a frustrating guessing game into a smooth correction; poor or missing messages leave operators stuck. This page covers the kinds of messages you display, where to set and clear them, how to write text that actually helps, how to distinguish errors from confirmations visually, and how messages team up with cursor positioning to guide the operator. Clear messaging is one of the highest-value habits in online programming.
Not all messages serve the same purpose, and treating them the same confuses operators. Three broad categories cover most needs. Error messages report that something must be fixed before the program can proceed. Confirmation messages reassure the operator that an action succeeded. Status or informational messages describe the current state, such as which page of a list is showing. Deciding which category a message belongs to shapes both its wording and its appearance.
| Type | Purpose | Example text |
|---|---|---|
| Error | Block progress until fixed | ACCOUNT MUST BE NUMERIC |
| Confirmation | Reassure that an action succeeded | CUSTOMER UPDATED SUCCESSFULLY |
| Informational | Describe current state | PAGE 2 OF 5 |
| Warning | Flag a risky but allowed condition | ACCOUNT OVERDRAWN — PROCEED WITH CARE |
| Prompt | Guide the next expected action | ENTER ACCOUNT NUMBER AND PRESS ENTER |
A screen message is just the value of a field you defined for that purpose—call it SCR-MSG. You paint it on the screen as a protected output field on a reserved line so it does not collide with data fields. During processing you move text into SCR-MSG, and the runtime displays whatever it holds on the next paint. Because it is an ordinary field, all the output handling rules apply: it keeps its last value until you change it, so managing it carefully across cycles is essential.
AFTER-SCREEN is where you learn the outcome of the operator's input, so it is where most messages originate. Validation failures set an error message; successful updates set a confirmation. Set the message as close as possible to the decision that produced it, so the wording matches the exact condition.
12345678910AFTER-SCREEN. PROC IF ACCT-NO EQ SPACES SCR-MSG = 'ACCOUNT NUMBER REQUIRED' ELSE IF NOT NUMERIC(ACCT-NO) SCR-MSG = 'ACCOUNT MUST BE NUMERIC' ELSE PERFORM UPDATE-ACCOUNT SCR-MSG = 'ACCOUNT UPDATED SUCCESSFULLY' END-IF END-PROC
A message that lingers after its cause is gone is misleading. If BEFORE-SCREEN does not clear SCR-MSG, the operator might fix an error yet still see the old error text, or see a stale success message on an unrelated screen. The rule is to clear the message at the start of each cycle in BEFORE-SCREEN, then let AFTER-SCREEN set a new one only when there is something to say.
1234BEFORE-SCREEN. PROC PERFORM LOAD-DISPLAY SCR-MSG = SPACES END-PROC
There is a subtlety worth understanding. AFTER-SCREEN runs, sets a message, and then on the next display BEFORE-SCREEN runs before the operator sees anything. If BEFORE-SCREEN blindly clears the message, the operator would never see it. The common resolution is that the message set in AFTER-SCREEN is intended for the very next display, and clearing happens at the top of the cycle that follows the operator reading it. In practice you set the message last in AFTER-SCREEN and clear it early in BEFORE-SCREEN of the subsequent cycle, so each message shows exactly once. If your release's flow differs, trace one cycle carefully to confirm messages appear for the operator and then disappear.
The difference between a helpful screen and a frustrating one is often just wording. A good message states what is wrong and what to do, and where possible names the field. Compare INVALID INPUT—which tells the operator nothing—with ACCOUNT MUST BE NUMERIC, which points straight to the fix. Keep messages short enough to fit the message line, use consistent terminology, and avoid internal jargon or raw return codes the operator cannot interpret.
| Weak | Strong | Why the strong one wins |
|---|---|---|
| ERROR | ENTER A DATE IN MM/DD/YYYY FORMAT | Says what and how to fix it |
| INVALID | AMOUNT CANNOT EXCEED 999,999.99 | Gives the exact limit |
| RC=08 | CUSTOMER NOT FOUND — CHECK THE ID | Human-readable, actionable |
| DONE | ORDER 4471 SAVED | Confirms the specific result |
Wording is not the only signal. On terminals that support it, use attributes to distinguish categories at a glance: high intensity or red for errors, normal or green for confirmations. Keep the scheme consistent across every screen so operators learn that red means stop and fix. Do not rely on color alone, because some terminals and operators cannot distinguish it—pair color with clear text so the message works in monochrome too.
A message and a cursor are a team. When validation fails, set the error message and record the field that failed so BEFORE-SCREEN can place the cursor there. The operator reads ACCOUNT MUST BE NUMERIC and finds the cursor already resting on the account field. This pairing is the single most effective error-handling pattern in online programming, turning correction into a one-step action.
123456789AFTER-SCREEN. PROC IF NOT NUMERIC(ACCT-NO) SCR-MSG = 'ACCOUNT MUST BE NUMERIC' ERROR-FIELD = 'ACCT-NO' ELSE ERROR-FIELD = SPACES PERFORM LOOKUP-ACCOUNT END-IF END-PROC
Screen messages are like sticky notes the computer puts on your worksheet. If you make a mistake, it sticks a red note saying exactly what to fix, like write numbers here, not letters. If you do it right, it sticks a happy note saying good job, saved. Before giving you a fresh worksheet it peels off the old note so you are not confused by yesterday's. The best notes tell you both what went wrong and how to fix it, not just a scary word like wrong.
1. A screen message field is used to:
2. You typically set an error message in:
3. To avoid a stale message lingering, you should:
4. A good error message is:
5. Pairing a message with cursor positioning helps because: