PL/I Preprocessor output can be saved in a file, It's a compiler option.

Your example could be done like this:-

%seta: procedure (a1, a2);
   declare (a1, a2) character;
   answer ('SET ADDRESS OF ' || a1 || ' TO ' );
   answer ('ADDRESS OF ' || a2 );
%end seta;
%activate seta;

I don't know what the preprocessor will think of
the other COBOL statements.
______________________

From: "Patrick Roehl" <u...@roehl-consulting.com>
Sent: Tuesday, 22 November 2011 10:07 AM


Naturally there was a snag using the C pre-processor with COBOL syntax.
One line of code in the first source module attempted was molested â?" just
one out of about 9000:

MOVE '??' TO QPE-SET-OPTS

Resulted in

MOVE '  TO QPE-SET-OPTS

In addition, the C preprocessor complained about virtually every line
processed because if wasnâ?Tt C code.  Very messy.

The HLASM option (my original thought) also looks messy because the source
has to be adjusted with PUNCH statements.  I also was hoping for a macro
function, which the C preprocessor (although crude) worked for what I
needed.

Doing all of this in Rexx seems like reinventing the wheel if the PL/I
preprocessor will do the job. Unfortunately I have zero experience with
PL/I.  (However, it is installed on my zPDT machine.)

Would a PL/I pro point me toward an example of using the PL/I preprocessor
only?  Ideally the preprocessor output could be captured without invoking
the compiler phase.

The following C preprocessor code worked well for formatting code so that
it would work on either z/OS or VSE:

#ifdef _vse
#define SETA(var_ptr1, var_ptr2) \
CALL 'OBXBSETA' USING WK-PTR, \
                     var_ptr2 \
SET ADDRESS OF var_ptr1 TO WK-PTR
#else
#define SETA(var_ptr1, var_ptr2) \
SET ADDRESS OF var_ptr1 TO \
   ADDRESS OF var_ptr2
#endif

The macro takes parameters, and depending on the environment generates
different code.  In the COBOL code to be processed, this would appear:

SETA(WK-FIELD-1, WK-FIELD-2)

And this would be generated (if _vse was not defined):

SET ADDRESS OF WK-FIELD-1 TO
   ADDRESS OF WK-FIELD-2

How would the equivalent PL/I preprocessor statements look like?

Which compiler and/or preprocessor options would work best?

Can the preprocessor output be captured to a file?

Reply via email to