Automic Workload Automation

 View Only

How to read a variable with ampersand

  • 1.  How to read a variable with ampersand

    Posted Nov 11, 2016 03:21 AM
    I have a UC4 job which reads a value from the read buffer and then sets a job plan variable using PSET.
    The value that is read contains an ampersand character i.e.   6+@}/r&M

    The PSET appears to work, however, the POST-CONDITIONS of the job fail – complaining that 'U1001308 Variable 'M' has not yet been defined.'.

    So, how can I pass a value containing an ampersand to a job without it failing in this way?

    The main problem is that the AE server will try to resolve strings as variables if they contain the "&" character.
    However this can probably be bypassed with the scenario below : store the value in a separate (STATIC) VARA object with :PUT_VAR, then retrieve it with GET_VAR.


    SCRI.AMPERSAND

    :READ &AMPERSAND# ,,"Type in a string that contains &"
    :PUT_VAR VARA.AMPERSAND,"value",&AMPERSAND#
    :SET &RESULT# = GET_VAR(VARA.AMPERSAND,"value")
    :P Your string is &RESULT#
    Then start :

    orsmg6pls10l.pnghttps://us.v-cdn.net/5019921/uploads/editor/6y/orsmg6pls10l.png" width="366">

    VARA.AMPERSAND is populated :

    53c2l6r58s8f.pnghttps://us.v-cdn.net/5019921/uploads/editor/9p/53c2l6r58s8f.png" width="345">

    And the report contains the expected value :
    kcndtcvrqmbj.pnghttps://us.v-cdn.net/5019921/uploads/editor/7q/kcndtcvrqmbj.png" width="521">

    Best regards,
    Antoine