Head Tail and Sample


  Head is a debug stage that picks top ‘n’  records from all the nodes  (or)Specific nodes.


  • Head 7 properties
  • Rows

All rows  (After skip)  = false

Number of rows (preparation) = 2

  • Available properties period preparation skip the preparation
  • Partitions

All Partitions = True

Click on output 7Do the mapping 7Ok  

In the output:-

Top 2 records will be displayed

[In Sequential file, if we load multiple files, then set

S.F 7properties àoptions 7 Keep file partitions = True]


Tail is a debug stage which picks bottom ‘n’ records from all nodes or specific nodes

  • Tail
  •  properties
  •  Rows

Number of rows (preparation) = 2   Partitions

  • 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 7 properties 7Set No. of row  (per partition) = 40

In Tail7Properties7Set No. of row  (per partition) = 10

  Display records  


Sample is also a debug stage, which operates in ‘2’ Modes  

  1. Period 7 1 input and 1 output
  2. Percentage 7 1 input and 1 output

Period is interval of records if period = 2 , displays 2,4, 6,8,10……….

  • Sample


  • Options

Percent =?

Out click number =?

Sample mode – period /percent

If period


  • Period (per partition)  =2 7 output à Mapping 7 ok

If percent

  Since it has multiple outputs it follows the link to order.



Percent = 50

Output link Number =

Percent = 25

Output link number =

Sample Mode = percent 7 Click on link ordering (To know the link label) 7

0       t2

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 7 Detailed info abt execute


S.F 7 load peek 7 we can view data here 7   



No. of Records = 5  (per partition) (All the 5


Records will be sent to the job log)7


Peek Records output Mode = Job log7


ok   7After Compilation and Run, Go to “Tool”

  • Tool


Run Director


Select the job


Click on job log Symbol

  • In that, we can see 3 types of colors


  1. Green – ok
  2. Red – Error
  3. Yellow – Warning

To clear the Warnings

Right click on Warning (or) double click 7 Warning   Message will be displayed 7Identify 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 a “Reject link” and capture the mismatched data

Message Handing

Right-click on  Yellow Warning 7Add to Message Handler 7 Actions (Suppress / Demote) 7Add Ruler 7ok Warning get converted into Information


Job 7Right-click 7filter (put the options)

7click on job name 7 we can see 5 records  

Peek properties 

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 stage then attach a peek

Stage to each Transformation :   Oracle --- Sort 7 Transformation1 7Transformation 2 7Transformation 3 7Data 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.


Inclined to build a profession as Datastage Developer? Then here is the blog post on, explore Datastage Training

For Ex:-  If we have a table will field and 9 records, and wanted to display only 2 fields with 9 records.

Peek 7 properties 7 No. of Records = 4 (per partition) 7columns 7Input column to peek = c id, Input column to peek = State, Peek all input columns = false 7 ok 7After compile and Run Tools 7 Run Director 7Select job 7 log 7Event Detail window appears

Output :-  peek 1, 0: cid 1 , state AP

If we want to display only records without displaying column names

Columns Show column Name = false  

  1. Make the source into Multiple copies

  Display records      

7 Peek 7 properties 7 No. of Records = 5  7 peek Records output Mode = job log 7Go to “output” tab 7 Map the data (l1, l2, l3) 7 ok

7Compile 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 record      

Peek 7 properties 7 No. of Records = 5 7 peek Record output Mode = output 7Output 7 Map the data 7 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 7 view data 7 we can see 5 records ( that is peek data)

7Suppose the client needs only rejected, but not output, thenHere we use peek as the output stage

  Dead end  

  • Here peek is used as STUB Stage, a place holder to store the data.

For an in-depth understanding of DataStage click on