Desktop User Guides > Professional > Data management scripting > Data Management Script (DMS) file > Sections in the DMS file > Event section > OnJobStart Event section
OnJobStart Event section
The OnJobStart Event section defines procedural code that is to be executed after all of the data sources have been opened and before the processing of the first case begins. For example, code to set up global variables that are used in the OnNextCase, OnBadCase, and OnJobEnd Event sections.
The OnJobStart Event section is not available when you have not specified an input metadata source. If you attempt to include an OnJobStart Event section in a case data-only transformation or when using a non-Data Model OLE DB provider, you will typically get an “Object reference not set to an instance of an object” error.
For information about accessing objects in this section, see Using objects in the Event section.
This example shows setting up:
A report file. The CreateObject function is used to create a FileSystemObject, which is a standard Microsoft object for working with folders and files. The FileSystemObject.CreateTextFile method is then called to create a text file object, which is added to the job's global variables collection so that it can be accessed in the OnNextCase and OnJobEnd Event sections.
A default response for a question. The Response.Default property is used to set up a default response for a question called expect. This means that the Validation.Validate method can be used to assign the default value to the question in the OnNextCase Event section.
Event(OnJobStart, "Do the set up")
Dim fso, txtfile
Set fso = CreateObject("Scripting.FileSystemObject")
Set txtfile = fso.CreateTextFile("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Cleaning.txt", True, True)
Set dmgrGlobal.mytextfile = txtfile
expect.Response.Default = {general_knowledge_and_education}
End Event
For more data cleaning examples, see Data cleaning examples.
Event section