Friday, 9 September 2022

Using DBC Scripts in Maximo in Windows environment

 DBC (Database Configuration) scripts are a powerful way to customize your system, such as adding new attributes to existing objects. In this post, we’ll walk through practical examples, including creating a custom attribute in the Asset object and generating DBC scripts from an autoscript

Example 1: Adding a Custom Attribute to the Asset Object

Suppose we want to add a Maintenance Cost attribute to the ASSET object. Here’s the step-by-step process:

1. Create a DBC Folder

Create a folder to store your DBC script:

mkdir D:\IBM\SMP\maximo\tools\maximo\en\aq

2. Create the DBC File

Create a new DBC file aq_add_cost_to_asset.dbc in the folder:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE script SYSTEM "script.dtd"> <script author="aq" scriptname="aq_add_cost_to_asset"> <description>Adds Maintenance Cost to the Asset</description> <statements> <add_attributes object="ASSET"> <attrdef attribute="ZZMAINTCOST" title="Maintenance Cost" maxtype="AMOUNT" remarks="Maintenance Cost for the Asset" persistent="true" required="false"/> </add_attributes> </statements> </script>

 

Tip: You can also add other fields with different types, domains, default values, or lengths. Example:

maxtype="ALN" length="45" localizable="false" domain="COBIESHEETTYPE" defaultvalue="string"

3. Run the Script

Navigate to the internal tools folder and run the DBC script:

cd tools\maximo\internal runscriptfile.bat -caq -faq_add_cost_to_asset

Check the log for details:

tools\maximo\log\MXServer_RUNSCRIPT_aq_add_cost_to_asset.log

After successful execution, restart your application server.


2: Releasing as a Product Update

After testing your DBC script, you can release it as a product update.

1. Create Product XML

Create a product XML file aq_product1.xml:

<?xml version="1.0" encoding="UTF-8"?> <product> <name>Misk Inc. AQ Product</name> <version> <major>7</major> <minor>6</minor> <modlevel>1</modlevel> <patch>2</patch> <build>20200715-0100</build> </version> <dbmaxvarname>aq1</dbmaxvarname> <dbscripts>aq</dbscripts> <dbversion>V7612-01</dbversion> <lastdbversion>V7612-00</lastdbversion> </product>

2. Run the Database Update

Navigate to the tools folder and update the database:

cd tools\maximo updatedb.bat

Updatedb Lifecycle Notes:

  1. Processes all scripts in the tools\maximo\en\script folder.

  2. Looks for product XML files in alphabetical order.

  3. Handles dependencies specified with the <DEPENDS> element.





Example 2: Generating automatic DBC from an Autoscript

You can automatically generate a DBC from an existing autoscript using geninsertdbc.bat. For example, to extract the CREATEPR autoscript:

geninsertdbc.bat -tautoscript -w"autoscript = 'CREATEPR'" -ftestautoscript -caq

Run the generated script:

runscriptfile.bat -caq -ftestautoscript

The log output will show:

Log file: GenInsertDbc_testautoscript.log Output file: d:\IBM\SMP\maximo\tools\maximo\en\aq\testautoscript.dbc RunScript complete: Successful

Conclusion

DBC scripts are essential for customizing Maximo without modifying the core database manually. Whether adding new attributes, updating tables, or generating scripts from autoscripts, this approach ensures your changes are structured, auditable, and maintainable.


No comments:

Post a Comment