| # Advanced file handling using common directories During regular export and import, Exchange uses a subdirectory for each run. However, functionality is available to automatically copy the files to or from this subdirectory. This functionality can be used by setting the Common Directories in the Exchange Schemes (daxch0501m000) session. The functionality and its benefits are discussed in detail next. Export functionality In the Exchange Schemes (daxch0501m000) details session, the user can specify a directory to copy files to after a regular export. This field contains a path name. If it is empty, the regular export will work as usual. If a directory is specified, the following is done. After running a batch in a regular export, the resulting files will be copied to the directory specified. Existing files in the directory, for example, from the previous regular export run, are overwritten. If one of the batch lines (table relations) did run, but did not create a file successfully, the corresponding file in the specified directory (if any) will be removed. This will avoid the external application importing the same file twice. If files are stored in the specified directory, but the file name does not occur in an active table relation (export), the file will not be overwritten or removed. This enables the external application to combine files created by Exchange with other files if required. The files created in the subdirectory of the regular export run will not be removed, so although the files in the directory specified can be overwritten, the files from each regular export run will still be available (until they are deleted by the user explicitly). Import functionality In the Exchange Schemes (daxch0501m000) details session, the user can specify a directory to copy files from before a regular import. This field contains a path name. If it is empty, the regular import will work as usual. If a directory is specified, the following is done. Before running a batch in a regular import, the required files will be copied from the directory specified. Only files required by the import are copied, that is: Only files having a file name that is used in one or more active table relations (import) are copied. The files are copied to the subdirectory used by the current import run. If one or more files already exist in the subdirectory for the regular import run, they are overwritten, unless files with the same file name do not exist in the directory specified. Benefits and alternatives The use of subdirectories in regular export and import has limitations when integrating LN with external applications. The run number is not available to the outside world, so the external application does not know what directory the files must be written to or read from. In practice, programming a session or script to copy the files before each regular import or after each regular export, often solved this. This is no longer required. Integration within LN also benefits from the new functionality. The regular export and import of LN Exchange can use common directories to exchange the files. The export and import process will automatically copy the required files. However, using Multisite Control will be more appropriate when both the data source and the data target are LN environments. In addition, the automatic file copy guarantees the safety of the regular export and import. Only the files in the common directory are overwritten, but the files, as created by the regular export and used by the regular import, are not overwritten. They can be checked in case of problems, and previous runs can be redone. Note that using the Regular Export Directory field or the Regular Import Directory field in the Exchange Schemes (daxch0501m000) session results in overwriting the files from the previous regular export or import run. In that case a previous import run cannot be restarted anymore. This means using common directories is advised, unless you are sure that overwriting files from previous runs is not a problem. |