OVERLAY

OVERLAY Syntax Diagram

Addition:

... ONLY c3

Note

As with any string processing statement, all the operands are processed here as type C fields (regardless of type). No internal conversion is performed.

Effect

The contents of the field c2 overlay the field c1 in all positions where c1 has the value SPACE; c2 itself remains unchanged.

SY-SUBRC = 0:

At least one character in c1 is overlaid by a character from c2.

SY-SUBRC = 4:

No character in c1 was overlaid by a character from c2.

Example

DATA: WORK(20) VALUE 'Th t h s ch ng d.', 
	HELP(20) VALUE 'Grab  a   pattern'. 
OVERLAY WORK WITH HELP.

WORK now contains 'That has changed.' and the system field SY-SUBRC is set to 0.

Note

If c1 is longer than c2, c1 is only overlaid by the length of c2. The result for overlapping fields c1 and c2 is undefined.

Effect

The contents of the field c2 overlay the field c1 only in those positions where c1 has one of the characters existing as a value in c3; the fields c2 and c3 remain unchanged.

Example

Linking field selection templates:

DATA: ONE(16), TWO(16). 
ONE = '----****++++....'. 
TWO = '-*+.-*+.-*+.-*+.'. 
OVERLAY ONE WITH TWO ONLY '.'. 
OVERLAY TWO WITH ONE ONLY '.+'. 
OVERLAY ONE WITH TWO ONLY '+*'.

Field ONE now contains '-----***-*++-*+.' and field TWO contains '-*---***-*++-*+.'.

The runtime required for the OVERLAY statement in the example of the basic form is about 45 msn (standardized microseconds). To execute the addition ... ONLY c3, about 40 msn are needed.

Related

REPLACE, SEARCH, SHIFT, TRANSLATE