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?%DCL RECSZ FIXED;
%RECSZ = 80;
%ACTIVATE RECSZ;
PL/I equivalent of C's ifdef?
-
- Registered Member
- Posts: 15
- Joined: Fri Mar 03, 2017 2:01 am
- Contact:
PL/I equivalent of C's ifdef?
I see that PL/I has macros. For example:
- Robert Sample
- Global Moderator
- Posts: 1900
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: PL/I equivalent of C's ifdef?
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.
-
- Registered Member
- Posts: 15
- Joined: Fri Mar 03, 2017 2:01 am
- Contact:
Re: PL/I equivalent of C's ifdef?
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).
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).
- Akatsukami
- Global Moderator
- Posts: 122
- Joined: Tue Oct 20, 2015 3:20 am
- Location: Bloomington, IL
- Contact:
Re: PL/I equivalent of C's ifdef?
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
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