Thanks for the hints folks suggested. It turns out that the PL/I
preprocessor does make this easy, via something like:

%Dcl Forn Char;

%if Uppercase(Dyn) = 'YES' %then %do ;

    %Forn = ', fetchable';

%end;

%else %do;

    %Forn = '';

%end;

 

Then you just include the Forn variable in the function prototypes, where it
appears as null or “, fetchable”.

 

I had some problems with this because I was using a preprocessor variable
named DYN and my test program was also DYN. That meant that the “end dyn;”
statement at the end of the program became “end yes;”, which the compiler
didn’t much like. So yes, I used much longer variable names that nobody
should ever trip over!

 

While it’s a neat facility, I don’t see any way to override it. If you think
of CLIST or CMS EXEC/EXEC 2, variables were indicated by an &. Rexx variable
use is more “natural”, but you can override it by quoting, and it doesn’t
interpret keywords as variables. I tried, and “end 'dyn';” does NOT
work—PL/I doesn’t like the quotes (plus you couldn’t really quote every
keyword and still read the program).

 

This seem potentially nasty: if you set a variable named DECLARE, all your
DECLARE statements are now…something else. That feels like a huge security
issue: you %include some member and hilarity ensues (“PL/I injection”??). Or
just as a joke, back when we printed listings) defining SKIP as PAGE and
watching someone use a box of greenline for a short program...

 

My dad once told me that he’d seen a PL/I program in South America somewhere
in which the language itself was Spanish—the keywords etc. So “si” for “if”
(not to be confused with “yes”!) and “más hacer” for “else do”, etc. I’m now
suspecting this was done using the preprocessor.

 

I suppose it’s a bit late to APAR this.

 

(Thanks to a list-mate here whom I won’t name, who did the real work on
this—he’s welcome to out himself if desired [yes I just indicated gender])

 

...phsiii


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to