Вы находитесь на странице: 1из 4

Exercise 4-1: Building a Job

Important!

Before working on the exercises, download the Exercise Files


and load them into a directory named c:\DS314SvrFiles. Click
the Exercise Files button on the Exercise page, to do this.
Note: If you are copying this directory from the CD, be sure to
remove the Read Only properties of the directory and its files.

Recommendation! Prefix the names of jobs and other objects


you create in DataStage with your initials. This will allow you
to distinguish your jobs from jobs in the Solution set with the
same names that you import for examination.

Click the Exercise Jobs button to download the jobs and other
DataStage objects in the Solution Set. You can check your
jobs against the jobs in this file. You will learn how to import
jobs from this file in Module 5. If you have trouble with
completing this exercise, go on and complete Module 5, and
then return to the exercise.

Assumptions:

There is a file named Jobs.txt in your DS314SvrFiles directory.

Task: Start Designer and attach to your project


1

Start Designer.

On the Attach to Project window log on to your project. The


New window is displayed.

Click the Server icon and then click OK to open a new Server
job.

Task: Create a job that copies data in a sequential file


Here is the summary. Detailed steps follow the summary.
In this task you create a simple job that copies a sequential file. Since
it is a straight copy you will not use a transformer stage. Here are the
details:

Job name:

JobsCopy

File to copy:

Jobs.txt

File directory:

\DS314SvrFiles

DataStage Essentials

Exercise 4-1

Name of output file:

JobsCopy.txt

Directory to copy to:

\DS314SvrFiles

Overwrite the data in the output file

Include column names in the first record (line) of the output file

Steps
1

Add the two sequential stages and the link between them.
Give appropriate names to the stages and link

Open the Jobs.txt file in a text editor and determine the


following:
Column delimiter
Column definitions
Does first column contain column names?

Define the source sequential stage.


Use the View Data button in the stage to verify that you have
defined the data correctly.

Define the target sequential stage.

Add an Annotation stage to your job. Open the Annotation stage.


Document what your job does. Choose a suitable font and color
for the text and background.

Open the Property Browser window. Select each of your stages


and view the information that is displayed in the Property
Browser window.

Click on your link label. Add appropriate documentation in the


Property Browser window as to what is going in the link and
what is going out of the link.

DataStage Essentials

Exercise 4-1

Save your job.

Compile your job.

10 Move to Director from the Designer and then validate and run

your job.

View the log events as your job runs


Determine how many rows were copied from the Jobs.txt by
double-clicking on the events in the log and viewing the
information.
11 Go back to Designer and view the data in the output file.

Task: Create a job with a transformer


In this task you create a simple job that extracts data from the jobs.txt
file and then loads just the job IDs and descriptions into a sequential
file. Here are the details:

Job name:

JobNames

File to copy:

Jobs.txt

File directory:

\DS314SvrFiles

Name of output file:

JobNames.txt

Directory to copy to:

\DS314SvrFiles

Overwrite the data in the output file.

DataStage Essentials

Exercise 4-1

Exclude the column names record from the first line in the output
file.

Use the pipe (|) for the column delimiter in the output file.

In the output file, make the first column the job description and the
second column the job ID.

Steps
1

More or less the same steps as in the previous task, except that
you need to add a transformer stage and define the movement of
data from the input link to the output link.

To define the movement of data through the transformer, open the


transformer and drag the source columns from the upper left pane
to the upper right pane.

Validate and run your job. View the data in the output file after
the job runs.

Вам также может понравиться