# Lab: DataStage: Read from a database (Db2 on IBM Cloud)

DataStage Flow Designer enables users to create, edit, load, and run DataStage jobs which can be used to perform integration of data from various sources in order to glean meaningful and valuable information.

The purpose of this lab is to design a DataStage job to satisfy the following problem statement:

> As a data engineer, you have been asked by the Line of Business that you support, to produce a new data file that contains all employees whose total compensation is less than $50,000. The file must also contain the Department Name that the employee works in, and the mean average salary of all employees in that department who earn less than 50,000. In addition, the file must be sorted in descending order, based on the mean average salary amount. Finally, the application that will consume this file, expects the full name of the employee to be in one field, formatted as first, middle initial, last).

**NOTE**: You can use the ***Peek*** stage to check intermediate results in the job as demonstrated in [Lab 1](https://ibm-developer.gitbook.io/datastage-standalone-workshop/getting-started/lab-file).

In this lab, you will learn:

* How to create a job in DataStage.
* How to load data from Db2 Warehouse into DataStage.
* How to perform transformations such as modifying tables, joining tables, aggregating table data and sorting table data.
* How to write tabular data from DataStage into a file.
* How to run jobs.
* How to view logs for jobs.

> **NOTE:** You can use the ***Peek*** stage to check intermediate results in the job as demonstrated in [Lab 1](https://ibm-developer.gitbook.io/datastage-standalone-workshop/getting-started/lab-file).

This lab is comprised of the following steps:

1. [Create a Transformation project](#1-create-a-transformation-project)
2. [Add database connection](#2-add-database-connection)
3. [Create the job](#3-create-the-job)
4. [Compile and run the job](#4-compile-and-run-the-job)
5. [View output](#5-view-output)

## Before you start

Before we start the lab, let's switch to the `iis-client` VM and launch `Firefox`.

![Switch to iis-client](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F7dc79e3099f62e71db7a309fbe9e9ca6ffe7e55f.png?generation=1598466924598246\&alt=media)

Click on `Classic Launchpad` in the Bookmarks tab. The first time you try this out, you might see a certificate error. To get past it, click on `Advanced...` and then click `Accept the Risk and Continue`.

![Classic Launchpad](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F72035509a34ddf5af9d2adf7e60d1478266a7b8b.png?generation=1598466923106435\&alt=media)

Click on `DataStage Flow Designer`.

![Select DFD](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F53508a71792ae1b207a3b0e2698886bea4fdfd68.png?generation=1598466923264184\&alt=media)

Login with the credentials `isadmin`/`inf0Xerver`.

![Log into DFD](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F259de69177693c0e88dfe9745b3003f57c0b06d8.png?generation=1598466923725947\&alt=media)

This brings up the `DataStage Flow Designer`. Click `OK`.

![DFD is up](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fa5312451abc97359e19240f4ca18affc86a03add.png?generation=1598466922934536\&alt=media)

## 1. Create a Transformation project

* On the IBM DataStage Flow Designer, click on the `Projects` tab and click `+ Create`. In the modal that opens up, type in a name for the project and click `Create`.

![Create project](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fe8b4cb37654f995a1721b1723521edeccc9691ce.png?generation=1597931041549279\&alt=media)

The project takes a few minutes to be created and once ready, it will be visible on the `Projects` tab.

![Project created](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F35976c5d8f6c6e794d2b7b7bc48c7c72e574a1bd.png?generation=1597931040131409\&alt=media)

* Click on the tile for your newly created project. In the modal that opens up, verify that the name of your project is provided as the `Project Name` and click `OK` to switch the project.

![Switch project](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F558ea8dde8e2186df8b6461bb4960e42eaa2fee3.png?generation=1597931058523358\&alt=media)

## 2. Add database connection

The input tables - `EMP` (containing employee data) and `DEPT` (containing department data) - are already loaded in Db2 Warehouse. Let's add a Db2 warehouse instance as a `Connection` in DataStage.

* Click on the `Connections` tab and then click `+ Create` to add a new connection.

![Create connection](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fd30b0312853cf3304e1e01b2c119c7e484e655a1.png?generation=1597931062755971\&alt=media)

* Provide the following connection details and click `OK`. Click `Save` on the new modal that pops up.

```
Name: DB2WH
Connector type: JDBC
URL: jdbc:db2://db2w-kzwbsid.us-east.db2w.cloud.ibm.com:50001/BLUDB:sslConnection=true;
Username: bluadmin
Password: ****************
```

![Add connection](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Faeb9f95fb2ac0f1cacdfe8caad9f838a5c90fb95.png?generation=1597955740546140\&alt=media)

A tile for the new connection will now be displayed in the `Connections` tab.

![Created connection](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F8d9841432f7162babb5acb045085077b677fe4f2.png?generation=1597955745579282\&alt=media)

## 3. Create the job

* Click on the `Jobs` tab and then click `+ Create`. Click `Parallel Job`.

![Create parallel job](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fdbdfa4b998e8dd1b8596bf1439f0cf00e9dcae8d.png?generation=1597931062041130\&alt=media)

A new tab with the name `Job_1*` opens up where you can now start designing the parallel job.

The first step is to load the input tables `DEPT` and `EMP` into DataStage.

The `DEPT` table contains the following columns:

| Column Name | Data Type   | Nullable |
| ----------- | ----------- | -------- |
| DEPTNO      | VARCHAR(3)  | N        |
| DEPTNAME    | VARCHAR(36) | N        |
| MGRNO       | CHAR(6)     | Y        |
| ADMRDEPT    | CHAR(3)     | N        |
| LOCATION    | CHAR(16)    | Y        |

The `EMP` table contains the following columns:

| Column Name | Data Type    | Nullable |
| ----------- | ------------ | -------- |
| EMPNO       | CHAR(6)      | N        |
| FIRSTNME    | VARCHAR(12)  | N        |
| MIDINIT     | CHAR(1)      | Y        |
| LASTNAME    | VARCHAR(15)  | N        |
| WORKDEPT    | VARCHAR(3)   | Y        |
| PHONENO     | CHAR(4)      | Y        |
| HIREDATE    | DATE(4)      | Y        |
| JOB         | CHAR(8)      | Y        |
| EDLEVEL     | SMALLINT     | N        |
| SEX         | CHAR(1)      | Y        |
| BIRTHDATE   | DATE(4)      | Y        |
| SALARY      | DECIMAL(9,2) | Y        |
| BONUS       | DECIMAL(9,2) | Y        |
| COMM        | DECIMAL(9,2) | Y        |

* First, drag a ***Connection*** connector to the canvas. In the modal that opens up, select the `DB2WH` connection that was created earlier and click `Next`.

![Create connection - select connection](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F760d24824b6741476b2f5ec2ee08471bbd137123.png?generation=1597931062663207\&alt=media)

* On the next screen, select the `BLUADMIN` schema and click `Next`.

![Create connection - select schema](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F36299bc545d1e69a00487bf0f8257b55f80092f4.png?generation=1597931060574583\&alt=media)

* On the next screen, select the `DEPT` table and click `Next`.

![Create connection - select table](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fa6aac6174481841d0a59275589ce189bfab457f0.png?generation=1597931064763601\&alt=media)

* On the next screen, click `Add to Job`.

![Create connection - add to job](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F6d9ca6691667391ba1074d6a1336c6a298d39810.png?generation=1597931044153102\&alt=media)

* Drag another ***Connection*** connector to the canvas and repeat the steps given above but this time, select the `EMP` table instead. Once you complete the steps, you should see the two ***Connection*** connectors on the canvas.

![Create connection - completed](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fcf03358509fe9504746df7a4e8ba947ec9257408.png?generation=1597931038118113\&alt=media)

Use a ***Transformer*** stage to perform the following two modifications:

1. Update the output of the `EMP` table by replacing any NULL `MIDINIT` values with `" "`. This is needed for a future step where we will combine the FIRSTNME, MIDINIT and LASTNAME columns to create the FULLNAME of the employee.
2. Currently, the `EMP` table uses the `WORKDEPT` column to identify the department number whereas the `DEPT` table uses the `DEPTNO` column. Modify the output of the `EMP` table by changing the name of the `WORKDEPT` column to `DEPTNO`. This is needed for a future step where we will ***Join*** the two tables.
3. Drag and drop a ***Transformer*** stage next to the ***Connection*** connector for the `EMP` table. Provide the output of the `EMP` table ***Connection*** connector as the input to the ***Transformer*** stage. For this, click on the little blue dot on the right side of the ***Connection*** connector and drag the mouse pointer to the ***Transformer*** stage.

**NOTE**: For another method to connect the ***Connection*** connector to the ***Transformation*** stage, click on the ***Connection*** connector to select it, then drag and drop the ***Transformation*** stage. The ***Transformation*** stage will automatically be connected to the ***Connection*** connector.

![Add transformer for EMP](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F87464b6cc328172be3c907a70aeb0099eeb954d1.png?generation=1597931024093857\&alt=media)

* Drag and drop a ***Join*** stage to the canvas and provide the output of the ***Transformer*** stage as the input to this ***Join*** stage.

![Add join stage](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F75e800c76f2034b2a7dce5abc211cb87d7698cee.png?generation=1597931064896301\&alt=media)

* Double click on the ***Transformer*** stage to open up the stage page. In the `Properties` tab, click `+ Add`. A new entry is added in the table below. Use this to define a "Stage variable" (a local variable that is available only within this stage) named `MIDINITIAL` which will represent the middle initial of the employee with any NULL values replaced with the empty string. Double click on `{derivation}` to open up the Derivation Builder.

![Transformer - 1.1 - add MIDINITIAL](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F945a73131207e36ee9153e77bf054ad4b8be8b93.png?generation=1597931060072826\&alt=media)

* Begin building the derivation rule for `MIDINITIAL` by finding the `NullToValue` function in the table. Clicking on the entry in the table will insert it in the "Derivation" at the top. You can also use the search bar to look for the function. Replace the `%input_column_input_column%` with the `<Link>.MIDINIT` input variable which can also be found in the table and the `%value%` with `" "`. `<Link>` represents the identifier of the input link for the ***Transformer***. Click `OK` to go back to the Stage page.

![Transformer - 1.2 - add MIDINITIAL derivation](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F977924bc298732a0d78d031c7e8889927a348444.png?generation=1597931065163112\&alt=media)

* Update the *Name* of the stage variable to *MIDINITIAL*, the *SQL type* to *Char*, the *Precision* to *1* and the *Scale* to *0*.

![Transformer - 1.3 - complete MIDINITIAL](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F3dc7808ee8881b6855d22415aacfc80a974879fa.png?generation=1597931036106428\&alt=media)

* Now go to the `Outputs` tab and in the table find the entry for the `MIDINIT` column. Double click on the derivation value for this entry (it will open up the Derivation builder) and change the derivation value to use the newly created `MIDINITIAL` stage variable instead. Next, look for the entry for the `WORKDEPT` column. Double click on the `WORKDEPT` value under the `Column name` column and replace the text with `DEPTNO`. Click `OK`.

![Transformer - 1.4 - updates on Output tab](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fcc3e12ace53b7c9a22ec49d4fb595a1de6606092.png?generation=1597931060951312\&alt=media)

* Both the tables now have a column called `DEPTNO` which can be used to join the tables. Provide the output of the `DEPT` table ***Connection*** connector as the second input to the ***Join*** stage. Double clicking the ***Join*** stage brings up the stage page where you can verify that the `DEPTNO` is being used as the `JOIN KEY` and the `Join Type` is `Inner`.

![Connect DEPT to Join](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F854220ec29b717e58dac607e2c609d54571a484b.png?generation=1597931042636380\&alt=media)

* Next, add a ***Transformer*** stage to the canvas and provide the output of the ***Join*** stage as the input to the ***Transformer*** stage.

![Add transformer stage](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F784661f3f7831c376217c715e295fc86f83350f7.png?generation=1597931068022214\&alt=media)

* Double click the ***Transformer*** stage to open the stage page. We will add 2 stage variables to this ***Transformer*** stage. In the `Properties` tab, click `+ Add`. A new entry is added in the table below. Use this to define a stage variable named `TOTALCOMP` which will represent the total compensation (the sum of bonus, commission and salary) of the employee. Double click on `{derivation}` to open up the Derivation Builder.

![Transformer - 2.1 - add TOTALCOMP](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F3e4a0cef701d874edc7742f4b172042504ab9516.png?generation=1597931064028155\&alt=media)

* Build the derivation rule for TOTALCOMP by finding the `BONUS`, `COMM` and `SALARY` input columns in the table. Clicking on the entries in the table will insert them in the "Derivation" at the top. Type in `+` signs between them in order to complete out the derivation. You can also use the search bar to look for the fields. When inserted in the "Derivation", the column names will be prepended with the identifier for the input link. Click `OK` to go back to the Stage page.

![Transformer - 2 - build TOTALCOMP derivation](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fb20f800419ceac372cc5451491886d04298d4b91.png?generation=1597931043314459\&alt=media)

* Update the *Name* of the stage variable to *TOTALCOMP*, the *SQL type* to *Decimal*, the *Precision* to *9* and the *Scale* to *2*.

![Transformer - 3 - complete TOTALCOMP](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F282ce4e0c55ef6fbbae3fee9b9c0106864c7abe3.png?generation=1597931063007760\&alt=media)

* Repeat the process above to add another Stage variable `FULLNAME` which will represent the complete name of the employee. Provide the *Derivation* as `CompactWhiteSpace(<Link>.FIRSTNME:" ":<Link>.MIDINIT:" ":<Link>.LASTNAME)`, the *Name* of the stage variable as *FULLNAME*, the *SQL type* as *Varchar* and the *Precision* as *36* and the *Scale* as *0*. Click `OK` to save the changes and return to the canvas.

**NOTE**: `<Link>` needs to be replaced with the identifier of the input link. *CompactWhiteSpace* is a function that will compact any continuous white spaces into a single white space. `:` is the operator used for concatenation.

![Transformer - 4 - complete FULLNAME](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F4e4d7c84fe209a2cdcf85f38c8215f69a96a361b.png?generation=1597931023135666\&alt=media)

* Next, add a ***Join*** stage and an ***Aggregator*** stage to the canvas. Connect the ***Transformer*** stage to both these stages such that the output of the ***Transformer*** stage is provided as the input to both these stages.

![Add join and aggregator](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F9e05387097cc46060e065a60667034bb95a90b0c.png?generation=1597931054104462\&alt=media)

Since the output links have now been added, we can provide the 2 stage variables `TOTALCOMP` and `FULLNAME` as outputs of the ***Transformer*** stage and once that is done, these values will be available as inputs in the subsequent stages.

* Double click on the ***Transformer*** stage to open the stage page. Go to the `Outputs` tab. Click on `+Add` twice to add 2 new entries in the table. Update one entry with the *Derivation* value as *TOTALCOMP*, the *Column name* as *TOTALCOMP*, the *SQL type* as *Decimal*, the *Precision* as *9*, the *Scale* as *2* and set *Nullable* to *true*. Update the second entry with the *Derivation* value as *FULLNAME*, the *Column name* as *FULLNAME*, the *SQL type* as *Varchar*, the *Precision* as *36* and the *Scale* as *0*.
* We also need to add a *Constraint* here, which will ensure that only the records with `TOTALCOMP` more than 50000 are sent in the output. Click on the empty space under `Constraint` to open up the Derivation Builder. Specify the derivation as `TOTALCOMP>50000`.
* Switch to the second output link by clicking on the `Link_<number>` under *Output name* and repeat the above steps to add the 2 stage variables to the output and to add the constraint. Click `OK` to save the changes and return to the canvas.

![Transformer - add output columns and constraint](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F97e7572e5f25fe576393a6b411caef9689889554.png?generation=1598466923850018\&alt=media)

* Provide the output of the ***Aggregator*** stage as the input to the ***Join*** stage. Double click on the ***Aggregator*** stage to open the stage page. Select `DEPTNAME` as the grouping key.

![Aggregator - 1 - add grouping key](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fb7f8a48fd45470cd73865b9db379a5f7e3d167d4.png?generation=1597931057255465\&alt=media)

* Scroll down to the *Aggregations* and select the *Aggregation Type* as `Calculation`, *Column* as `TOTALCOMP`, *Calculation Type* as `Mean Value` and click `Add Calculation +`.

![Aggregator - 2 - add calculation](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F8701b613051c565c5272325266e6e73ae6dda2e0.png?generation=1597931028150486\&alt=media)

* Go to the `Outputs` tab and verify that you can see 2 output columns - `MEAN_TOTALCOMP` and `DEPTNAME`. Click `OK` to save the changes and return to the canvas.

![Aggregator - 3 - confirm output columns](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fa87102547800223b3b2b296e280bb0d1dacb1445.png?generation=1598466923717605\&alt=media)

* Drag and drop a ***Sort*** stage on the canvas and provide the output of the ***Join stage*** as the input of the ***Sort*** stage.

![Add sort stage](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F2280ce35676ec874bc3139c431631fe7793b2b54.png?generation=1597931034161485\&alt=media)

* Double click on the ***Join*** stage to open the stage page. On the `Properties` tab, verify that the *Join Key* is `DEPTNAME` and the *Join Type* is `Inner`.

![Confirm join stage](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F7bdf4ce24da2618a8ef32e9232c51a96074e2c09.png?generation=1597931063981904\&alt=media)

* Go to the `Outputs` tab and verify that you can see `FULLNAME` and `MEAN_TOTALCOMP` in the output column list.

![Confirm join stage outputs](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F045e0667479091c7c18cc8997efc5ee897a370d9.png?generation=1597931065727924\&alt=media)

* Double click on the ***Sort*** stage to open up the stage page. Specify the *Sorting Key* as `MEAN_TOTALCOMP` and the *Sort Order* as `Descending`. Click `OK`.

![Update sort stage](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F505a06faf545cdfb9b61d2ab21330bf89d610509.png?generation=1597931053081929\&alt=media)

* Drag and drop a ***File*** connector to the canvas. In the modal that opens up, check the `Add connector as target` checkbox and click `Add to Job`.

![Add file connector](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F891d581bcb3a5e1e932d488a22ffedb2d41a33f6.png?generation=1597931050255247\&alt=media)

* Provide the output of the ***Sort*** stage as the input to the ***File*** connector. Double click the ***File*** connector to open the stage page, and provide the name of the output *File* as `output.csv`. Specify `Comma-separated value (CSV)` as the *File format*. Enable `First row is header` and provide *Null value* as `""`. Click `OK`.

![Update file connector](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F67ddb83b6e8fe2726d3fa70e6142e00d7fa8b1f6.png?generation=1598466923555285\&alt=media)

## 4. Compile and run the job

* Click the `Save` icon to save the job. If you wish to, you can provide a different name for the job in the modal that pops up. Click `Save`. Once the job is saved, click on the `Compile` icon to compile it. If compilation is successful, you should see a green check mark and the message `Compiled successfully` displayed on the screen.

![Save compile](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fffeafed04ac0058e753a75df8b939a769e72b6a8.png?generation=1597931063320224\&alt=media)

* Click the `Run` icon to run the job. In the modal that opens up, click `Run`.

![Run job](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Faa18c993cf45315f0a35daa072600ebe7d1e4f03.png?generation=1597931022104885\&alt=media)

## 5. View output

* The output file will be saved on the server. Switch to the server VM by clicking the first icon on the `Environment VMs panel` and selecting `iis-server`. Login as the `root` user with the password `inf0Xerver`.

![switch to server VM](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F71c22640d66fbf20e76fbc84c13bd2aadb4f3961.png?generation=1597931046237050\&alt=media)

* CD to the location where you had stored the file. If you provided a path starting at "/", then it will be stored at that location in the server. Since we had only provided `output.csv` as the file path in the ***File*** connector, the file will be available in the Transformation project's folder, i.e.,

```
/opt/IBM/InformationServer/Server/Projects/<project-name>/
```

![CD to project folder](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F2e5ace0ff267e28f41b74eefa2ec6ed049d8ccb9.png?generation=1598466923196059\&alt=media)

**CONGRATULATIONS!!** You have completed this lab!
