Hi,
I did struggle quite a while to get this right but am again
back to where i started from. I am still unable to get
this work. Below is the code that I am using

Any suggestions?

#!/usr/bin/perl # Initialize Server Specific Variables $server = <STDIN>; $user = <STDIN>; $password = <STDIN>; $omnihome = "/app/netcool/omnibus"; # Initialize Variables that define SQL Login Commands $sqsh_string = "${omnihome}/bin/nco_sql.sqsh -server $server -user $us +er -password $password"; #---------------------------------------------------------- # Script Body #---------------------------------------------------------- #$running = `$test`; # Initialize SQL Action Statements $sql_select_Procedure = "select ProcedureName, SQLBlock from persist.p +rocedures"; # Select ProcedureName and SQLBLock &GetRawProcedureData; my %pairs = split /_KJ_/, $raw_data; for (keys %pairs) { open(my $out, '>>', $_) or die "open(out): $!\n"; print $out %pairs{$_}; } #---------------------------------------------------------- # Subroutines #---------------------------------------------------------- sub GetRawProcedureData { $raw_data = `$sqsh_string <<'EOF'; $sql_select_Procedure go quit EOF`; }

The raw output from DB query.

output from query script: send_email_yvs_kj_ create or replace procedure send_email (in node character(1), in sever +ity integer, in subject character(1), in email character(1), in summa +ry character(1), in hostname character(1)) executable '$OMNIHOME/util +s/nco_mail' host hostname user 0 group 0 arguments '\''+node+'\'', se +verity,'\''+subject+'\'','\''+email+'\'','\''+summary+'\'';_yvs_kj_ jinsert_yvs_kj_ create or replace procedure jinsert( in serial int, in uid int, in t +stamp utc, in msg char(4080) )begin---- Procedure inserts a record i +nto the alerts.journal table. Automations that -- require journal ent +ries should execute this procedure.---- Usage: -- call procedure ji +nsert( old.Serial, %user.user_id, getdate, 'This is my journal entry' +);-- insert into alerts.journal values ( journal_keyfie +ld( to_int( serial ), to_int( uid ), tstamp ), -- KeyField + serial, -- Serial uid, + -- UID tstamp, + -- Chrono split_multibyte(msg, 1, 255), -- + Text1 split_multibyte(msg, 2, 255), -- Text2 + split_multibyte(msg, 3, 255), -- Text3 spli +t_multibyte(msg, 4, 255), -- Text4 split_multibyte(m +sg, 5, 255), -- Text5 split_multibyte(msg, 6, 255), + -- Text6 split_multibyte(msg, 7, 255), -- Text7 + split_multibyte(msg, 8, 255), -- Text8 + split_multibyte(msg, 9, 255), -- Text9 split_multi +byte(msg, 10, 255), -- Text10 split_multibyte(msg, 11 +, 255), -- Text11 split_multibyte(msg, 12, 255), -- +Text12 split_multibyte(msg, 13, 255), -- Text13 + split_multibyte(msg, 14, 255), -- Text14 sp +lit_multibyte(msg, 15, 255), -- Text15 split_multibyt +e(msg, 16, 255) -- Text16 );end_yvs_kj_ convert_severity_yvs_kj_ create or replace procedure convert_severity (IN omnibus_severity INTEGER, OUT tec_severity INTEGER) BEGIN if (omnibus_severity = 5) then set tec_severity = 50 elseif (omnibus_severity = 4) then set tec_severity = 40 elseif (omnibus_severity = 3) then set tec_severity = 40 elseif (omnibus_severity = 2) then set tec_severity = 30 elseif (omnibus_severity = 1) then set tec_severity = 10 else set tec_severity = 10 end if; END_yvs_kj_

In reply to Re^4: export table to text. by Anonymous Monk
in thread export table to text. by kirtivardhan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.