IBM Support

Deadlock occurs when calling AdjustInventory for multiple items: XSL for sorting ItemID in XML for AdjustInventory API

Troubleshooting


Problem

Deadlock occurs when calling AdjustInventory for multiple items: XSL for sorting ItemID in XML for AdjustInventory API

Symptom

VERSION: Platform 5.0 SP4, or 7.3

Deadlock occurs when adjustInventory API called for similar items in bunches (multiple Items) as shown below

<adjustInventory><Items><Item AdjustmentType="ADJUSTMENT" OrganizationCode="DEFAULT" ProductClass="STD" ItemID="10991-0500" Quantity="50000.0" ReasonCode="TRANSIT" ShipNode="YD1" SupplyType="ONHAND" UnitOfMeasure="EACH"></Item><Item AdjustmentType="ADJUSTMENT" OrganizationCode="DEFAULT" ProductClass="STD" ItemID="19237-0010" Quantity="110.0" ReasonCode="TRANSIT" ShipNode="YS1" SupplyType="ONHAND" UnitOfMeasure="EACH"></Item><Item AdjustmentType="ADJUSTMENT" OrganizationCode="DEFAULT" ProductClass="STD" ItemID="40113-0001" Quantity="-1" ReasonCode="ADJUST" ShipNode="YS1" SupplyType="HELD" UnitOfMeasure="EACH"></Item><Item AdjustmentType="ADJUSTMENT" OrganizationCode="DEFAULT" ProductClass="STD" ItemID="40113-0001" Quantity="1.0" ReasonCode="ADJUST" ShipNode="YS1" SupplyType="ONHAND" UnitOfMeasure="EACH"></Item><Item AdjustmentType="ADJUSTMENT" OrganizationCode="DEFAULT" ProductClass="STD" ItemID="13419-0001" Quantity="-1" ReasonCode="ADJUST" ShipNode="YS1" SupplyType="HELD" UnitOfMeasure="EACH"></Item><Item AdjustmentType="ADJUSTMENT" OrganizationCode="DEFAULT" ProductClass="STD" ItemID="13419-0001" Quantity="1.0" ReasonCode="ADJUST" ShipNode="YS1" SupplyType="ONHAND" UnitOfMeasure="EACH"></Item></Items></adjustInventory>

Cause

Resolving The Problem

We could sort the items before feeding it to adjustInventory API. The way to get this done would be to have an XSL file that can give back the sorted output (Items) to the API. The following will prevent the deadlock from occurring.

XSL to be used:

<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0">
<xsl:template match="/">
<adjustInventory>
<Items>
<xsl:for-each select="adjustInventory/Items/Item">
<xsl:sort select="@ItemID"/>
<xsl:sort select="@ProductClass"/>
<xsl:sort select="@UnitOfMeasure"/>
<xsl:element name="Item">

<xsl:attribute name="AdjustmentType">
<xsl:value-of select="@AdjustmentType"/>
</xsl:attribute>

<xsl:attribute name="OrganizationCode">
<xsl:value-of select="@OrganizationCode"/>
</xsl:attribute>

<xsl:attribute name="ItemID">
<xsl:value-of select="@ItemID"/>
</xsl:attribute>

<xsl:attribute name="ProductClass">
<xsl:value-of select="@ProductClass"/>
</xsl:attribute>

<xsl:attribute name="Quantity">
<xsl:value-of select="@Quantity"/>
</xsl:attribute>

<xsl:attribute name="ReasonCode">
<xsl:value-of select="@ReasonCode"/>
</xsl:attribute>

<xsl:attribute name="ShipNode">
<xsl:value-of select="@ShipNode"/>
</xsl:attribute>

<xsl:attribute name="SupplyType">
<xsl:value-of select="@SupplyType"/>
</xsl:attribute>

<xsl:attribute name="UnitOfMeasure">
<xsl:value-of select="@UnitOfMeasure"/>
</xsl:attribute>
</xsl:element>
</xsl:for-each>
</Items>
</adjustInventory>
</xsl:template>
</xsl:stylesheet>

[{"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

PRI49522

Product Synonym

[<p><b>]Fact[</b><p>];

Document Information

Modified date:
16 June 2018

UID

swg21550684