I started working with IBM Cognos Transformer (the tool that builds multi-dimensional cubes) back in the day – the version 6.0 day, as a matter of fact, before the advent of SQL Server Analysis Services. I believe that at that time, the binary model files had a file extension of .pyg, and the only way I knew to manipulate the model was inside the Transformer UI.
Ah, the innocent days of (relative) youth.
Well, innocent and really annoying, too. I’ve always had issues with programs that were only accessible one way. I like knowing about back doors and troubleshooting methods to invoke when the compiled UI lets you down or corrupts your files.
Then Cognos released an update to Transformer that changed the file extension from .pyg to .pyh and I discovered the .mdl file format.
When you save your model in the .mdl format, it’s stored in MDL, the proprietary text-based modeling language that is the “universal translator” between versions of Transformer.
In those early days, other than just using the .mdl file format as a conversion function, I also used it to compress model files. The binary .py? files never release any space, since they store information about changes to the model. Consequently, they continue to grow forever. The only way to wrangle them back into a manageable size is to save them as .mdl files. When you save the .mdl file back to .py? format, all that unseen space is removed and the binary file is restored to a reasonable size.
After a while, I wondered…why bother to go back to a .py? file anyway? The only thing you really gain using the .py? file is a slight advantage in load time. You can do anything with the .mdl formatted model that you can with a .py? file. And I discovered that you could do even more.
In addition to just being able to open and edit the model file in a text editor (a huge bonus for me, see reference to back doors above), you can actually use the MDL language to alter, manipulate and create all or part of a Transformer model. Granted, creating an entire model from scratch using MDL would not be my idea of a good time, but luckily this is not an all-or-nothing proposition.
My two favorite uses for MDL are using it to create model “building blocks” (reusable model components that can be standardized and used across multiple models), and using MDL to automate model maintenance and cube builds.
In this series of blog posts, I’ll cover both these scenarios, but first, we need to do a little housekeeping.
There are two types of MDL – Structured MDL and Verb MDL. Structured MDL was the original version, but it’s more restrictive – you have to pay attention to the order of the commands in the file, for instance. Verb MDL is easier to work with. However, the default setting for the MDL version for Transformer out-of-the-box is Structured MDL, so we need to change a couple of settings in trnsfrmr.ini (for pre-series 8 Transformer) or cogtr.xml (for series 8).
The VerbOutput setting toggles between Structured MDL and Verb MDL. VerbOutput = 0 sets Transformer to Structured MDL mode. VerbOutput = 1 sets Transformer to Verb MDL mode. The second setting (ObjectIDOutput) affects the way object values are presented in the MDL text file. ObjectIDOutput = 1 presents the object identifiers as numeric values, which are not easy to evaluate in a human-readable way. ObjectIDOutput = 0 presents the object identifiers using their text value, which is much easier on the eye (and brain).
- Series 7
- Open …cer[2,3 or 4]/bin/trnsfrmr.ini
- In the [PowerPlay Transformer] section, set the VerbOutput option to 1
- In the same section, set the ObjectIDOutput option to 0
- Series 6.*
- Open …cer1/bin/trnsfrmr.ini
- At the end of the [PowerPlay Transformer] section, add a line and type in VerbOutput=1
- Add another line and type in ObjectIDOutput=0
- Series 8
- Open …cognos/c8/configuration/cogtr.xml
- Add the following node under the <Section Name="Transformer"> node:: <Preference Name="VerbOutput" Value="1"/>
- Add the following node under the <Section Name="Transformer"> node: <Preference Name="ObjectIDOutput" Value="0" />
The following examples show the same Transformer MDL model category definitions. First, as Structured MDL (ObjectIDOutput is the default of 1):
Next, Verb MDL with ObjectIDOutput = 1:
Next, Verb MDL with ObjectIDOutput = 0:
As you can see, setting the ObjectIDOutput to 0 presents the .mdl file in a much friendlier way. After you set your VerbOutput and ObjectIDOutput configuration options, open one of your models from the Transformer UI, then use the Save As option to save the model as an .mdl file with the new configuration options applied. You can then open the .mdl file in your favorite text editor for your viewing pleasure.