• Adi Jaradat

Decommissioning Locations

Updated: Jun 21

Maximo Decommissioning Locations! Locations in Maximo are key information to organize your locations and equipment and to start your maintenance work. You can safely think about locations as the groundwork for gathering and tracking information about equipment history, future, and performance.


It is rare to have your locations setup in flat structure, most organization organize their locations in hierarchical fashion. It is a great feature that provides numerous advantages but at the same time it makes some tasks a bit trickier.

Maximo Decommissioning Locations

Maximo Decommissioning Locations

Once a location is created, it is usually associated with a system and a parent so that it becomes part of a hierarchy. Once the hierarchy is created you can view the hierarchy tree using the “Drilldown” functionality.

The “Drilldown” functionality is quick and easy but it by definition it is also limited. I covered, in a previous post, how to write a query to construct the locations hierarchy and of course you can attach additional information to that query to build a tool, possibly report, to target a specific business need.


Another interesting feature of the locations is that each location can have a status. The location status resembles the high-level phases of a location:

Let’s focus on the “DECOMMISSIONED” status, when a location is decommissioned it is effectively a history record and cannot be used in Work Orders. Decommissioned locations are useful because they hold a lot of historical information which can be used at later stage.


When you try to decommission a location, Maximo considers all master data that are associated with that location. For example:

  1. Child Locations

  2. Assets

  3. Job Plans

  4. Routes

  5. Safety Plans

  6. PMs

The system provides you with options to roll down changes to all affected master data records and it works by crawling down the location hierarchy and processing each location.


Before decommissioning a location, Maximo has a pre-requisite internal checks to be verified before the location is finally decommissioned. Those checks are instrumental to maintain the data integrity and not break things after a location has been decommissioned. So often when you try to decommission a location Maximo will halt the operation and alert you that this location, or one of its dissectors, is referenced in an open/active records!


To make things simple, it pays off to have a logic to go through those checks in advance and provide a comprehensive list of all open/active records which will cause the decommissioning operation to be interrupted. Having such information helps saving time by having a “To-Do” list of records to be taken care of before attempting to decommission any location.


The following code will help you to extract a list location decommissioning prerequisites:


