OVERLAY (Overlay) keyword for display files

You use this record-level keyword to specify that the record format that you are defining should appear on the display without the entire display being deleted first.

This keyword has no parameters.

Normally, the entire display is deleted on each output operation. All records on the display with fields that partially or completely overlap fields in this record are deleted before this record is displayed; all others remain on the display and are not changed in any way. A record already on the display is deleted even if fields specified in the record format are not selected for display. For example, assume that the following records are on the display:

REC1 (lines 1 and 2)
REC2 (lines 3 and 4)
REC3 (line 5)
REC4 (line 9)
An output of REC5 (lines 4 and 5) with OVERLAY will leave the display with the following records:
REC1 (lines 1 and 2)
REC5 (lines 4 and 5)
REC4 (line 9)

If the record with the OVERLAY keyword in effect is already on the display and PUTOVR, PUTRETAIN, or CLRL keyword is not specified, it is deleted and rewritten as a new record.

When the beginning attribute character of a record overlaps the ending attribute character of a record already displayed, the attribute characters overlap each other in position 1 of a line. (The last field of the first record displayed ends in the farthest right display position of the preceding line.)

In the above example, however, if the only portion of REC2 on line 4 is the ending attribute character of the last field of REC2 (which occurs when the last displayed character of the last field of REC2 is in the last position of line 3), REC2 remains displayed following the display of REC5 with OVERLAY. The display will have the following records:

REC1 (lines 1 and 2)
REC2 (line3)
REC5 (lines 4 and 5)
REC9 (line 9)

The display is always deleted on the first output operation after the file is opened, except when both ASSUME and OVERLAY are specified.

OVERLAY is assumed by the IBM® i operating system for ERRMSG, ERRMSGID, PUTOVR, and CLRL functions.

If OVERLAY is conditioned and not selected, then the ERASE, ERASEINP, MDTOFF, PROTECT, and PUTRETAIN keywords cannot take effect if they are selected, unless the PUTOVR keyword is selected. In such cases, the ERASE, ERASEINP, and MDTOFF keywords can take effect.

If you specify OVERLAY, you should also specify the RSTDSP(*YES) keyword on the CRTDSPF (Create Display File) or CHGDSPF (Change Display File) command. Otherwise, data on the display can be lost if the file is suspended.

To delete any of the records on the display, use the ERASE keyword to specify the names of the record formats to be deleted.

If you also specify the CLRL keyword, processing proceeds according to the CLRL specification, not the OVERLAY specification.

A warning message is sent at file creation time if the OVERLAY keyword is specified on a record with the DSPMOD keyword. At run time, the OVERLAY keyword is ignored when the display mode changes.

Option indicators are valid for this keyword.

Example

The following example shows how to specify the OVERLAY keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00021A          R RECL                      OVERLAY
     A