The better way to "x-out" macros in XPP style setups

I wanted to offer a better way to "x-out" macros in style setups.

Often when working with customer samples and composing them (or looking through the composition messages with View Log), I see lots of composition messages such as the following:

invalid xycode name (2) name = <xxmc;test;macro1;macro2>

It seems that many customers are in the habit of "x'ing out" macros in their style setups (by adding something like an "xx" prefix to the macro name) when they don't want them executed, but at the same time want them left "visible" when looking at the setup (probably in case they need to revisit the changes).

However, sometimes there are so many of these types of "error" messages that it's hard to pick out the significant composition errors. And when background queues are used to run many composition tasks, such "junk" error messages (en mass) can quickly cause queue log files to grow very large in size.

There's a better way to do this.

If you take a look at the xy_sys spec (in Lsyslib), you will see that the very first macro definition has a name of "__" (two underlines) and has an empty expansion. This definition was added years ago for use by import/export (toxsf/fromxsf) to "mark" non-XPP PI macros in the (SGML/XML) data on import so that they would be ignored by composition (and then on export the special "__ " prefix gets removed so that the data round-trips w/o any changes).

But this same mechanism can be used for macros within style setup that you want to be ignored (i.e. in xx and mx spec Expansion fields and in if spec Prestring, Poststring, and XML/SGML End fields).

So, for example, in an xx Expansion field instead of doing:

<xxmc;test;macro1;macro2>
<xxqa>

you would do:

<__;mc;test;macro1;macro2>
<__;qa>

You can also use this to do things like the following:

<__;/qa>
<mc;test;__(macro1);macro2> (as long as macro1 is not "skp" or "nul")
<mc;test;__(macro1,arg1,arg2),macro2>

The macro is still there, but by virtue of adding the "__" name it effectively gets ignored by composition (due to the empty expansion for the "__" macro) - and the bonus is that no "invalid xycode" error messages are output either. Now the composition error messages/logs are only filled with significant error messages.

Just to be clear, this suggestion is only in regards to the "style" setup within XPP; do not do this in the imported data (stream) itself.

Jonathan Dagresta
SDL XPP Engineering

Parents
  • Of course few people (except me) care about composition errors.
    And SDL is not to be pleaded free from this.
    Just do a compose of the all_well division  in the Shakespeare sample jobs (both CSS and classic) and have a look at the impressive composition log. 

    So people do not care about one more (or less) error, because they were never educated to care about this.

  • "So people do not care about one more (or less) error, because they were never educated to care about this."

    I agree that people were never educated to care about this. The education starts here!  Nerd

    After all, isn't this one of the big reasons for this forum (and for the XyUser Group forum, now incorporated here) - to share not just questions or requests for help, but also best practices?

    Yes, short term people only want to get work done, but long term being sloppy in this regard is going to probably bite you - one way or another.

    I've seen customer samples where 75% of the composition error messages were of this x'd-out-macro type. I've seen customer macro definitions which included 40 x'd out macros (and so composition of just that one macro would cause 40 composition error messages). And so on.

    I'm not expecting that everyone will go through and "rewrite" all their setups; it's just something to keep in mind going forward (for those still using classic macros).

    "And SDL is not to be pleaded free from this.
    Just do a compose of the all_well division in the Shakespeare sample jobs (both CSS and classic) and have a look at the impressive composition log."

    Also true, although I'm not sure why you think the all_well Shakespeare sample jobs fall into this category I'm discussing, since I just composed them and there's not a single occurrence of an error message with an x'd out macro.  Thinking  There will always be some composition messages (and a lot of them too, if there are a lot of pages).

    Personally, I've never written any XPP style stuff - it's just not part of my job. But I do see a lot of it.  Slight smile

    Jonathan Dagresta
    SDL XPP Engineering

  • Jonathan,

    Yes let the education on the rules for a good xpp style setup start here....

    I fully agree with your statement: 
    "Yes, short term people only want to get work done, but long term being sloppy in this regard is going to probably bite you - one way or another"
    Believe me in my over 30 years of experience of helping people with their xpp system, I have seen more than my share of sloppy setups turning into a maintenance nightmare.

    But I have to disagree with you when you say: "there will always be some composition errors and a lot of them if there are a lot of pages". And I certainly disagree when it is a job as simple as the Shakespeare job.
    With a little more love and care it is perfectly possible to set up your styles so that there are NO composition errors (unless there is a real error or exceptional situation). 

    Composition and pagination errors should only be generated when a page or line falls out of spec. If you get a lot of pagination or composition errors, you have set up your rules too tight and you should relax your rules and give the system more flexibility in resolving problem situations.

    When you do an initial test setup and you get a lot of errors, you need to put the extra effort in your style setup to tune these down to an absolute minimum. The big reason for this is that otherwise the errors become meaningless as they are not 'errors'. This will create the unfortunate situation that the operator will simply ignore the composition log because it is full of 'errors' which are perfectly fine. Like that there is a big chance that real errors get overlooked. 

    The base rule for a good setup is very simple: an error should only be generated when there is a true error condition.

    And I will repeat again what I said: the Shakespeare job is a bad example of a good xpp setup. It could and should be done a lot better. 

  • Maybe we need to start a new discussion item:
    "Why you should always aim for 0 composition or pagination errors when you are setting up styles in XPP"
    GrinningGrinning

  • Maybe this should be a session come October.

  • We ran into a situation where we were calling "compose" via XPP Web Services 1.2 with XPP 8.4, and the call would fail, but we were able to compose the division from PathFinder. It turned out that, since the "Compose" command returned the compose log contents, once the log file got to be around 8 megabytes in size, the web service call would fail. In our case, the errors were almost all typos and old code that people didn't clean up. Once we fixed those obvious problems, the log file size was more like 30 or 40 KB.

    Now, that 8 MB limitation may not apply in the latest version of XPP WS, or with the REST API, but it demonstrates how you can get unexpected side effects if you don't pay attention to the compose log.

  • Both XPPWS 1.3 and XPPrest stopped returning the logfile in the compose call for just this reason. It was more important in the SOAP rest because responses end up in XML and it can get inefficient when there is a lot of data returned. XPPrest could have handled it, but there was no reason to return the log.

    And to get the log after the compose, you can do a "get file" on job.log.

    So you can upgrade to XPPWS 1.3 if you like. It is upwards compatible and should solve this problem.

  • Although this would be impossible with the wretched "Forward reference" 'errors' - unless this has been resolved already?

Reply Children