Script Command Records

The third though n records in the Session File are the Script Command Records. Each command has associated parameters. Each command may also have an optional associated condition, with a condition parameter and a condition result.

The format of the Script Command Record is:

"Command Name","Command Parameter 1","Command Parameter 2", "Command Parameter 3",
"Command Parameter 4","Command Parameter 5","Command Parameter 6","Condition",
"Condition Parameter","Condition Result"

When you use Process Control to create the Session File automatically, you can select commands from the Select Script Command list on the Command Setup dialog. This list allows you to select which script command you want to add to the script.

Important: If you create the Session File manually, you should verify that all commands, command parameters, conditions, condition parameters, and condition results are enclosed in quotes. If a command parameter, condition, condition parameter, or condition result is not used, you must specify that option as "" (two double quotes) in the Session File.

Command Name

When you create the Session File manually, you need to add each command record to the file. The values for Command Name that can be used when creating the Session File automatically or manually are listed in the following table.

Table 1. Commands and Corresponding Actions
Command Action
Exec_Program Indicates a program for the system to run.
Exec_Program_Ex Indicates a program for the system to run and for which the system will pass the Event ID and controller name.
Note: This function is used by the Sterling Gentran:Server® for RosettaNet install program.
File_Copy Copies a file.
File_Rename Changes the name of a file.
File_Delete Removes a file from the system.
GDW_Archive Performs the archive command according to the specifications of a selected archive definition file.
GDW_Audit_Rpt Copies the audit records to a specified file.
GDW_Audit_Purge Deletes all audit records in the system.
GDW_Audit_Write Writes a processing user audit message to the Audit Log, based on the specified parameters.
GDW_Document_ Purge Removes document records from the Sterling Gentran:Server database according to the specified age/date, location, partner name, transaction, and/or status.
GDW_Document_Rpt Creates a specified file that contains document data (as well as group and interchange data, if applicable) for documents in the Sterling Gentran:Server database according to the specified status, location, and/or age/date.
GDW_Export Performs the Export function.
Note: You must have an export translation object registered with the system.
GDW_ExtData_Delete Deletes external data references based on the action taken on the external data and/or age.
GDW_Import Performs the Import function from a specified file.
Note: You must have an import translation object registered with the system.
GDW_Notify_Purge Deletes all notifications records in the system or deletes them by age, if specified.
GDW_OutboundRecovery Defines the time for the outbound recovery process to run each day.
GDW_Partner_Delete Executes the partner delete command.
GDW_Partner_Import Executes the partner import command.
GDW_Partner_Export Executes the partner export command.
GDW_Print Performs the Print function.
Note: You must have a print translation object registered with the system.
GDW_Process_File Invokes the post-communications process with any EDI file, as if the file was received via a communication session.
Note: You must have an export translation object registered with the system.
GDW_Receive Performs the Receive Only function of the Comm Gateway.
GDW_Send_Receive Performs the Send/Receive function of the Comm Gateway. This function does not wait for previously executed Send/Receive sessions to finish; it executes the Send/Receive when you specify.
Inbound_Recovery Executes the Executive service inbound mailbox recovery.
Outbound_Recovery Executes the Executive service outbound mailbox recovery.
Terminate_Script Terminates the script.

Command Parameters

The values for Command Parameters 1 through 6 vary depending on the Command Name. Command Parameters are defined in detail for each command name in the Process Control Commands. If a command parameter is not used, you must specify that option as "" (two double quotes) in the Session File.

Conditions

Each script command can have an optional associated Condition. These conditions are evaluated just prior to the execution of the command and can be used to control the process flow of your session.

Two types of conditions can be specified. First, the system can query for the presence or absence of a specific file. Second, the system can determine whether or not documents exist in a specific location (such as Out Documents).

If a condition is not used, you must specify the condition, the condition parameter, and the condition result as "" (two double quotes) in the Session File.

Table 2. Conditions to choose from
IF the condition is... THEN it indicates that...
If File Below Exists the system must look for the file you specify and then execute the command based on whether the file is found or not found.
If Docs Are In the Location Below the system must look for the documents in the location you specify and then execute the command based on whether or not the documents are found in that location.

Condition Parameters

If you use a condition, you must specify a Condition Parameter. The Condition Parameter for the If File Below Exists condition is the name of the file that the system must try to find. If a filename is specified without a path, the processor searches for that filename in the folder in which Sterling Gentran:Server is installed on the machine. The Condition Parameter for the If Docs Are In Location Below condition is a Sterling Gentran:Server location (such as In Documents, ?In Documents, Out Documents, or ?Out Documents).

Tip: Use a wildcard (*) to specify the name of the file for which you want the system to check.

Condition Result

If you use a condition, you must specify a Condition Result. The Condition Result values are as follows:

  • If the evaluated condition is True, the command should only be executed if the specific document or file is present.
  • If the condition is False, the command should be executed only if the specific document or file does not exist. In this instance, the command is skipped and processing continues with the next defined command.

    For example, you might not want to initiate a GDW_Send_Receive command if there are no documents in the Out Documents, or you might want to execute a notification program if received documents are routed to the ?In Documents.

Sample Session File

The following is an example of a sample Session File:

In this example, the indented lines indicate a continuation of the previous record.

"GDW_Session","Version 2.0"
4
"GDW_Import","remit.txt","","","","","","If File Below
	Exists","c:\GENSRVNT\imports\remit.txt","True"
"GDW_Send_Receive","","SendToPtr","820","","","","If Docs Are In
	Location Below","Out Documents","True"
"GDW_Export","invoice.dat","","","","","","If Docs Are In Location
	Below","In Documents","True"
"GDW_Document_Rpt","c:\GENSRVNT\docrpt.txt","","","2","","","","",
	""