Maximo Application Suite

MAS – Techno‑Functional

Search This Blog

Sunday, April 16, 2023

MAXIMO : DBC-Scripts for Quick and Easy Migration

Are you looking for a way to migrate changes in Maximo? 

Look no further than DBC script! 

This expert guide explains how it works and offers tips for optimal effectiveness. 

MAXIMO : Automation Scripts Quick Overview

 Maximo Automation

Script

Automation scripts are a powerful Maximo feature that allows you to

automate your business processes. They enable you to create a

custom application and process the data with just a few clicks.



Kindly refer attach PDF for overview

Click here to download PDF here

Monday, February 13, 2023

MAXIMO : Run SQL statements from Automation Scripts

This article details  Maximo automation script  needing to execute plain SQL statements instead of Maximo Mbo and MboSet related methods.


Broadly there are two way's to handle SQL statement exeuction , first is you can simply follow standard java.sql package and use respective connection and allied objects and the next which is recommended one is to use maximo DBShortcut class from framework which supports connection pool optimized way in terms of performance/resource usage and clean up aspects.

Below are sample code snippet which can show how to use these two approaches

1. JDBC Connection:

  from psdi.security import UserInfo

from psdi.server import MXServer
 
vsql = "update workorder set priority='1'
         where wonum=1002"
 mxserver = MXServer.getMXServer()
conKey = mxserver.getSystemUserInfo().getConnectionKey()
cnx = mxserver.getDBManager().getConnection(conKey)
stmt = cnx.createStatement()
stmt.executeUpdate(vsql)
 
stmt.close()
cnx.commit()
mxserver.getDBManager().freeConnection(conKey)

2. DBShortcut Class:

  from psdi.mbo import DBShortcut, SqlFormat

from psdi.server import MXServer
 
vsql = "update workorder set priority='1' where wonum=1002"
 
mxserver = MXServer.getMXServer()
conKey = mxserver.getSystemUserInfo().getConnectionKey()
dbs = DBShortcut()
dbs.connect(conKey)
 
sqf = SqlFormat(vsql)
dbs.execute(1, sqf)
dbs.commit()
dbs.close()

MAXIMO - DBC Script Guide

 Here I am sharing IBM guide for DBC.

This will be helpful DevOps automation towards most of maximo configuration migrations put under typical pipeline tools like Jenkins.


DBC XML Format.pdf

Wednesday, September 14, 2022

MAXIMO : Performance Best Practices - MboSet

 This article details  java /script based customization best practices when getting MboSet and related Mbo's for business logic.

Broadly there are two way's to fetch MboSet in the code.  Either using relationships be it those defined in database configurations or through dynamic relationships being created within Code , or using MXServer class.

There are times when we need to use one of these approach to fetch required MboSet and its not like never use MXServer to fetch MboSet which is misconception many folks have as part of Maximo coding standards or guidelines.

Here I would be discussing more specifically on MboSet being fetched via MXserver  and required considerations while using this approach , lacking it would have serious concerns around memory cleanup/OOM or stuck thread issues or sometimes even undesirable or inconsistent results.

Below are are rules of guidelines to be considered while getting MboSet from MXServer reference.

1. setwhere() and reset()

Almost all the time you should have dedicated where-clause to be applied when MboSet is fetched via MXserver  as without that it will load all the records from  set into memory ( as per fetch limit)  will be both performance heavy and in-effective memory usage . Hence setwhere() should be used to filter for appropriate criteria to load required data only. Then reset() is actually doing getting data from database as per applied clause in setwhere() into the memory.

MboSetRemote assetSet = MXServer.getMXServer().getMboSet("ASSET", getUserInfo());
assetSet.setWhere("LOCATION='BEDFORD'and status='OPERATING'");
assetSet.reset();

2. In case this set is being fetched to add new records and not for traversing current records

the ideally sethwere should be something like below to get empty set

assetSet.setWhere("1=2");
assetSet.reset();

3. If set is to be used only for traversing the record without any add/update/deletion then it should have DISCARDABLE flag set to true so it wont consume memory and dont get included in cached in memory and will be always readonly.

assetSet.setFlag(DISCARDABLE, true);

4. Additionally if set being fetched is not to be saved  then NOSAVE flag can be set to its not get included in respective transaction.

 assetSet.setFlag(NOSAVE, true); 

5. Incase set is fetched from MXServe it wont get automatically included in MXTransaction and hence save() should be explicitly called for any data add/change operations on set else it will be lost. This is not required when MboSet is fetched via relationships or through coding dynamic relationships.

Always call clear() and close() on the MboSet fetched from MXServer once it is certain that it is not required anymore. This releases the memory and the database resources. If the set is not closed, it will remain in memory till it is collected by the garbage collector which could be a long time

assetSet.clear();
assetSet.close();