"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx> wrote on 05/24/2016 04:55:15
PM:
Let’s just agree to disagree on that Dave.
It is not what Xlate was intended to do...
We can certainly agree to disagree. However, Xlate is intended to
provide character translation. Using it for template-controlled
translation is no different. Just because something was not thought of by
those who wrote the documentation doesn't mean it is wrong. One can even
add a layer of abstraction in order to plainly "document" what is being
done. This is a good candidate as a service procedure in my General
Utilities service program. Thanks all.
dcl-s cPhoneNumber char(10) inz('1234567890');
dcl-s ResultString varchar(50);
ResultString = 'Result is: '
+ FormatString('(ABC) DEF-GHIJ': cPhoneNumber);
DSPLY ResultString '*EXT';
*inlr = *on;
return;
dcl-proc FormatString;
dcl-pi *n varchar(40);
TemplateFormat varchar(40) const;
InputString varchar(26) const;
end-pi;
dcl-c TemplateChars 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
return %xlate(TemplateChars: InputString: TemplateFormat);
end-proc;
Sincerely,
Dave Clark