The IRI Workbench GUI, built on Eclipse™, provides several ways to create data-driven jobs … jobs which are ultimately expressed in self-documenting plain-text scripts and metadata files. These scripts are saved in projects, and open in a color-coded, syntax-aware editor.
The editor interacts directly with other graphical facilities in Workbench. These include a job outline, section-specific dialogs, transform mapping diagrams, external metadata formats, and other Eclipse features.
The “SCL editor” is one of several available to users. IRI Workbench is designed to simplify and extend the generation and management of jobs that are created in any IRI product compatible with the IRI Sort Control Language (SortCL or SCL), including:
- IRI CoSort – sorting, transformation, and reporting
- IRI NextForm – data and database migration and replication
- IRI FieldShield – static data masking in file and ODBC sources
- IRI RowGen – test data generation into DB, file or report targets
- IRI Voracity – all of the above, plus ETL, subsetting, DQ, CDC, etc.
In this article, I will open jobs in the “SCL Editor” and explain some of its features.
Open the Editor
To open a job in the editor, right-click on any file with a .?cl or .ddf extension in a project folder and click Open with > SCL Text Editor. The editor view normally opens in the center of Workbench between the Project Explorer and the Outline.
When a job or metadata script is open in the editor, the Outline view will graphically represent and dynamically interact with the script as you make changes to it. If the Outline view does not display, click Window > Show View > Outline.
The editor window is also used for other editors, including standard text editors, the fit-for-purpose IRI FACT and DDF editors, SQL, JSON and XML editors, etc. You can open multiple files simultaneously in that view, with a named tab for each file.
For example, see the Workbench screenshot below. Three tabs are open in the editor window:
By hovering over a tab, you can see the project and name for each file. SortChiefs.scl is in the Chiefs project. Each tab also has an icon before the file name to indicate the file type.
The file RealData.ddf has a blue pelican indicating that the file is a metadata file. The file RealData has an icon that looks like a sheet of paper indicating a text file. The icon for the file SortChiefs.scl is a red pelican. The red pelican indicates that the file is an IRI job script.
An asterisk (*) immediately before the file name (as with the tab SortChiefs.scl) means that changes to that file have not been saved.
There is a button after the last tab with the label >>3. This indicates that there are 3 more files open in the editor window. Click that button to see a list of names for all open files for the editor. The first 3 file names are in bold because there was no room for these files to have tabs. The next 3 file names are for the files that have a tab in the editor window. Click on any file name to view it in the editor window.
The tab for SortChiefs.scl is the active tab and is using the SCL editor. Its default color scheme (which you can change) is as follows:
- Reserved words in scripts are red.
- Quoted parameters are blue.
- Comments are green.
- Everything else is normal black text.
You can edit the file by typing in changes or adding additional lines. The SCL editor is aware of what is valid syntax for job scripts; it displays a white x inside a red circle before any line with invalid syntax. The incorrect line below is missing a slash (/) before the key word PROCESS:
If you right click inside the SCL editor, these menus will appear:
The first menu has some of the normal editing options like save, cut, copy, and paste. If you click on Source, the Toggle Comment is useful. To apply this, highlight lines in the script, and then click on Toggle Comment.
Each of the highlighted lines will have a number sign (#) placed at the beginning of the line to indicate that the line is a comment and not an active line for the script. Repeat the process to remove the #.
If you click on IRI, the next menu has three groups of options:
- Items in the first group take you to specific wizards that edit or add to the existing script.
- The second group creates special files from the script.
- The third initiates some special procedures for the script
A right-click on -> IRI -> CoSort shows menu options to:
- Edit Job Controls: set controls at the top of the script that apply to the whole job
- Add/Replace an action; i.e., create or replace a sort, join, or merge definition.
Run Your Job from the Editor
Run the active job script by selecting one of two menu options:
- Run As -> IRI Job: This will execute the job and then display something similar to the following in the Console.
Time taken 0.0 seconds
- Debug As -> IRI Job: This will execute the job and then display the contents of the Cosort Error Log (.cserrlog) in the Console when the job completes. This gives detailed information from the run.
If an error is encountered by either method during the execution, a popup named Problem Occurred will display the error. If you run with Debug As, it is possible to get more information concerning the error.
Now we know that there is a context-sensitive SCL editor in IRI Workbench for working directly with job scripts and DDF files. These same files could be created from wizards or diagrams, and then edited in the SCL editor (or vice versa).
Once your job scripts are complete, save and run them from the editor or using other options in the Eclipse GUI. You can even work with the same scripts in other text editors, and run them from the command line.
Email firstname.lastname@example.org for help with the script editor, or other job design methods in IRI Workbench.