Desktop User Guides > Professional > Data management scripting > Data Management Script (DMS) file > Sections in the DMS file > Event section > OnJobEnd Event section
 
OnJobEnd Event section
The OnJobEnd Event section defines procedural code that is to be executed after all of the processing of the individual cases has been completed and before the data sources are closed. For example, code that closes report files, or uses the Weight component to set up weighting in the output data source. For more information, see Setting up weighting in a DMS file.
The OnJobEnd Event section is not available when you have not specified an input metadata source. If you attempt to include an OnJobEnd 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.
Example
This example closes a text file that was created and added to the GlobalVariables collection in the OnJobStart Event section (see OnJobStart Event section).
Event(OnJobEnd, "Close the text file")   dmgrGlobal.mytextfile.Close()
End Event
See
Event section