Here’s the companion script for the “Using pmrep to export an Informatica folder” article. Use this script to import objects into PowerCenter.
One use for scripting an import would be to schedule it during off hours, for example moving development code to production during off hours. You may also need to export some objects, then do a "mass change" or Find/Replace on the XML file, then export them back in (for example, export all sessions, find/replace a connection).
Overview of ObjectImportHere is the basic object import syntax:
pmrep objectimport -i m_mapping_name.xml -c import_Infa_Objects_Control.txtThe pmrep objectimport function is easy to use, it is a little different however, in that you are required to use a “control file”, designated by the "-c", to define what PowerCenter folder and repository the objects will be imported into. There is an example Control File at the end of the article with important sections highlighted.
You must also use the control file to specify how to resolve conflicts, “Replace”, “Reuse”, etc., (see the RESOLVECONFLICT section). You can choose the option to generically “replace” all objects or you can specify Replace or Reuse by object type as defined in the TYPEOBJECT keyword, for example in the control file below, I choose to replace workflows but reuse schedulers.
Optionally, using the keyword TYPEFILTER, you can use the control file to filter which object types will get imported (applicable if you have a folder with many objects and various object types but only need to import a subset of those)
My script has two imports options, one to import a single object and the other option will loop over a folder containing multiple objects to import , you can use either one depending on your requirement, just comment out the object import you don't need. Download the script and control file here
Example Control File
A word of caution, if you export Mappings that have SAP ABAP and import them back into the repository, replacing the mapping, you may have an issue where the mapping save time is newer than the ABAP generation time and the session will no longer run.
Thank you for your support