WITH LOCATIONS_SET AS (
    SELECT DISTINCT LOCHIERARCHY.SITEID
          ,LOCHIERARCHY.SYSTEMID
          ,LOCHIERARCHY.LOCATION
          ,LOCATIONS.DESCRIPTION
          ,LOCATIONS.TYPE
          ,LOCATIONS.GLACCOUNT
          ,LOCHIERARCHY.PARENT
          ,LOCATIONS.STATUS
      FROM LOCHIERARCHY
          ,LOCATIONS
     WHERE LOCHIERARCHY.LOCATION=LOCATIONS.LOCATION
       AND LOCHIERARCHY.SITEID=LOCATIONS.SITEID
       AND LOCHIERARCHY.SITEID='MY_SITEID'
       AND LOCHIERARCHY.SYSTEMID='PRIMARY'
       AND LOCATIONS.STATUS NOT IN ('DECOMMISSIONED')
)
, LOCATIONS_HIERARCHY AS (
    SELECT DISTINCT LS.*
          ,LEVEL AS HIERARCHY_LEVEL
          ,SUBSTR(SYS_CONNECT_BY_PATH(LS.LOCATION, ' / '), 3) AS HIERARCHY_PATH
      FROM LOCATIONS_SET LS
START WITH LS.PARENT IS NULL
CONNECT BY NOCYCLE PRIOR LS.LOCATION=LS.PARENT
)
, DATA_SET AS (
    SELECT DISTINCT LDS.*
          ,'WORKORDER' RECORD_NAME
          ,A.WONUM RECORD_VALUE
          ,A.STATUS RECORD_STATUS
      FROM WORKORDER A
          ,LOCATIONS_HIERARCHY LDS
     WHERE A.SITEID=LDS.SITEID
       AND A.LOCATION = LDS.LOCATION
       AND A.HISTORYFLAG = 0
UNION ALL
    SELECT DISTINCT LDS.*
          ,'MR' RECORD_NAME
          ,A.MRNUM RECORD_VALUE
          ,A.STATUS RECORD_STATUS
     FROM MR A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.LOCATION = LDS.LOCATION
      AND A.SITEID=LDS.SITEID
      AND A.HISTORYFLAG = 0
UNION ALL
    SELECT DISTINCT LDS.*
         ,'PO' RECORD_NAME
         ,A.PONUM RECORD_VALUE
         ,(SELECT STATUS FROM PO WHERE PONUM=A.PONUM) RECORD_STATUS
     FROM POLINE A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.LOCATION= LDS.LOCATION
      AND EXISTS (SELECT 1 FROM PO WHERE PO.PONUM=A.PONUM AND PO.HISTORYFLAG = 0 AND PO.SITEID = A.SITEID)
      AND A.SITEID = LDS.SITEID
UNION ALL
    SELECT DISTINCT LDS.*
         ,'PR' RECORD_NAME
         ,A.PRNUM RECORD_VALUE
         ,(SELECT STATUS FROM PR WHERE PRNUM=A.PRNUM) RECORD_STATUS
     FROM PRLINE A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.LOCATION= LDS.LOCATION
      AND EXISTS (SELECT 1 FROM PR WHERE PR.PRNUM=A.PRNUM AND PR.HISTORYFLAG = 0 AND PR.SITEID = A.SITEID)
      AND A.SITEID = LDS.SITEID
UNION ALL
    SELECT DISTINCT LDS.*
         ,'COLLECTION' RECORD_NAME
         ,A.COLLECTIONNUM RECORD_VALUE
         ,NULL RECORD_STATUS
     FROM COLLECTDETAILS A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.LOCATION = LDS.LOCATION
      AND A.SITEID= LDS.SITEID
UNION ALL
    SELECT DISTINCT LDS.*
         ,'ASSET' RECORD_NAME
         ,A.ASSETNUM RECORD_VALUE
         ,A.STATUS RECORD_STATUS
     FROM ASSET A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.LOCATION=LDS.LOCATION
      AND A.SITEID = LDS.SITEID
      AND A.STATUS NOT IN (SELECT VALUE FROM SYNONYMDOMAIN WHERE MAXVALUE IN ('DECOMMISSIONED') AND DOMAINID='LOCASSETSTATUS')
UNION ALL
    SELECT DISTINCT LDS.*
         ,'PM' RECORD_NAME
         ,A.PMNUM RECORD_VALUE
         ,A.STATUS RECORD_STATUS
     FROM PM A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.LOCATION = LDS.LOCATION
      AND A.SITEID=LDS.SITEID
UNION ALL
    SELECT DISTINCT LDS.*
         ,'ROUTE' RECORD_NAME
         ,A.ROUTE RECORD_VALUE
         ,NULL RECORD_STATUS
     FROM ROUTE_STOP A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.LOCATION = LDS.LOCATION
      AND A.SITEID=LDS.SITEID
UNION ALL
    SELECT DISTINCT LDS.*
         ,'SAFETY' RECORD_NAME
         ,A.LOCATION RECORD_VALUE
         ,NULL RECORD_STATUS
     FROM SAFETYLEXICON A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.LOCATION = LDS.LOCATION
      AND A.SITEID=LDS.SITEID
UNION ALL
    SELECT DISTINCT LDS.*
         ,'WORKASSET' RECORD_NAME
         ,A.WORKASSET RECORD_VALUE
         ,NULL RECORD_STATUS
     FROM SPWORKASSET A
         ,LOCATIONS_HIERARCHY LDS
    WHERE A.WORKLOCATION = LDS.LOCATION
      AND A.SITEID=LDS.SITEID
)
   SELECT DS.*
     FROM DATA_SET DS
ORDER BY DS.HIERARCHY_PATH 


Links

https://adijaradat.com/post/follow-up-work-orders/

https://www-01.ibm.com/support/docview.wss?uid=swg21515066

22 views0 comments

Recent Posts

See All