Help save net neutrality! Learn more.

zwrite gems

  • George James

    George James - 2009-04-28

    I just discovered that zwrite accepts arbitrary expressions as range arguments for subscripts.  This is not mentioned explicitly in the documentation and, as far as I can decipher, it is only vaguely implied from an example that uses ":" as an expression.

    So what?  Well, it's quite common to have globals that go something like this:

    With this newly discovered zwrite capability I can now easily look at the last few transactions by doing this:

    GTM>zwr ^transaction(^transaction-10:)

    This is the equivalent of the more long winded:
    GTM>w ^transaction
    GTM>zwr ^transaction(123446:)

    I expect zwrite contains other hidden gems.  If you know of any please share them.


    • K.S. Bhaskar

      K.S. Bhaskar - 2009-04-28

      George --

      I guess the documentation could have been clearer, but...

      In general, the Programmers Guide uses and builds on the meta-language used in the M standard (ISO/IEC 11756:1999).  The documentation for ZWRite describes the command as accepting a series of comma separated zwrglvns.  Since the intent is that zwrglvn syntax is a superset of glvn syntax, the Programmers Guide describes the ways in which zwrglvn is more than glvn.  So, glvns are entirely acceptable for ZWRite.

      Hope this helps.  We will consider adding more examples when the Programmers Guide is updated.  Thanks for your comments.

      -- Bhaskar

      • George James

        George James - 2009-04-29

        The implication that zwrglvn extended glvn was probably what I was overlooking.

        What I really miss from zwrite is the ability to list all the subscripts at a given level, including pointers, not just defined nodes.

        For example with this global:
        GTM>zwr ^g

        I'd like to know what subscripts exist at level 2, perhaps something like this:

        GTM>zwr ^g(1,@)

        Perhaps there's a way of doing this that I just don't know about?


Log in to post a comment.