We are pleased to announce the availability of the first CodeGen release of 2022, version 5.8.1. As always, you can download the new version from our GitHub Releases page and view the documentation at https://codegen.synergex.com.
The enhancements included in this release are:
- We added the ability to define the minimum version of CodeGen required by your environment by setting the environment variable CODEGEN_MIN_VERSION.
- We added support for generating sample data (JSON formatted) for structure parameters when using the <PARAMETER_SAMPLE_DATA> parameter loop expansion token.
- We added a new method loop expansion token <METHOD_RETURN_SAMPLE_DATA>.
- We corrected an issue that prevented the -checkversion and other related operations from operating correctly.
- We altered the <INTERFACE_NAME> token to support all case variations.
- We changed the output of the parameter loop expansion token <PARAM_TSTYPE> to be consistent with the documentation by emitting structure names in camelCase rather than PascalCase.
- We added a new mechanism for dealing with literal key segment values requiring trailing spaces to be maintained as part of the literal value. This change can alter the output of the <SEGMENT_LITVAL> and <LITERAL_SEGMENT_VALUE> expansion tokens.
This version of CodeGen was built with Synergy/DE 126.96.36.19972 and requires a minimum of version 10.1.1 to operate.
I am pleased to announce the release of a new version of CodeGen, and this release is quite a big one. The changes include the following:
- We added a new command-line option -ncp that suppresses the features of the <STRUCTURE_PLURAL> and <STRUCTURE_NOPLURAL> tokens, making them behave the same as <STRUCTURE_NAME>.
- We modified the non-Synergy data types returned by field loop expansion tokens such as <FIELD_CSTYTPE>, <FIELD_OCTYPE>, <FIELD_SNTYPE>, <FIELD_SQLTYPE> and <FIELD_VBTYPE> for decimal fields with an overall size of over 18 characters. For example, previously <FIELD_CSTYPE> would return long and now returns decimal. And because any field larger than a D28 will overflow even decimal fields in .NET, we now throw an error if any such field is encountered in a structure.
- We added a new type of key loop called a <PARTIAL_KEY_LOOP> that can be used to process subsets of the segments of multi-segment keys.
- We added a new generic expansion token <DAYNAME>.
- We added new field loop expansion tokens <FIELD_CLASS>, <FIELD_DISPLAY_LENGTH>, <FIELD_GROUP_MEMBER_PREFIX>, <FIELD_GROUP_STRUCTURE>, <FIELD_INPUT_JUSTIFICATION>, <FIELD_OVERLAY_FIELD>, <FIELD_OVERLAY_OFFSET>, <FIELD_OVERLAY_SPEC>, <FIELD_PAINTCHAR>, <FIELD_PAINTFIELD>, <FIELD_POSITION_COL>, <FIELD_POSITION_MODE>, <FIELD_POSITION_ROW>, <FIELD_REPORT_JUSTIFICATION>, <FIELD_SELECTIONS_COL>, <FIELD_SELECTIONS_HEIGHT>, <FIELD_SELECTIONS_ROW>, <FIELD_USER_TYPE>, <FIELD_VIEW_LENGTH>, <PROMPT_POSITION_COL>, <PROMPT_POSITION_MODE> and <PROMPT_POSITION_ROW>.
- We renamed some field loop expression tokens that were introduced in the previous release, changing <IF UNFLATTENED_GROUP> to <IF GROUP>, <IF UNFLATTENED_EXPLICIT_GROUP> to <IF EXPLICIT_GROUP> and <IF UNFLATTENED_IMPLICIT_GROUP> to <IF IMPLICIT_GROUP>. We apologize if this breaks existing code, but if so, that code was written in the last few days, and we figured it would not be a big deal!
- We added new field loop expression tokens <IF GROUP_MEMBER_PREFIX>, <IF GROUP_MEMBER_PREFIX_COMPILER>, <IF GROUP_OVERLAY>, <IF NAME_LINK>, <IF OVERLAY_OFFSET>, <IF PAINTFIELD> and <IF USER_TYPE>.
- We changed the behavior of the field loop expansion tokens <FIELD_ENUMBASEVAL>, <FIELD_ENUMLENGTH> and <FIELD_ENUMSTEPVAL>. Previously these tokens would insert 0 for unenumerated fields. Now nothing is inserted for unenumerated fields.
- We changed the behavior of the field loop expansion tokens <FIELD_SELECTIONS> and <FIELD_SELECTIONS1>. Previously these tokens would insert “” for fields with no selection list values. Now nothing is inserted for fields with no selection list values.
- We added a new structure expansion token <STRUCTURE_TYPE>.
- We added a new key loop expression <IF PRIMARY_KEY>.
- We added a new command-line option -pa, which causes array fields not to be expanded into individual fields.
WARNING: This is an experimental feature and may currently cause unexpected side effects with some expression tokens. Please let us know if you encounter anomalies.
- We enabled code generation for structure fields, enum fields, and binary fields. Code generation for these types of fields was previously artificially blocked.
WARNING: This is an experimental feature. While the <FIELD_SPEC>and other basic field loop tokens will behave as intended, some tokens may not behave as expected with these types of fields. Please let us know if you encounter anomalies.
- We removed the field loop expression tokens <IF COERCEBOOLEAN> and <IF NOCOERCEBOOLEAN>. There is a slight chance that this could break existing templates, in which case you can use <IF COERCE_BOOLEAN> and <IF NOT COERCE_BOOLEAN> as direct replacements.
- We fixed an issue that was causing a failure during the processing of very complex expressions.
- We fixed an issue that could cause counter tokens to be incorrectly processed as expressions.
- We addressed a bug that was present in all versions of the Repository API whereby the RpsField.PaintCharacterSpecified property actually indicated whether the field was a paint field, not that a custom paint character was specified. This has now been corrected, and we have added a new property RpsField.PaintField (boolean).
- We moved the implementation of several early Harmony Core specific expansion and expression tokens into the Harmony Core Extensions library.
- We started an ongoing process to reformat and improve this documentation, hopefully making it easier to use and easier to maintain. The most significant change is that expansion tokens were previously documented on individual pages within an overall category, but in the future will be documented on a single page for each category (for example, all field loop expansion tokens). We also started to use manually entered and meaningful topic IDs, which will be a positive change when using the on-line documentation at https://codegen.synergex.com because URL’s will now be based on meaningful names rather than generic topic numbers.
This version of CodeGen was built with Synergy/DE 11.1.1f and requires a minimum of version 10.1.1 to operate.
We recommend that all CodeGen users upgrade to this version, particularly if you are doing Harmony Core development. You can download the new version from GitHub.
For some time CodeGen has shipped with a utility called CreateFile that (given an appropriately configured repository) could be used to create an ISAM file based on a repository FILE or STRUCTURE definition.
A customer recently asked me to create a mechanism that they could use to create multiple files, load data into those files, and also support creating both RELATIVE and ISAM files. Rather than writing something completely new I decided to extend the CreateFile utility, and that new feature has now been released along with the latest version of CodeGen (5.4.2).
Briefly, there is a new command line option -in that allows you to specify an input file containing the details of one or more files to be created and and populated. The file uses a JSON format. If you’re interested in finding out more you can find additional information in the CodeGen documentation.
It’s been a while since a GodeGen release was announced on this BLOG, but rest assured they have been coming thick and fast; in fact there have been 9 interim releases since we last announced here.
So why all the frenetic activity in CodeGen land? Well the primary driving force for so many releases and so many new features is to provide support for the ever evolving Harmony Core RESTful Web Services framework. If you’re not familiar with Harmony Core then you should check it out. More and more Synergy developers are starting to take advantage of it as a way to expose their applications data and business logic in whole new ways and to support a myriad of use cases.
So what’s new in CodeGen 5.4.0? Well the answer to that question is … a LOT! I won’t list all the new features here but if you want to check out the specifics then you can head over to the CodeGen Releases page where you’ll find a detailed change log for this and previous versions. And if you need more information than that then check out the CodeGen Documentation.
We recommend that all developers who are using CodeGen upgrade to this latest version, but particularly if you’re developing with Harmony Core.
Happy 4th Everyone!
We are delighted to announce the availability of the CodeGen version 5.2.2 release that includes the following enhancements and changes:
CodeGen Version 5.2.2 Release Notes
- Added a new field loop expansion token <FIELD_FORMATSTRING> which can be used to access a fields format string value.
- Added a new command-line option -utpp which instructs CodeGen to treat user-defined tokens as pre-processor tokens. This means that user-defined tokens are expanded much earlier during the initial tokenization phase, which in turn means that other expansion tokens may be embedded within the values of user-defined tokens.
- Removed the RpsBrowser utility from the distribution; it was an experimental project that was never completed.
This version of CodeGen was built with Synergy/DE 10.3.3d and requires a minimum Synergy version of 10.1.1 in order to operate.
We are pleased to announce the release of CodeGen 5.2.1 which includes several new features that significantly extend the possibilities for what can be generated. The core goal for this release was to introduce new features that make it possible to sub-divide the processing of large loops into smaller units of code, and by doing so make it possible to achieve new things, especially when working with very large structures.
For example, the reference code that demonstrates how to implement the replication of ISAM data to a relational database (https://github.com/SteveIves/SqlReplicationIoHooks) previously had a restriction that it could only deal with files (tables) with up to 252 fields (columns). The underlying reason for this related to the maximum number of arguments that can be passed to an external routine, %SSC_BIND in this case. The restriction of 252 available data parameters to %SSC_BIND meant that bad code would be produced for any structure with more than that number of fields. Now however, using some of the new features in CodeGen 5.2.1, the template has been re-structured so that %SSC_BIND will be called multiple times if necessary, removing the previous restriction.
But that’s just one example, there are doubtless many more. Here are the release notes for the new version:
- We added several a new generic expression token <IF COUNTER_n_op_value> that allows you to write conditional template code based on testing the current value of the two internal template counters against a simple numeric expression. Here is an example of using this new expression:
Code to include for every 10th item
Code for a small number of items.
Code for a larger number of items.
- We made a minor correction to the documentation of the -f l command line option. The documentation previously stated that this option caused fields marked as “Excluded by Language” to be EXCLUDED from field loop processing, but actually such fields are excluded by default. The -f l command line option actually suppresses this behavior, causing such fields to be INCLUDED in field loop processing.
- This version of CodeGen was built with Synergy/DE 10.3.3c and requires a minimum Synergy run-time version of 10.1.1.
The latest version of CodeGen can always be downloaded here.
We are pleased to announce that Professional Services has just released CodeGen 5.1.7. The main feature of the release is the addition of experimental support for generating code for the MySQL and PostgreSQL relational databases. Developers can use a new command line option -database to specify their database of choice. This causes the SQL-compatible data types that are injected by the field loop expansion token <FIELD_SQLTYPE> to be customized based on the chosen database. The default database continues to be Microsoft SQL Server.
Before we consider support for these new databases to be final we would appreciate any feedback from developers working with MySQL or PostgreSQL to confirm whether we have chosen appropriate data type mappings. Additional information can be found in the CodeGen documentation.
We are pleased to announce that we have just released CodeGen V5.1.4. The main change in this version is an alteration to the way that CodeGen maps Synergy time fields, i.e. TM4 (HHMM) and TM6 (HHMMSS) fields, to corresponding SQL data types via the <FIELD_SQLTYPE> field loop expansion token. Previously these fields would be mapped to DECIMAL(4) and DECIMAL(6) fields, resulting in time fields being exposed as simple integer values in an underlying database. With this change it is now possible to correctly export time data to relational databases.
We also made a small change to the CodeGen installation so that the changes that it makes to the system PATH environment variable occur immediately after the installation completes, meaning that it is no longer necessary to reboot the system after installing CodeGen on a system for the first time.
This version of CodeGen is built with Synergy/DE 10.3.3a and requires a minimum Synergy runtime version of 10.1.1.
Tomorrow morning I’m heading back home to California having spent the last two weeks in the United Kingdom. The second week was totally chill time; I spent time with family and caught up with some old friends. But the first week was all about work; I spent a few days working with Richard Morris (it’s been WAY too long since that happened) and I can tell you that we worked on some pretty cool stuff. I’m not going to tell you what that is right now, but It’s something that many of you may be able to leverage in the not too distant future, and you’ll be able to read all about it in the coming weeks. For now I wanted to let you know that we found that we needed to add some new features to CodeGen to achieve what we were trying to do, so I am happy to announce that CodeGen 5.1.3 is now available for download.
It seems like since we moved CodeGen from CodePlex to GitHub there has been some confusion about how to download the latest version. The latest version will always be available at:
We have just released a CodeGen update that includes a fix for a problem that was discovered recently related to the processing of enumerated fields. If your repository includes enumerated fields and you use the field selection loop token <SELECTION_VALUE> (or the Symphony Framework custom token <SYMPHONY_SELECTION_VALUE>) then we recommend that you update to the new version and re-generate your code. As a reminder CodeGen recently moved to GitHub, you can find the new release at https://github.com/Synergex/CodeGen/releases.
Today we are announcing that we have moved the open source CodeGen project from it’s former home on CodePlex to a new home on GitHub. We made the decision to do this for several reasons, not least of which is the fact that GitHub has effectively become the de-facto standard place for hosting open source projects. Even Microsoft, who built and operate the CodePlex site using their own Team Foundation Server source control technologies seem to have lost interest in it; in the last 18 months or so they have moved pretty much all of their own considerable number of open source projects to GitHub also! GIT also has several very nice features over and above what TFS has to offer, and also has the benefit of being very considerably faster to use. Related to the move is a new version (CodeGen 5.1.1), but the only changes in the new version are related from the move from CodePlex to GitHub; there is no new functionality in the new release over the 5.1.0 version that was released a few days ago.
If you don’t already have one we encourage you to create a GitHub account and once logged in to “watch” CodeGen. If you wish to receive notifications about new CodeGen releases you can also subscribe to the CodeGen Releases Atom feed. CodeGen is still distributed under the terms of the New BSD License. For the time being we plan to leave the CodePlex environment intact, but no new changes will be checked in there and no new releases will be published there.
Here are a few useful GitHub URLs related to our new home:
Just a quick note to announce that we have today released CodeGen 5.1. This release has but one new feature, but it does allow me to solve a challenging problem that I faced while working on a customer project recently. I have dubbed this new feature conditional processing blocks. Essentially it is the ability to conditionally include (or exclude) parts of a template file based on the presence or absence of identifiers that can be declared on the command line. It allows you to achieve the same kind of results that you would when using .DEFINE, .IFDEF and .IFNDEF in DBL source code, but within template files. For example a developer could include code like this in a template file:
The developer would then have the ability to choose whether to include or exclude the code that assigns the I/O hooks object to the channel that was opened at the time that they generate the code. By default the I/O hooks code would not be included; if it was needed the developer would define the ATTACH_IO_HOOKS identifier as they generate the code. They would do this by using a new –define command line option:
codegen –s EMPLOYEE –t FILE_IO_CLASS –r –define ATTACH_IO_HOOKS
This may seem like a very simple change, and it is, but my mind is now racing thinking about all of the new possibilities it opens up.
Just a quick note to let all of you CodeGen users out there that a new version (CodeGen 5.0.5) has just been released. You can get more information about the changes and download the release from https://codegen.codeplex.com/releases.
If you would like to receive email or RSS notifications when new CodeGen versions are released then there are links on the above mentioned page to allow you to set that up, and we encourage you to do so.
I finally got around to something that I have been meaning to do for a while, creating some short training videos for CodeGen. Just five videos right now, but I have a growing list of subjects for future videos.
You can view the videos on the Synergex Channel on YouTube.
Please subscribe to the YouTube channel to receive notifications when new videos are added.