Desktop User Guides > Professional > Data management scripting > Transferring data using a DMS file > Writing data > Transferring data to Quantum
Transferring data to Quantum
This topic provides some notes on using a DMS file to transfer case data to a Quantum-format .dat file. The DMS file uses the Quantum DSC to write the data to the .dat file. The Quantum format stores the responses to each question in fixed positions on lines of text. The positions are controlled by card and column definitions that are stored in the metadata.
Quantum Specification files are not saved when transferring data to Quantum with DMOM.
Card, column, and punch definitions
In order to be able to export the case data, Quantum DSC requires valid card, column, and punch definitions to exist in the metadata. You can set up these definitions using the Metadata Model to Quantum before the export or using the Objects in the OnBeforeJobStart Event section or Objects in the OnBeforeJobStart Event section.
Serial number variable
Quantum DSC can optionally write open-ended responses to a .dau file. However, this is possible only if the data contains a suitable serial number variable. By default, the UNICOM Intelligence Metadata Model to Quantum component and Quantum DSC look for a serial number variable called Respondent.Serial. However, you can specify that a different variable should be used as the serial number variable. UNICOM Intelligence data generally contains the Respondent.Serial variable. However, proprietary data does not usually have this variable. For an example of setting up Respondent.Serial when exporting to Quantum from a .sav file, see the SavToQuantum.dms sample DMS file.
Writing to a new .dat file
If the .dat file you specify in the OutputDataSource section does not exist, Quantum DSC will create a new .dat file.
Writing to an existing .dat file
Quantum DSC can write data to an existing .dat file but does not check that the data being exported matches the data already present in the file. Quantum DSC cannot update the data that was transferred previously, and merely appends the new case data records to the end of the file. You should therefore be careful to make sure that subsequent exports to the same .dat file use the same data map and not to create duplicate records in the .dat file by exporting the same case data to it more than once.
If you are using a DMS file to write to an existing .dat file that was created using a version of the UNICOM Intelligence Data Model earlier than 3.0, and you allocate the card and column information in the OnAfterMetadataTransformation event section, you might find that the card and column allocations are no longer the same as before.
Exporting dirty data
When you run the export in clean mode, Quantum DSC issues errors when it encounters incorrect and inconsistent data and this can make the export of the dirty records fail.
If you want to export the data as it is and clean it in Quantum, select dirty mode or switch off validation altogether. For more information, see Validation options when transferring data.
Creating the Quantum specification
You can include code in the DMS file to create a basic Quantum specification based on the card, column, and punch definitions. For more information, see “Creating the Quantum Specification” on page 330.
Setting up weighting
Because Quantum DSC can update the records in the .dat file, you can use the Weight component to set up weighting in the .dat file. The DDL includes a data management script called QuantumWeighting.dms, which demonstrates how to add weights to a .dat file. For more information, see Sample DMS include files.
When UNICOM Intelligence Professional validates a DMS file that exports data to Quantum, it tests the connection to the Quantum .dat file. This always returns two warnings because the validation is performed before the output metadata has been created and without a metadata source Quantum DSC cannot function. This is because Quantum DSC relies on the card, column, and punch definitions in the metadata. You can safely ignore these warnings.
Exporting to Quantum
In the connection string in the OutputDataSource section, specify mrPunchDsc for the Data Source property and the name and location of the .dat file for the Location property. For example:
OutputDataSource(myOutputDataSource, "My output data source")
ConnectionString = "Provider=mrOleDB.Provider.2; _
  Data Source=mrPunchDsc; _
  Location=   [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Output\
  MetaDataOutputName =
End OutputDataSource
For an example of a DMS file that sets up the card, column, and punch definitions and then exports to a Quantum-format .dat file, see OnBeforeJobStart Event section. Also see the CardCols.dms and CardColsPlus.dms sample Include files: see Sample DMS include files.
Writing data