Oppolzer - Informatik / Blog


Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie

PL1-L - Frage zum PL/1-Preprozessor (Makroparameter)

Subject:

preprocessor questions - again

From:

Bernd Oppolzer <bernd.oppolzer@T-ONLINE.DE>

Reply-To:

PL1 (language) discussions <PL1-L@LISTSERV.DARTMOUTH.EDU>

Date:

2014.02.28 17:02:10


Hello all,

I have some questions regarding the PL/1 preprocessor, again. I have to admit,
that I am a beginner with PL/1 macro language.

I have coded a preproc procedure, which I posted already some time ago:

  %XTRACEL: PROC (X);

           DCL X CHAR;
           DCL R CHAR;

           R =      'ZAKQTRCP IF_PRINT_TRACE_LEVEL ';
           R = R !! '   (TRACE_LEVEL_DIAGNOSTIC) ';
           R = R !! '   L(''['' !! PGMNAME !! '']'' !! ';
           R = R !! X !! ')';
           R = R !! 'ENDIF_TRACE;';
           ANSWER (R) SKIP;

           %END;

Now, if I call this, and the argument contains an identifier X, this argument
get's handled in a strange way ... at least not in a way that I expected it:

  XTRACEL ('DATEN (X) = ' !! DATEN (X));

I get an error "missing subscript for DATEN" or similar, because the output
contains DATEN() ... the X has been omitted.

To narrow this further down, I wrote another preproc function:

  %DCL TESTL    ENTRY SCAN;

  %TESTL:  PROC (X);

           DCL X CHAR SCAN;
           DCL R CHAR;

           R =      'PUT SKIP LIST (' !! X !! ');';
           ANSWER (R) SKIP;

           %END;

I simply want the argument X to be put into the PUT SKIP LIST statement.

But again, if the argument contains X, something strange happens (without the
SCAN attribute on X, I got "too large number of rescans").

Now the result for

   TESTL ('DATEN (X) = ' !! DATEN (X));

is the following (from the compile listing):

       153.0
       153.0     1  1            PUT SKIP LIST ('DATEN (X) = ' !! DATEN
                        ('DATEN (X) = ' !! DATE
       153.0     1  1   N (X)));;

that is: the X (inside X) is replaced again (once) by the value that X had on
entry to the procedure.

What can I do to get around this? What am I doing wrong?

This is EP PL/1 V3.9.

Thank you, kind regards

Bernd

Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie