Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do i do it without using DBD::DB2 drivers or DBI cpan module
    primarykey
    data
    text
    <p>I have written this code using the DBI module , Here is the code</p> <pre><code>#!/usr/local/bin/perl -w use DBI; use strict; # Open a connection my $dbh = DBI-&gt;connect("dbi:DB2:awdrt", "db2inst1", "db2inst1", {RaiseError =&gt; 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-&gt;prepare($stmt); $sth-&gt;execute(); # associate variables with output columns... my ($col1,$col,$col3,$col4); $sth-&gt;bind_col(1,\$col1); $sth-&gt;bind_col(3,\$col3); $sth-&gt;bind_col(4,\$col4); while ($sth-&gt;fetch) { if ($col3 &lt;= 2000){ print "$col1 has $col3 pages with container $col4\n";} } $sth-&gt;finish(); $dbh-&gt;disconnect(); </code></pre> <p>Here's the O/p : </p> <pre><code>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 </code></pre> <p>And the table data when the query is executed is :</p> <pre><code>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. </code></pre> <p>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? </p> <p>Help is appreciated.....</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload