SM/SC: How to synchronize datadict (Data Policy) fields with the related dbdict (table)


Source: https://softwaresupport.hpe.com

A situation arose where the datadict (Data Policy) fields were not synchronized with the related dbdict (table) fields. This document describes how to re-synchronize the datadict with the dbdict.

Solution

A regeneration script is attached (Link to Unload or Link To Zipped Unload) to perform the synchronization. Note that the unload script can only add fields to the datadict, and cannot remove fields from the datadict.

In this example, the contacts datadict needed to be synchronized with the contacts dbdict. You can run the script using the Windows Client command line (the easiest approach) or use a format control to execute the script. Both methods are presented below:

To run the script using the Windows Client (thick client) command line:

1) Load the regen_datadict_1.unl under Database Manager.

2) Under the Windows Client command line, execute the following to run the script:

*sregen.datadict.1

3) The script should now open. Enter contacts for the dbdict Name and click on the OK icon. A message should appear under the messages view saying “contacts datadict regenerated successfully”

You may receive an error “No script record found for regen.datadict.1” on 9.30/9.31 doing the above

Here is another method — You can just run the script from the scripts.execute RAD app:

1. In the SM Command window, type ag
2. Press the [Enter] key
3. In the Application: field, type =script.execute
4. Search
5. Test
6. In the Parameter Name column, type name
7. In the Parameter Value column, type: regen.datadict.1

You should see it then asks for “Enter dbdict Name…”
8. put in cm3r (for example)
9. enter
You should see: cm3r datadict regenerated successfully.

10. End and check it

To run the script using a format control:

1) Load the regen_datadict_1.unl under Database Manager. + Add New Category
2) Open the contacts format control (FC) record.
3) Under the contacts FC, add the following two lines under initialization expressions:

contact.name in $file=nullsub(contact.name in $file, “madeupcontact”)
$script.name=”regen.datadict.1″

Check the “Run Script” checkbox.
Save the contacts FC record.

4) Under Database Manager, specify contacts for the table name and do a search. Select the record with a format name and file name of contacts.
5) The script should now open. Enter contacts for the dbdict Name and click on the OK icon. A message should appear under the messages view saying “contacts datadict regenerated successfully”

6) Remove the two lines added under the contacts FC record.

If the synchronization needs to remove fields from the datadict, as fields have been removed from the dbdict, the following workaround can be tried:

A) Make backups of the current dbdict and datadict (create unloads of both files).

B) Rename the current datadict for contacts to something like contactsORIG. The SQL Base Name field should be changed to contactsORIG as well.

C) Add a new datadict record named contacts. The SQL Base Name should be the same as the original (old) contacts datadict record. To create the record, you only need to supply the Name and SQL Base Name. The rest will be synchronized by the script. To add a datadict record, access Database Manager under administration mode, search for a table named datadict and then select the record with format name and file name as datadict. This approach should give you the option to add a record.

D) Run the synchronization script provided by the unload. If you go back and check the datadict after running the script, the fields from the dbdict should now be populated. Check the datadict/datadict view against your old contacts datadict record as well, just to make sure that no additional settings were missed from the old record.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s