I have written this code using the DBI module , Here is the code
#!/usr/local/bin/perl -w
  use DBI;
  use strict;
# Open a connection
  my $dbh = DBI->connect("dbi:DB2:awdrt", "db2inst1", "db2inst1", {RaiseError => 1});
# use VALUES to retrieve value from special register
  my $stmt = "select RTRIM(substr(A.TBSP_NAME,1,30)),A.TBSP_TYPE as TYPE,A.TBSP_FREE_PAGES as FREE,B.CONTAINER_NAME as CON_PATH from SYSIBMADM.TBSP_UTILIZATION A ,SYSIBMADM.CONTAINER_UTILIZATION B where A.TBSP_ID=B.TBSP_ID and A.TBSP_AUTO_RESIZE_ENABLED=0 with UR";
  my $sth = $dbh->prepare($stmt);
  $sth->execute();
# associate variables with output columns...
  my ($col1,$col,$col3,$col4);
  $sth->bind_col(1,\$col1);
  $sth->bind_col(3,\$col3);
  $sth->bind_col(4,\$col4);
  while ($sth->fetch) { if ($col3 <= 2000){
  print "$col1 has $col3 pages with container $col4\n";}
        }
  $sth->finish();
  $dbh->disconnect();
Here's the O/p :
TRANS_DATA has 1616 pages with container /adrst/bdts/trans_data_container
MASTER_INDEX has 1872 pages with container /adrst/bdts/master_index_container
TRANSACTION_INDEX has 1856 pages with container /adrst/bdts/transaction_index_container
And the table data when the query is executed is :
1                              TYPE       FREE                 CON_PATH                                                                                                                                                                                   
------------------------------ ---------- -------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
USERSPACE1                     DMS                       15056 /adrst/bdts/userspc_container                                                                                                                                                              
USERSPACE1                     DMS                       15056 /adrst/bdts/userspc_container1                                                                                                                                                             
MASTER                         DMS                        3584 /adrst/bdts/master_container                                                                                                                                                               
TRANS_DATA                     DMS                        1616 /adrst/bdts/trans_data_container                                                                                                                                                           
MASTER_INDEX                   DMS                        1872 /adrst/bdts/master_index_container                                                                                                                                                         
TRANSACTION_INDEX              DMS                        1856 /adrst/bdts/transaction_index_container                                                                                                                                                    
TEMP_SYS                       DMS                        2192 /adrst/bdts/temp_sys_container                                                                                                                                                             
AUDIT_DATA                     DMS                        3360 /adrst/bdts/audit_data_container                                                                                                                                                           
TEMP_USR                       DMS                        2672 /adrst/bdts/temp_usr_container                                                                                                                                                             
TSASNCA                        DMS                        2840 /home/db2inst1/db2inst1/NODE0000/SQL00002/TSASNCA                                                                                                                                          
TSASNUOW                       DMS                        2880 /home/db2inst1/db2inst1/NODE0000/SQL00002/TSASNUOW                                                                                                                                         
TSASNAA                        DMS                        3712 /home/db2inst1/db2inst1/NODE0000/SQL00002/TSASNAA                                                                                                                                          
TSCDADDRESSMASTER              DMS                        2048 /home/db2inst1/db2inst1/NODE0000/SQL00002/CDADDRESSMASTER                                                                                                                                  
  13 record(s) selected.
What i am trying here basically report tablespaces with less than 2000 pages , Now my question is how do i do it without this module , What would be the better options , Hash,regex,grep? if so i need three columns to be reported as o/p , How do i do that using these or any thing that may come use?
Help is appreciated.....
 
     
    