How to use the new Debug feature in DataStage 8.x.x?
IBM has added a new debug feature for DataStage from the 8.5 version. It provides basic debugging features for testing/debugging the job design.
1.This feature is used from the designer client. So lets jump into creating a simple job and start debugging it!
2. As you can see the above job design is very simple;
I have a row generator stage that will generate 10 records for the column “number”
I have a row generator stage that will generate 10 records for the column “number”
3. And in the transformer I’ve hard-coded a column called “name” with the value ‘ABCDEFG’
The final stage is the peek stage that we all have been using for debugging our job design all these years.
Now that we understand the job desing, we’ll start debugging it.
Add breakpoints to links
- Right click on the link where you wish to check/debug the data and the following drop down menu appears
- Select the option, “Toggle Breakpoint”
- Once selected a small icon appears on the link as shown in the below screen shot
- We can also edit the Breakpoint, to do so we have to right click on the link again and select “Edit Breakpoints”. Following which the following popup will be displayed
- By default the breakpoint will be activated for every row. If the
need arises, we can change this to any value and the debugger will pause
the flow of records as and when it reaches that number
Ex: If we set the value for “Every N Rows” to 5, the debugger will display every record that is a multiple of 5, i.e., 5th records, 10th record, 15th record an so on.. - For the sake of this example we’ll change the value to 2
We are done setting up the breakpoints for the debugger, so lets
compile our job now. Once compiled, click on debug menu option and
select “GO”. Or simply press F5
The following popup appears and we are asked to run our job. Go ahead and run it -
Screenshot of job running in debug mode
Now our job is running in debug mode and as soon as the 2nd record passes through the link (DSLink10) the details of that particular record will be displayed in the debugger window for our needs
As you can see in the above screenshot, the data for that particular link is displayed along with the corresponding column name.
Once we are done analyzing the data we can request the debugger to either go to the next record of run till the end without hitting the breakpoints by clicking on the run button on the top left hand corner of the debugger screen
Debugging based on a condition
We saw until now how to set the debugger to break at a particular record count. Now lets select the option to break when a condition is satisfied.
In the Edit Breakpoint menu, we also have the option to select expression ( shown in the above screen shots).
Select that option and enter a expression/condition which matches your needs.
For the sake of this example, I’ll have the below expression
Now as per my condition, the debugger should pause the job when it encounters 6 in the column “number”
As you can see below the debugger paused the job when it saw the value 6 for the column number and showed the details for the other columns as well.
Select the “Run to End” option on the debugger window and the job will finish and wait for the next user input.
Close the window and go to the menu option “debug”. In that select “Clear All Breakpoints”. This will remove all breakpoints that you have set in your job.
No comments:
Post a Comment