MEMREPLACE fills a target buffer with the contents of a source buffer with one or more occurrences of a specified third buffer replaced by a fourth buffer, and returns a size_t value that indicates the number of bytes that are written to the target buffer.
>>-MEMREPLACE-(-p--,--m--,--q--,--n--,--f--,--x--,--t--,--y--+-----------+-)->< '-,s-+----+-' '-,i-'
dcl ein char(50) var value('reserved from #date# till #date#.');
dcl aus char(80) var;
dcl cx fixed bin(31);
dcl f char(6);
dcl t char(10);
f = '#date#';
t = '2018/05/01';
cx = memreplace( addrdata(aus), maxlength(aus),
addrdata(ein), length(ein),
addrdata(f), length(f),
addrdata(t), length(t));
/* cx = 37 */
/* aus = 'reserved from 2018/05/01 till #date#.' */
cx = memreplace( addrdata(aus), maxlength(aus),
addrdata(ein), length(ein),
addrdata(f), length(f),
addrdata(t), length(t),16,1);
/* cx = 37 */
/* aus = 'reserved from #date# till 2018/05/01.' */
cx = memreplace( addrdata(aus), maxlength(aus),
addrdata(ein), length(ein),
addrdata(f), length(f),
addrdata(t), length(t),,0);
/* cx = 41 */
/* aus = 'reserved from 2018/05/01 till 2018/05/01.' */