Professional > Troubleshooting > Data Management troubleshooting > FAQs on the differences between DMS and .mrs files
 
FAQs on the differences between DMS and .mrs files
Can you clarify the difference between DMS files and .mrs files, and when to use DMS Runner and when to use the mrScript Runner?
A DMS file is a text file with a .dms filename extension that defines a data transformation job. A DMS file has two or more different sections, which have different coding rules and use different technologies. For example, the InputDataSource section uses property definition and SQL syntax, whereas the Metadata section is written in mrScriptMetadata, and the Event sections are written in mrScriptBasic. You can run DMS files in UNICOM Intelligence Professional or using the DMS Runner (see DMS Runner), which is available only if you have UNICOM Intelligence Professional installed.
On the other hand, .mrs files are simple mrScriptBasic files and you can run them directly using the mrScript Command Line Runner, which is installed with UNICOM Intelligence Data Model 2.5 and later. This means that you do not need UNICOM Intelligence Professional to be able to run an .mrs file. However, if you do have UNICOM Intelligence Professional, you can run your .mrs files in UNICOM Intelligence Professional.
However, the situation is not quite as clear cut as it might seem, because the code in any Event sections in your DMS files is always written in mrScriptBasic. This means that you can sometimes just copy code from an .mrs file straight into the Event section of a DMS file or even use the .mrs file as an Include file within an Event section. However, you always need to check that the code is appropriate for the particular Event section, that variable names don't clash, etc.
For example, the UNICOM Intelligence Developer Documentation Library comes with a sample .mrs file (called ExportToQuancept.mrs) that generates a Quancept script from an MDM Document. You could use this file as an Include file in the OnAfterJobEnd Event section of a DMS file. Here is an example of doing this:
Event(OnAfterJobEnd, Generate QC Script from output metadata)
  Dim MDM
  ' Create the MDM Document object and open the output metadata file
  Set MDM = CreateObject("MDM.Document")
  MDM.Open("[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ Output\Simple.mdd")
  #Include "[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\   Scripts\General\mrScriptBasic\ExportToQuancept.mrs"
End Event
This example has been designed for use with the Simple.dms sample file. If you used it in any other DMS file, you would need to change the name and location of the .mdd file.
Conversely, you can sometimes copy the mrScriptBasic code from an Event section into an .mrs file and run it as a stand-alone .mrs file using UNICOM Intelligence Professional or the mrScript Command Line Runner. This is particularly likely to be true of the code in the OnBeforeJobStart section because all of the objects used in this section are created using the CreateObject function, just as you would create them in an .mrs file. However, the mrScriptBasic code in the other Event sections often refers to objects that UNICOM Intelligence Professional automatically registers with the mrScript engine. This code is therefore unlikely to be suitable for running as a stand-alone .mrs file.
The sample DMS files show two main ways of connecting to the case data--using the InputDataSource and OutputDataSource sections and using ADO in the Event sections. Why are these two different methods used and which is recommended?
You define the input and output data sources in the InputDataSource and OutputDataSource sections of the DMS file. When you do this UNICOM Intelligence Professional handles all of the connections for you and sets up the job and transfers the data as defined. This has the great advantage that in the OnNextCase Event section you have scripting access to the case data. For example, for cleaning and setting up case data for new variables, etc. In addition, UNICOM Intelligence Professional automatically merges any new metadata defined in the Metadata Section.
However, sometimes it is useful to use ADO to access the case data in the Event sections, for example to write out top line tables or crosstabulations in Excel. You would typically do this after the job has completed, in the OnAfterJobEnd Event section. And this is how it is mainly used in the samples.
Why do I need UNICOM Intelligence Professional if I can access the case data using ADO in a mrScriptBasic (.mrs) file or in Visual Basic?
It is true that you do not need UNICOM Intelligence Professional to use ADO to access the case data and many of the things that you can achieve using a DMS file could be achieved by using ADO in mrScriptBasic or Visual Basic. However, using a DMS file (which requires UNICOM Intelligence Professional) makes it easier by handling the connections, the merging of the metadata, and the transfer for you. And through the Data Management Object Model (DMOM), the DMS file gives you scriptable access to the case data. When you use ADO, you are restricted to using SQL syntax, which is generally harder to set up and to read. In addition, the DMS file enables you to use the Weight component, which means you can set up sophisticated market research weighting.
For an example of an .mrs file that uses ADO to export case data, see the ExportCaseDataToQuantum.mrs sample file. For more information, see Sample mrScriptBasic files.
See also
Data Management troubleshooting