The Auto SQL Import Jobs command enables you to import jobs into DMS via a predefined SQL script. This command is the same as selecting the Interface | SQL Import | Job Import via SQL manually from the DMS menu. The SQL script is defined using Interface | Import Settings | Job Import SQL Scripts.
In order to import jobs automatically, the user name provided for the login must have access to both the “Enable Auto User Login” and the “Import jobs using SQL”.
The parameter for the automatic import jobs is:
AutoSQLImportJobs=command file
For example, to log in to the database WorkData with a user name of Jan Smith to import jobs via an SQL script using the command file C:\Program Files\Dynafact\Import Jobs Cmd.TXT the following would be used:
DMSEnt “AutoUserName=Jan Smith” DatabaseName=WorkData “AutoSQLImportJobs=C:\Program Files\Dynafact\Import Jobs Cmd.TXT"
The “command file” is an existing text file that holds the SQL Import Jobs command information. The command file parameters must never be surrounded in quotation marks even if the parameter has a space in it. The following commands are given in the schedule command file:
1.SQLScriptName =(The name of the existing SQL script to run)
2.ReportStatusFilename=(Filename to write the import status and any errors to. If not given, the default filename of import folder\ ImportSQLStatus.TXT will be used.
3.DefaultJobState=(The default job state if not given on the SQL import job script; optional; if not given and a default is required, the default set in the Terms and Settings will be used)
4.AddResourcesIfRequired= YES/NO (default YES)
5.AddPoolsIfRequired=YES/NO (default NO)
1.ApplyImportTable= YES/NO (Default=YES; indicates whether or not to apply the Import Interface Table)
2.AddInventoryIfRequired= YES/NO (default NO)
3.JobSecurityProtectionCheck=YES/NO (default NO; if no, the status of the job security protection is not checked and all jobs are updated. If yes, the status of the job security protection is checked and only updated if the protection allows the update.)
4.SetMaterialReceivedIfAvailable=YES/NO (default YES; if you are importing material you can chose how the Material Available flag is set. If selected and the material available import is true and the material received date is blank, then the import will set the material date received to current date. If this option is not selected, the Material Date Received is not updated during the import.)
5.SetAndActualsToPrime=YES/NO (default YES; if selected, then any AND operation's actual time, quantities and operation status will be set to the prime operation's actual time, quantities and operation status. In most cases, you want to have this option selected.)
6.RefreshMaterialRequirements=YES/NO (default NO; if YES is selected, DMS deletes all exiting material requirement items for a given job before adding the job's material requirements. If not selected, material requirements are not deleted before adding new material.)
7.BackFlush=YES/NO (default NO; if YES is selected, DMS will backflush operations by seting all operations from the last completed operation back to the beginning of a job to a status of complete. If NO, a backflush does not occur.)
8.AddAllocations=YES/NO (default is NO; If YES is selected, add assembly allocations enables a component job in one assembly to feed into a component job in another assembly or to feed an independent job. If an assembly component with a given order number exists and the same order number is added to a different assembly, the import will automatically set up an allocation (BOM link) between the first assembly component and the second assembly component. If NO is selected, the duplicate order number being added to an assembly will be rejected.)
9.DeleteAllMaterialRequirements=YES/NO (default NO) If YES, the import deletes all existing material requirement items for a given job before adding the job's material requirements. If NO, material requirements are not deleted before adding new material.
10.LimiteErrorCount=Number where number is the number of errors to limit. If 0 (the default is 0), all errors will be reported to the log.
11.ImmediatelySaveErrorMessages=YES/NO (default NO) This option enables the import to immediately save any error or warning messages to the log. If NO, the messages are held in memory and written to the log at the end of each SQL import type, saving processing time. If YES, error and warning messages are written to the log immediately, thus slowing down the import.
12.TraceOn=YES/NO (default NO) Enter YES if you want to display the information currently being imported as well as write the information being imported to the import log. Selecting YES is helpful for debugging purposes.
13.CheckForMessages=YES/NO (default no) If YES, the import checks for the option to manually abort the import process during the importing of each record. If NO, the import checks for the option to abort the import every 200 records if running interactively or every 500 records if run in a batch mode. If YES, the import runs slower.
14.UseFetchRows=NumberOfRows where NumberOfRows is 0 (the default) if the SQL FETCH command will not be used. Otherwise enter the number of rows for the FETCH. A suggested starting point would be from 5,000 to 10,000.
The following example shows a command file that will run the SQL script "DMS SQL Job Import", write the import status to a file called "ReportStatusFilename=C:\Program Files\Dynafact\DMS\Export\SomeResults.Txt", add resources if they do not exist, and do not apply the Import Interface Table. Because the parameter DefaultJobstate is not given, the default job state set in the Terms and Settings will be used as required. Also, since the parameter JobSecurityProtectionCheck is not given, it defaults to No:
SQLScriptName=DMS SQL Job Import
ReportStatusFilename=C:\Program Files\Dynafact\DMS\Export\SomeResults.Txt
AddResourcesIfRequired= Yes
ApplyImportTable=No
Note that if you want to run an import command more than once, you must specify an entirely new command line. For example, if you want to run three SQL import commands, the following command lines would be used:
"C:\Dynafact\Production\DMS\DMSEnt.exe" "UserIniFolder=C:\Dynafact\Production\DMS\User\" "AutoUserName=DMS" " DataBaseName=DMSCopy" "AutoSQLImportJobs=C:\Program Files\Dynafact\DMS\ImportCmd1.TXT" "AutoLogOut"
"C:\Dynafact\Production\DMS\DMSEnt.exe" "UserIniFolder=C:\Dynafact\Production\DMS\User\" "AutoUserName=DMS" " DataBaseName=DMSCopy" "AutoSQLImportJobs=C:\Program Files\Dynafact\DMS\ImportCmd2.TXT" "AutoLogOut"
"C:\Dynafact\Production\DMS\DMSEnt.exe" "UserIniFolder=C:\Dynafact\Production\DMS\User\" "AutoUserName=DMS" " DataBaseName=DMSCopy" "AutoSQLImportJobs=C:\Program Files\Dynafact\DMS\ImportCmd3.TXT" "AutoLogOut"
See also: