PL/I equivalent of C's ifdef?

HLASM for MVS. PL/I for MVS & Enterprise PL/I for z/OS.
Post Reply
peeterjoot
Registered Member
Posts: 15
Joined: Fri Mar 03, 2017 2:01 am
Contact:

PL/I equivalent of C's ifdef?

Post by peeterjoot »

I see that PL/I has macros. For example:
%DCL RECSZ FIXED;
%RECSZ = 80;
%ACTIVATE RECSZ;
Does it also have a C like 'if defined' or ifdef like construct that I could use to conditionally compile code in two different ways?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: PL/I equivalent of C's ifdef?

Post by Robert Sample »

Google pl/I conditional compilation for about 252,000 results. PL/SQL results won't help you but there are some hits on the first page of results for PL/I.
peeterjoot
Registered Member
Posts: 15
Joined: Fri Mar 03, 2017 2:01 am
Contact:

Re: PL/I equivalent of C's ifdef?

Post by peeterjoot »

I see some examples of conditional compilation, such as:

https://supportline.microfocus.com/docu ... pfmcro.htm

%IF A = 'CONTROL_1'
%THEN %DO;
RES = B + F(X);
%END;
%ELSE %DO;
RES = B - F(X) + SQRT(X);
LST = F(X) + 1;
%END;

However, it isn't clear to me that there is any equivalent to C's '#if defined' in PL/I. If this is possible, I'd like to see an example of such a construct (how it is coded in the PL/I source and what the equivalent of -D would be in the compilation command).
User avatar
Akatsukami
Global Moderator
Global Moderator
Posts: 122
Joined: Tue Oct 20, 2015 3:20 am
Location: Bloomington, IL
Contact:

Re: PL/I equivalent of C's ifdef?

Post by Akatsukami »

Again noting my lack of recent experience in C, I do not believe that there is any real equivalent to #ifdef in the PL/I preprocessor. For certain limited functionality you could use the %SYSPARM function and the %IF statement.
"I come to the conclusion that, men loving according to their own will and fearing according to that of the prince, a wise prince should establish himself on that which is in his own control and not in that of others." -- Niccolò Machiavelli
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Assembler & PL/I.”