Head Tail and Sample
Head is a debug stage which picks top ‘n’ records from all the nodes (or)Specific nodes.
- Head properties
All rows (After skip) = false
Number of rows (preparation) = 2
- Available properties period preparation skip preparation
All Partitions = True
Click on output Do the mapping Ok
In the output :-
Top 2 records will be displayed
[In Sequential file , if we load multiple files , then set
S.F properties àoptions Keep file partitions = True]
Tail is a debug stage which picks bottom ‘n’ records from all nodes or specific nodes
Number of rows (preparation) = 2
- All Partitions = false
Click on output mapping
Display last 2 records
Ex:- Suppose that we have 60 records and we need to display 30th record to 40th record.
Sol : In Head properties Set No. of row (per partition) = 40
In TailPropertiesSet No. of row (per partition) = 10
Sample is also a debug stage , which operates in ‘2’ Modes
- Period 1 input and 1 output
- Percentage 1 input and 1 output
Period is interval of records if period = 2 , displays 2,4, 6,8,10……….
Percent = ?
Out click number = ?
Sample mode – period /percent
- Period (per partition) =2 output à Mapping ok
Since it has multiple output it follows link ordering.
Percent = 50
Output link Number =
Percent = 25
Output link number =
Sample Mode = percent Click on link ordering (To know the link label)
1 ↔ t1
2 ↔ t3
Now assign these values accordingly in output – link number
Click on output
Perform the mapping fx t1, t2, t3
Peek :- (Multipurpose)
Peek is a debug stage which can be used for
- Send the records to the logs
- Make the Source to Multiple copies (can be used as “copy” stage)
- Used as STUB stage (place holder)
Log Detailed info abt execute
S.F load peek we can view data here
No. of Records = 5 (per partition) (All the 5
Records will be sent to the job log)
Peek Records output Mode = Job log
After Compilation and Run , Go to “Tool”
Select the job
Click on job log Symbol
- In that we can see 3 types of colors
- Green – ok
- Red – Error
- Yellow – Warning
To clear the Warnings
Right click on Warning (or) double click Warning Message will be displayed Identify the Warning and try to Eliminate them
Note:- “Missing” record delimiter “/r/n” (one type of error) (it means Mismatch)
In which Cases, we have to put an “Reject link” and capture the mismatched data
Right click on Yellow Warning Add to Message Handler Actions (Suppress / Demote) Add Ruler ok Warning get converted in to Information
Job Right click filter (put the options)
click on job name we can see 5 records
Rows all the rows (after skip) = false properties
Number of records (per partition) = columns period (per partition)
Peek all input columns = True partitions Skip (per partition)
All partition = true
Peek Records output Mode == Joblog properties
(or) output Deli meter string
Show column Name = True
- Suppose we want to see the data at each stages then attach a peek
Stage to each Transformation :
Oracle --- Sort Transformation1 Transformation 2 Transformation 3 Data set
↓ ↓ ↓
Peek 1 peek 2 peek 3
- To select only particular columns:-
Peek can send data to logs, peek can also send required columns to the logs.
Interested in mastering DataStage Training?
Enroll now for FREE demo on DataStage Training.
For Ex:- If we have an table will fields and 9 records, and wanted to display only 2 fields with 9 records.
Peek properties No. of Records = 4 (per partition) columns Input column to peek = c id , Input column to peek = State,Peek all input columns = false ok
After compile and Run Tools Run Director Select job log Event Detail window appears
Output :- peek 1, 0 : cid 1 ,state AP
- If we want to display only records with out displaying column names
Show column Name = false
- Make the source to Multiple copies
Peek properties No. of Records = 5 peek Records output Mode = job log Go to “output” tab Map the data (l1, l2, l3) ok
Compile and run the job Here peek Stage ads as copy stage and copies,The data as it is to the 3 data sets.
If we set peek Record output Mode = output , then
Peek properties No. of Records = 5 peek Record output Mode = output Output Map the data ok
- When we set peek Record output Mode = output, then the peek output
That is 5 records will be displayed in one of the .ds file , and in other .ds file
All records will be displayed.
- In Data set 3 view data we can see 5 records ( that is peek dat a)
Suppose the client needs only rejected, but not output, thenHere we use peek as output stage
- Here peek is used as STUB Stage , a place holder to store the data.
For indepth understanding of DataStage click on