Creating an Quantum specification using a script
You can use the MDSC capability of Quantum DSC to write out a basic Quantum specification based on the card, column, and punch definitions in the .mdd file. You create the specification using the Metadata.Save method of the DSC object. The following list describes the parameters of this method.
Parameters
Doc
An open MDM Document. This must contain card, column, and punch definitions and a DataSource object for the Quantum DSC.
NamefRunFile
The location and name of the run file. If a filename extension is specified, it will be ignored. The location can be in the form or an absolute or relative path. Typically the filename should have no more than eight characters, to conform to the Borland 8.3 filename convention.
Properties
This parameter is not used and should be set to Null.
Example
This example uses the method to create a Quantum specification using card, column, and punch definitions that have already been set up.
Dim MyDocument
' Create the MDM object and open the Museum .mdd file
Set MyDocument = CreateObject("MDM.Document")
MyDocument.Open("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Museum.mdd")
' Use the DSC Registration component to find Quantum DSC
Dim DMComp, dscQuantum
Set DMComp = CreateObject("MRDSCReg.Components")
Set dscQuantum = DMComp.Item["mrPunchDsc"]
' Create an object of type Scripting.FileSystemsObject for working with files and folders
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
' Check if the output folder is present, and if not, create it.
If fso.FolderExists("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Museum") = False Then
fso.CreateFolder("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Museum")
End If
' Write out the specs to the folder we just created
dscQuantum.Metadata.Save(MyDocument, "C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Museum\Museum", Null)
MyDocument.Close()
Quantum DSC creates the Quantum specification files in the location you specify for the second parameter of the Metadata.Save method. This example uses the FileSystemObject to create a new folder for the output, if it does not already exist. This is a useful technique to make sure that the Quantum specification files do not overwrite those from a different data set. Although most of the specification filenames are based on the name you supply, the names of the include files created for numeric grids are based on the axis names. This means that these files might be overwritten if there are any numeric grids with the same name in the two data sets.
If you want to use the short axis name option, set the UseShortName custom property to True. For example:
' Set the current user context to CARDCOL
MDM.Contexts.Current = "CARDCOL"
' Set the UseShortNames custom property
Dim Properties
Set Properties = MDM.DataSourceProperties
Properties.Item["UseShortNames"] = True
For more information about the Quantum specification and the options that are available, see
The Quantum specification.
These mrScriptBasic examples are in the
MDM2Quantum.mrs and
MDM2QuantumClearAndAllocate.mrs samples. For more information, see
Sample mrScriptBasic files. To run the samples, see
Setting up card and column definitions using the Metadata Model to Quantum component.
See also
See also