Skip to main content

Is there a way to search through all InfoSphere Master Data Management Server for Product Information Management scripts for a keyword?


Technote (FAQ)


Question

InfoSphere Master Data Management Server for Product Information Management offers no tools to search for keywords within scripts stored in the docstore. A short script can be run in the script sandbox to do the job.

Cause

If the InfoSphere Master Data Management Server for Product Information Management scripts are stored exclusively within the product's "Document Store" and not at the file system level on the server, then they cannot be searched from the system command line. InfoSphere Master Data Management Server for Product Information Management offers no search tools for document store files.

Answer

The following script can be run from the scripting sandbox within InfoSphere Master Data Management Server for Product Information Management to search for a string within the text of all InfoSphere Master Data Management Server for Product Information Management scripts. You must first replace the string in the "target =" line with your target string.

// Script to search all script files for a keyword string.
// Returns filename, line # and line text.

var target = "YOUR KEYWORD";
var scripts = getDocStoreFilesInDirectory("scripts/triggers");
var numOfDocs = scripts.size();
var hitCount = 0;
out.writeln("Searching " + scripts.size() + " files.");

for (var i=0; i< numOfDocs ; i++)
{
var rdr = new Reader(scripts[i]);
var lineNum = 0;
var printName = 1;
var line = null;
forEachLine(rdr, line)
{
lineNum++;
if (line.contains(target))
{
hitCount = hitCount + 1;
if (printName == 1)
{out.writeln("----- "+scripts[i]);
printName = 0;
}
out.writeln(lineNum+" :: "+line);
}
} // forEachLine
rdr.closereader();
} // for
out.writeln("---------------------------------------------");
out.writeln("Found " + hitCount + " lines containing \"" + target + "\".");

Cross reference information
Segment Product Component Platform Version Edition
Information Management InfoSphere Master Data Management Collaboration Server Not Applicable AIX, Linux, Solaris, Windows 10.0 All Editions

Product Alias/Synonym

MDMPIM
MDM Server for PIM
WebSphere Product Center
InfoSphere MDM Server for PIM
InfoSphere Master Data Management Server for Product Information Management
InfoSphere Master Data Management Collaboration Server

Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

InfoSphere Master Data Management Server for Product Information Management

Document Store


Software version:
6.0, 6.5, 9.0, 9.1


Operating system(s):
All Platforms


Software edition:
Enterprise


Reference #:
1206645


Modified date:
2012-11-07

Translate my page

Content navigation