Friday 28 February 2020

Find Records Between Specific DateTime Range | SQL

This Query is written in DB2 with Maximo on Workorder table, but I believe its the same for almost all.


SELECT w.reportdate
,to_date(to_char(CURRENT timestamp-1,'YYYY-MM-DD')||' 05:00:00','YYYY-MM-DD HH24:MI:SS' ) yesterday
,to_date(to_char(CURRENT timestamp,'YYYY-MM-DD')||' 05:00:00','YYYY-MM-DD HH24:MI:SS' ) today
FROM WORKORDER W
WHERE 1=1
--FETCH FIRST 10 ROWS ONLY
AND W.reportdate BETWEEN to_date(to_char(CURRENT timestamp-1,'YYYY-MM-DD')||' 05:00:00','YYYY-MM-DD HH24:MI:SS' ) AND to_date(to_char(CURRENT timestamp,'YYYY-MM-DD')||' 05:00:00','YYYY-MM-DD HH24:MI:SS' )

for Oracle: Use Sysdate instead of Current Timestamp

Tuesday 25 February 2020

Utilization of Logging in Maximo

FATAL - A message logged at FATAL level indicates that the error is very severe and will cause the application not to function at all. This level is used only by the Maximo application framework code to indicate that the Maximo application failed.

ERROR - A message logged at ERROR level indicates that the application would continue to run, but a specific functionality that's processed by the current thread failed and would continue to fail until the processing information is altered.

WARN - A message logged at WARN level indicates that the application would continue to run, but a specific functionality that's processed by the current thread may be operating on some data that might not be appropriate.

INFO - A message logged at INFO level indicates a general message that highlights the progress of the specific functionality that's processed by the current thread.

DEBUG - A message logged at DEBUG level indicates a general message that provides fine-grained information about the progress of the specific functionality that is being processed by the current thread.

NOTE: The DEBUG level is used to log messages that are useful for customers, support and development to diagnose problems in detail, but it is extremely verbose and should be used sparingly.


FATAL > ERROR > WARN > INFO > DEBUG

This means that if a logger is enabled for INFO level, it would accept FATAL, ERROR, WARN level messages and discards DEBUG level messages.



For more info please check this IBM Tech note Logging in Maximo

Tuesday 18 February 2020

Check Budget with Oracle ERP Through Publish channel and set flag 1 or 0 on PR and PO.

Check Budget with Oracle ERP Through Publish channel and set flag 1 or 0 on PR and PO.

Create End point for publish channel that needs to be used for Publish channel with ERP.

Publish Channel Endpoinnt = MEP

Define external system and publish channel for outbound transactions and Enterprise Service for inboaund transactions

Publish channel  = BDGT_CHECKINTERFACE
Enterprise Service = BDGTCHK_POINTERFACE

once everything is done for integeration side
Send request to ERP through automataion below.


create script with action launch point.
object = 'PO' , object = 'PR' in launch points.


import sys
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants
from psdi.util.logging import MXLogger
from psdi.iface.mic import MicService
from psdi.server import MXServer
from psdi.mbo import *
from psdi.webclient.system.session import WebClientSession
from time import sleep
from psdi.security import UserInfo
from psdi.server import MXServer

Uses of UIContext (bean) via automation Script | IBM Maximo

from psdi.common.context import UIContext

wclause = UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getResultsBean().getMboSet().getUserAndQbeWhere()

service.error("", wclause);

Monday 10 February 2020

Reconfigure DB2 after a Windows Hostname Change | DB2

1. replace the hostname in db2nods.cfg file at (c:\programdata\ibm\db2\db2copy\db2inst\)

2. open command prompt with admin rights and run these 2 commands to enable editing in registry

db2extsec –r

db2extsec /a DB2ADMNS /u DB2USERS

3. open registry editor (regedit), find and replace host name in all values

HKEY_LOCAL_MACHINE\Software\IBM\DB2