CodeGen is a tool that Synergy/DE developers can use to generate source code and other types of content based on the meta-data stored in a Synergy Repository.
I wanted to use CreateFile to create a file for testing ODBC, but it failed because the Repository structure had access keys and foreign keys interspersed, instead of listing all access keys before foreign keys. While fixing this issue, I found a few other areas where the program could be improved to make it more useful. Here are the changes that I made, to the best of my recollection:
Added command line options -rm and -rt to explicitly specify Repository main and text files. I added these to help test my changes from Visual Studio, but they may be helpful in other cases as well.
Updated usage info to show a new version number and describe updated features, and formatted text better for an 80-column window.
Added the ability to create a file directly from a Repository structure when no matching file is defined in the Repository. This requires an explicit filespec specified with the -out option, and will generate a warning.
Updated list of segment types to include 'C' (create timestamp).
Fixed test for existing ISAM file (by specifying "i:i" open mode).
Fixed issue where a Repository structure that intersperses access keys and foreign keys caused file creation to fail with an index out of range error.
Fixed issue where segment types weren't set correctly for multi-segment keys with different key types for different segments. Note that we are getting segment type from the key definition and not the underlying field definition, so types may be incorrect if not explicitly specified in key definitions.
Fixed issue where the lack of an explicit VALUE_NULL for an alpha non-replicating null key caused file creation to fail with "Illegal key specified".
I wanted to use CreateFile to create a file for testing ODBC, but it failed because the Repository structure had access keys and foreign keys interspersed, instead of listing all access keys before foreign keys. While fixing this issue, I found a few other areas where the program could be improved to make it more useful. Here are the changes that I made, to the best of my recollection: