Reply To: Can I use a variable within the Path?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Can I use a variable within the Path? Reply To: Can I use a variable within the Path?

#57578
Charlie Bursell
Participant

    That’s not how you would use it.  Get the variable you want to use to increment the address and use it as part of the address in the xmpstore.  The variable could be @cnt that you passed in.

    Assume you are passing a value in and a cnt in @ cnt in that order.  The ob address is the base address to store the data plus @cnt for update.

    # Get the value and the cout

    lassign $xlateInVals val cnt

    # Get the two OB addresses

    lassign $xlateOutList valAddr cntAddr

    # Assume you know address is something like :

    # 0(0).PID(0).00133 and you want it to be

    # 0(0).PID(CTR).00133

    regsub — {PID(0)} $valAddr “PID($cnt)” valAddr

    # Increment the counter

    incr cnt

    # store the count

    xpmstore $xlateId $cntAddr c $cnt

    # Store the value

    xmpstore $xalteId $valAddr c $val

    This is off the top of my head.  I think its right but I may have fat-fingered something.