denzil_cactus has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Converting Oracle report language code into perl
by GrandFather (Saint) on Jun 26, 2007 at 06:40 UTC

    You may find the answers to the rather similar question Oracle report converter posted by denzil_cactus helpful (oh, that was you too! Maybe not then).

    Generally if we can't answer a question to your satisfaction the first time round we are unlikely to do much better on subsequent asking within a few days. Maybe you need to go back to the answers you have already and try to work out why they are not suitable for you. Let me give you a hint: the answers are good, but you have chosen a large and possibly difficult problem to tackle.


    DWIM is Perl's answer to Gödel
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Converting Oracle report language code into perl
by CountZero (Bishop) on Jun 26, 2007 at 09:17 UTC
    The following script will extract all .define definitions and put them in a hash, where the keys are the names of the definitions and the values are the definition itself.
    use strict; use Data::Dumper ; my %defines; my $flag_in_define = 0; my $name; MAIN_LOOP: while (<DATA>) { if (m/^\.define (.*)/) { $flag_in_define = 1; $name = $1; next MAIN_LOOP; } if (m/^\.\./) { $flag_in_define = 0; next MAIN_LOOP; } if ($flag_in_define) { chomp; $defines{$name} .= $_; next MAIN_LOOP; } } print Dumper(\%defines); __DATA__ rem ------------------------ book_tab variables --------------------- .rem .declare book_no a13 .declare l_code a10 .declare l_booking a12 .set page_no 1 .set first "N" .set no_more_clauses "N" #dt 1 1 80 # #dt 2 1 6 9 48 50 61 63 76 80 80 # .define loktabs loc_table book_tab, book_hazmat, custdata2, edit_table, book_rates, print_table in share update mode .. .define get_input select key, key1, key2, passkey3, passkey4, print_name into input_booking_seq, fax_header, file_no, input_print_rates, myNoteId, print_name from ed_table where ed_table.tag = 'BOOK' and ed_table.key = 'PRINT' and ed_table.user_id = user .. .define get_user_info select user_loc,user_name, user_company, into user_location, user_name, user_company, from sec_header where user_id = lower(substr(user,5,10)) .. .execute lok_tabs .execute get_user_info
    You might wish to clean-up the definitions and remove multiple spaces.

    Also note that it extracts all definitions not only those which start with "select".

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Converting Oracle report language code into perl
by BrowserUk (Patriarch) on Jun 26, 2007 at 15:30 UTC
      I had no idea RPT was that old!

      Now I really wonder why the OP needs to parse .rpt files.

      CountZero

      "A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James