This article focuses on IRI Workbench execution options for scripts based on the SortCL program language, which covers IRI CoSort (transform/report), NextForm (migrate/replicate), FieldShield (classify/mask), and RowGen (test data) jobs. In addition to IRI Workbench execution, these jobs also run on the command line, in a batch script, or as a system call from an executable program.
Recall that IRI Workbench is the graphical IDE built on Eclipse that supports all IRI software products, and it creates their jobs: 1) manually in a syntax-aware script editor; 2) automatically through end-to-end wizards in the top toolbar menus; or, 3) graphically with the Voracity ETL flow design palette.
IRI Workbench also executes other types of jobs, including FACT .ini scripts, DB load utilities, Voracity ETL flow files, SQL procedures, batch programs, etc. I’ll cover the execution of Voracity flows (which serialize as batch scripts) in my next article.
Locate Your Job(s)
When created, these scripts are placed in the active project of the Project Explorer. SortCL job scripts are also created from the Transform Mapping Blocks in a Flow and placed in the active project. In addition, any SortCL script can be copied into a project and then executed.
Execution Option 1: Command Line
IRI jobs run on the command line using the below syntax. The executable for CoSort is sortcl, while the other SortCL language-compatible executables have the same name as the product:
sortcl /specification=CoSort_transform_or_reporting_job.scl fieldshield /specification=data_masking_job.fcl nextform /specification=conversion_or_replication_job.ncl rowgen /specification=test_data_generation_job.rcl
The IRI job script can be moved to any computer where an IRI executable is installed. The script can be run from a command line or from within a batch process, and the same script can be executed on computers with Windows, Linux, and Unix operating systems. Therefore, it is possible to develop a script on your desktop, then move it to another computer for execution.
You can also invoke a shell user interface from within IRI Workbench to gain access to a command line prompt. This can be done using ShelExec, Wicked Shell, or the Launch Shell feature in the Remote Systems Explorer.
Execution Option 2: Run Menu
You can execute a valid job script by clicking on the white arrow in the green circle on the navigation bar. This is the Run menu item and will only execute after you first click on a script in a project, or you click in the body of a script in the editor. If you click the down arrow next to Run, a list of scripts that were previously run is shown. Click any script on that list to execute it. In addition to the list of scripts, you can also select Run As > IRI Job to run the active script.
Execution Option 3: Run As
Suppose we want to execute the script SortTransSelect.scl located in the project MonthEnd. To execute from the Project Explorer, right-click on the script name and click > Run As > IRI Job. Or, if the script is the active tab in the editor, right-click in the body of the script and click > Run As > IRI Job. Both methods will execute a script and place results in the project.
Execution Option 4: Local Run Configurations
In each of the above cases, you can choose Run Configurations instead of IRI Job. Every time you execute a SortCL script, the information about the job is recorded on the Run Configurations window. In the box to the left under IRI job are the names for the jobs that have been previously defined or run. Initially, the name of the job is the name of the SortCL job script. In this case, we select SortTransSelect.scl. If no jobs have been set up, or to set up a new job, right-click IRI Job and click New. New_configuration will be in the Name field and placed under IRI Job in the tree.
The Main Tab
In the screenshot below, we have MonthEnd in the Project field of the Main tab. The SortTransSelect.scl script is listed in the Job Execution Sequence box with the project name and path where the script is located. The IRI Executable field contains the path and name for the executable used with this job. You can select a different executable from the drop-down or Browse to one.
You can list multiple job scripts in the Job Execution Sequence box. Select Search/Add to bring up the Select SortCL job files window, which lists all the SortCL language scripts located in the project. The check box for SortTransSelect.scl is already selected. Now select the check box for join.scl and click OK. The two SortCL scripts are now listed in alphabetical order in the Job Execution Sequence box. The scripts will be executed in the order they are listed. Since we want join.scl to execute last, click it and select Down.
Defining Environment Variables
In the job script SortTransSelect.scl, there is a line in the script like this one:
/QUERY="SELECT * FROM NIGHTLY.TRANSACTIONS WHERE PURCHASE_DATE >= \'\$STARTDATE\' AND PURCHASE_DATE < \$ENDDATE\'"
There are two environment variables: STARTDATE and ENDDATE. In the Environment Variables tab, you can define any that are used in the job scripts. Select New to specify each one. For the first, enter “STARTDATE” for Name and “161201” for Value. For the second, enter “ENDDATE” for Name and “170101” for Value. Both are then listed in the box for Environment variables to set. Make sure Append environment to native environment is selected.
Saving and Running the Job
Since we are executing two SortCL job scripts, we should rename the jobs (from Name) to something more appropriate. Change it to MonthendPart1 and click Apply. In the tree on the left, the name for IRI Job changes from SortTransSelect.scl to MonthEndPart1, and all the other changes made are saved.
Whenever you want to execute this job, access Run Configurations, click MonthEndPart1 in the tree, and click Run.
Execution Option 5: Remote Run Configurations
Jobs in projects on remote systems can also launch from your Run Configurations dialog in IRI Workbench. In this case, I have a remote project called Force5Project1 on a Linux server called Force5 which contains a SortCL job script called chiefs_sep.scl. Type Force5SortChiefs in the Name field.
The Main Tab
The Project field should be Force5Project1. Select the Search/Add button, then select the check box for our script. Click OK to populate the Job Execution Sequence box. When the project was select, the IRI Executable drop down was populated with the products located on the remote server associated with the project. Select the executable starting with rse://FORCE5. The working directory was populated with the location on the remote server associated with the project.
There are multiple ways to execute an individual job script in the IRI Workbench, and there are several ways to access both Run and Run As for a particular script. In addition, the Run Configurations window offers a way to set up and save the parameters for both local and remote jobs, allowing repetition of the jobs to be consistent. Any messages associated with a job display in the Console view at runtime.