VDMGEN Archtiecture Overview

Simply put, the VDMGEN code generator reads manifest files and templates, and produces SQL/DDL and DB2 command language data-specific script libraries.

Manifests are files that list a series of names in the first (header) row and corresponding values in each subsequent row. VDMGEN reads-in the header names and processes each subsequent row. Processing entails the following:

  1. Identify and read appropriate templates
  2. Construct substitution tokens from manifest header names and values
  3. Scan each template and apply substitutions
  4. Store output to the appropriate library directories
  5. Repeat through all nested/associated manifests and templates

Templates look like regular SQL scripts, including two special kinds of literals:

  • Structured (Named) comments
  • Substitution strings

Structured comments are of the form --ABC1-- where ABC1 is a token that can be matched to the manifest as discussed earlier. For example, if the header of the manifest is ABC and the value in the respective position in the manifest line being processed is [12], then the matching is done using the sed substitution s/--ABC[12]--//g which will match the comment --ABC1-- and replace it with a blank. By removing this comment the line is exposed to db2 for execution.

Substitution strings are of the form __XYZ__ where XYZ is the header name. If the value is ABC then wherever the template contains __XYZ__ it gets replaced by ABC.

Each run of the generator constructs a new version directory to place all generated scripts, that sits within a predefined place in the VDM directory tree.

Top level scripts utilize appropriate naming conventions to call the appropriate library members for the task.

VDM Access: