EP Scripting

<< Click to Display Table of Contents >>

Navigation:  Data transfer >

EP Scripting

Using the add-on EP Scripting, files can be sent and received by calling external programs. This way you can use !MC5 to send data, especially EDI messages, via FTP or X.400 (e.g. using T-Systems FileWork). EP Scripting is designed to be as flexible as possible to control as many external programs and processes as possible. The external programs are controlled using scripts using the Windows Batch syntax in combination with additional parameter files that can be passed to called programs. Both scripts and parameter files are created dynamically to be adjusted for each individual call.

Windows Batch Programming

EP Scriping saves scripts as Windows batch scripts (.bat). Some links with information about Windows batch programming can be found under FAQ / General / Useful links.

!MC5 uses three kinds of scripts, which are executed at different times in different contexts:

 

Inbound scripts - Get executed when files are found in an EPS partners incoming folder.

Outbound scripts - Get executed for each file sent to an EPS partner.

Timer scripts - Get executed in regular intervals independently of any partner.

Avoid user input in scripts at all costs!

Make sure not to use any commands in the scripts to be executed that wait for user input! The scripts are executed invisibly in the background by !MC5. If a script waits for user input, it is not visible to the user and no input can be made. The script simply hangs at the corresponding position (it will be terminated automatically when the global script timeout - after 10 minutes by default - is reached). This also applies to the copy command, for example: If the target file already exists in the copy command, the user must confirm the overwrite, which is not possible when executed as a script in !MC5. In the case of the copy command, the confirmation can (and should) be suppressed by the /y parameter.

Processing of incoming Data

 

In regular intervals !MC5 checks the incoming folders of all EPS partners for new files. When new files match the file pattern specified for that partner, the incoming script gets executed, if one is selected. Afterwards each file is being processed by the module EDI. The detailed process is as follows:

 

1.Matching files are found.

2.(optional) The files get converted from EBCDIC to ASCII character set. Copies of the original files are saved into the sub folder EPS_EBCDIC.

3.(optional) The incoming script specified for that partner gets executed (the variable FILENAME will be assigned the value of the incoming file pattern).

4.Each file will be queued for processing by the module EDI individually.

5.(optional) The for the partner specified filter gets executed.

6.Further processing according to EDI settings.

7.If accepted by the filter in step 5, the file gets moved to the sub folder EPS_Received.

 

Sending data

 

Files can only be sent by EP scripting using automatic file transmission od EDI import rules. When files get sent using one of those functions, the specified outgoing script will be executed for each file. The detailed process is as follows:

 

1.One or more files are processed by either an automatic file transmission or an EDI import rule.

2.The file get saved to the respective partners outgoing folder.

3.(optional) The file gets converted from ASCII to EBCDIC character set. A copy of the original File gets saved into the sub folder EPS_ASCII.

4.(optional) The outgoing script specified for that partner gets executed (the variable FILENAME will be assigned the files name).

 

Partner independent timer scripts

 

Timer scripts get executed independent of any partner settings in regular intervals. They can be used for instance to regularly execute an external program like FileWork to receive new files and save these to the incoming folders of the respective partners. From there the files will get processed automatically (see processing of incoming data). Timer scripts also can be used to send data e.g. only once a day instead of using outgoing scripts which execute as soon as a new file is processed.

 

!MC5 script variables

 

!MC5 EPS scripts can use additional variables, which will each time be replaced with their assigned values prior to execution of the script. You can use global variables, which have to be defined and set using the windows registry, and local variables, which have script or partner dependent values. Partner dependent values can only be used in incoming and outgoing scripts and can be defined using the partner management.

 

These variables can be used in both scripts and parameter files.

 

Global variables

%GLOB:Name% - Will be replaced by the value of the global variable Name. Global variables can be created and edited under Settings / EP Scripting / Script global variables.

 

Local variables

%VAR:BATCH% - File name of the script itself.

%VAR:PARAMTEXT% - File name of the parameter file.

 

Partner dependent variables

%VAR:P1% ... %VAR:P8% - Variables containing values freely definable for each partner.

%VAR:FOLDER% - Incoming or outgoing folder of the respective partner, depending on script type.

%VAR:FILENAME% - Value of the field File pattern / name as specified in the partner settings or, in case of an outgoing script, the file name of the processed file.

%VAR:FILEMASK% - Value of the field File pattern / name as specified in the partner settings.