Professional Documents
Culture Documents
com +917411642061
Lab 20
Command Task
BANGALORE TECHNICAL TRAININGS..........................1 Onlinetrainingsbglr@gmail.com.....................................1 +917411642061.................................................................1 Lab 20...............................................................................1 Lab at a Glance................................................................2 Objectives..............................................................2 Summary................................................................2 Duration.................................................................2 Exercises..........................................................................3 Exercise 1: Create a Workflow with a Command Task.......................................................................3
20 - 1
Lab at a Glance
The exercise in this lab is designed to walk the student through the process of creating a Command task.
Objectives
After completing the lab, the student will be able to: Use a Command task.
Summary
ABC Inc. needs to capture the invalid employee data from multiple runs of the same session into one combined file. This workflow will utilize the Command task to combine the data from two flat files, into one. The target flat file from an earlier run of this workflow will already exist. The file from this rerun of the same session will have to be named differently, then a subsequent Command task will combine the new file with the previous flat file, to form a third file. The completed workflow should look as follows:
Duration
This lab should take approximately 30 minutes.
20 - 2
Exercises
Exercise 1: Create a Workflow with a Command Task
Step 1. Create the workflow. Select the wf_ODS_EMPLOYEE_INVALID_TYPES_xx workflow in the Navigator window. Select Edit | Copy. Select Edit | Paste. The Copy Confirmation dialog appears.
Click Yes. The Copy Wizard appears. Select the Rename checkbox, and then click the Edit button.
20 - 3
Click the Finish button to exit the wizard. Step 2. Edit the session.
.
Drag and drop the new workflow into the Workflow Designer workspace. Edit the session task.
On the Mapping tab, select the target FF_EMPLOYEE_INVALID_xx and edit the Output filename. After your student _xx suffix, change the 1 to a 2. This will create a second flat file that will later be merged with the first file, in a Server command.
The Merge File Name field does not provide a vehicle to merge files. The filename is only used when using the PETL (partitioned ETL) feature. It specifies the file name into which the partitioned output data will be recombined.
Click OK. Step 3. Create a command task. Add a Command task by clicking on Command task icon
.
in the toolbar. Edit Command task. Rename the Command task cmd_COMBINE_FILES. Click on the Commands tab. Click the Add a new command button. Name the command combine1 and enter the following command in the Command field. Replace path with the Server directory path provided by the Instructor.
20 - 4
In the command syntax, the first file (invalid_xx1.out) represents the target flat file from the prior execution of this workflow.
If you are working on a Unix system, use the following command syntax: cat /path/TgtFiles/ff_employe e_invalid_xx1.out /path/TgtFiles/ff_employe e_invalid_xx2.out > /path/TgtFiles/ff_employe e_combined_xx.out Do not include any return characters.
Stand-alone Command task. Use a Command task anywhere in a workflow (or worklet) to run shell commands. Pre- and Post-Session shell command. Invoke a shell command, pre- or postsession, within the Session task properties. For more information about specifying pre-session and post-session shell commands, refer to the Workflow Administration Guide.
Double-click on the new link and add the link condition: $s_m_ODS_EMPLOYEE_INVALID_TYPES_xx.sta tus = succeeded Click OK. Click OK again to close the Expression Editor box. Notice the addition of text below the link. This is a visual
PowerCenter 9.x Level I Developer Lab Guide 20 - 5
in the
Workflow Monitor.
.
Examine the combined contents of the output file using a text editor, such as Notepad. The Instructor will provide guidance for viewing the file, if access to the Server output directory is possible from the classroom.
.
20 - 6