Importing and exporting methods
Using the MDU’s import/export feature, you can export entries from one SMC and then import them into a different SMC. The export feature writes all the methods in the SMC to an XML file. You can then use the import feature to replace the entire catalog, update and add selected interfaces, or add selected methods. You can perform an import/export from within the MDU (see To import methods from the MDU and To export methods from the MDU) or from the command line, without displaying the MDU user interface (see To import and export methods from the command line).
Import/export can be used to do the following:
- Populate or update your SMC by importing interfaces in an XML file generated by the dbl2xml utility.
- Import the default methods normally distributed with the SMC. You can import these methods from defaultsmc.xml. This file, located in DBLDIR, contains XFPL_REGCLEANUP, XFPL_LOG, and the methods required by the test programs.
- Update your deployment SMC with data from your development SMC.
- Make global updates, such as changing an ELB name, by exporting the catalog, searching and replacing in the XML file, and then re-importing it. When editing the contents of the XML file, take care not to alter the XML structure.
- Create a new catalog that includes the methods in an XML file. This must be done from the command line. See To create new files by importing an XML file for details.
To import methods from the MDU
Before importing, you should verify that no one else is using the SMC files you are importing into.
1. | Open the SMC that you want to import methods into. You can do this from Main > Catalog Location, or you can restart the MDU and specify the catalog location on the command line. |
2. | From the methods list, select Utilities > Import Methods. |
3. | Complete the fields in the Import Details window: |
Select the type of import desired:
- Replace entire SMC. Select this option to replace the existing SMC with the data in the XML file. Note that this option completely deletes the existing SMC and then imports all the methods from the XML file.
- Update interfaces. Select this option to update individual existing interfaces in the current SMC, as well as add new interfaces.
- Add new methods. Select this option to add individual methods to the current SMC. You must use this option if you need to import only the XFPL_REGCLEANUP or XFPL_LOG method, as those methods are not in an interface.
XML file
Type the filename of the XML file that contains the data to import or select Functions > Browse to select it. (On Windows, you can click the drilldown button to select the file.) To import the default methods such as XFPL_REGCLEANUP, choose the defaultsmc.xml file located in your DBLDIR directory.
Log file
Enter a filename for the error log or accept the default name (import_smc.log). If no path is specified, the log will be created in the current working directory on OpenVMS and in the location specified with the TEMP environment variable on Windows and Unix.
4. | Select OK or press F3. |
If you selected “Replace entire SMC”, the data in the XML file will be imported immediately. See step 7.
If you selected “Update interfaces” or “Add new methods”, a list of items will display. On the Select Interfaces list, an X in the “In SMC” column indicates that the interface is present in the current SMC. If you select this interface for import, the existing interface in the SMC will be deleted and the one in the XML file will be imported.
If you selected “Add new methods”, you’ll see a list of either method names or method IDs, depending on the current toggle view setting. You can press Ctrl+V or select Functions > Toggle View while this list is displayed to switch the display. |
5. | Press Enter (on Windows, you can also double-click) to mark items on the list for import. An asterisk in the left column indicates an item is selected. To unselect an item, double-click or press Enter again. |
6. | Once you’ve selected all the items, select OK or press F3 to complete the import. |
To export methods from the MDU
If your SMC includes references to repository structures or enumerations, the repository must be present to do an export. This is because the export function reads the structure and enumeration details from the repository.
Upon export, structure sizes in the SMC are checked against the corresponding structures in the repository and the utility returns an error if there are any size discrepancies or if there are missing structures or enumerations. You can use the Verify Catalog utility to update the structure sizes in the SMC. See Verifying repository structure sizes and enumerations for details.
1. | Verify that the current SMC is the one that you want to export methods from. You can select Main > Catalog Location to check (or change) the location of the current catalog. |
2. | From the methods list, select Utilities > Export Methods. |
3. | At the prompt, type a name for the XML file, and then select Save or press Enter. |
To import and export methods from the command line
The mdu -i, -u, and -e options enable you to import and export SMC definitions from the command line without displaying the MDU user interface. Importing from the command line does not offer as many options as does using the MDU user interface: you cannot select individual interfaces or methods for import.
- -i imports all definitions from an XML file, replacing the entire catalog.
- -u updates an existing catalog by replacing interfaces of the same name and adding new interfaces.
- -e exports the entire catalog to an XML file.
For the MDU command line syntax see Method Definition Utility.