Content deleted Content added
m fixed CS1 errors: dates to meet MOS:DATEFORMAT (also General fixes) using AWB (10331) |
m <pre> for unsupported lang |
||
Line 42:
*{{code|%IF}} controls the flow of the preprocessor scan according to the value of a preprocessor expression.
<pre>
%IF preprocessor-expression
%THEN preprocessor unit1
%ELSE preprocessor-unit2
</
The preprocessor-units can be any single preprocessor statement or a preprocessor {{code|DO}}-group.
*{{code|%ITERATE}} transfers control to the {{code|%END}} of the containing preprocessor {{code|DO}}-group, ending the current iteration and beginning the next if needed.
Line 69:
==Example==
The following example for IBM PL/I for OS/2 illustrates the use of a preprocessor procedure to implement a C-like write statement for PL/I.<ref>{{cite web|last=Sturm|first=Eberhard|title=UIO-Makros für Builtin-Funktionen fileread und filewrite|url=http://www.uni-muenster.de/ZIV.EberhardSturm/uio.cpy|accessdate=January 22, 2012}}</ref> The procedure would be called by coding the statement {{code|uwrite file(filename) from(varying_string) count(byte_count);}} <var>Byte_count</var> is optional and defaults to the length of <var>varying_string</var> if omitted.
<pre>
%uwrite:
procedure keys (File, From, Count);
Line 96:
%end;
%act uwrite;
</
The statement {{code|uwrite file(file_name) from(var_str) count(64);}} generates the following:
<pre>
do;
dcl Count00001 fixed bin (15);
Count00001 = filewrite(file_name, ptradd(addr(var_str), 2), min(length(var_str), 64));
end;
</
==Evolution==
|