Converting .rpt file code into Perl code

jessica_hynes's Avatar, Join Date: Jul 2007
Light Poster
Hi All,

I have a file which contains the following code to generate the report in Oracle
Code:
.declare booking_no                     a13
.declare line_code                      a10
.declare line_booking                   a12
.declare book_date			a11
.declare taken_by			a10
.declare ud                             a10
.declare ship_name			a40
.declare ship_addr1			a40
.declare ship_addr2			a40
.declare ship_addr3			a40
.declare ship_cont			a20
.declare ship_phone			a20
.declare ship_ref                       a20 
.declare fwdr_name			a40
.declare po_no				a20
.declare vessel_name                    a25
.declare voyage                         a10
.declare etd_origin                     a11
.declare sail_date                      a11
.declare origin_name			a20
.declare load_name                      a20
.declare disch_name                     a20

set page_no 1
.set first  "N"
.set no_more_clauses "N"
.declare dest_name			a20
.declare disch_code                     a4
.declare dest_code                      a4

#dt 1 1 80 #
#dt 2 1 6 9 48 50 61 63 76 80 80 #
#dt 3 1 13 15 34 36 40 42 56 58 62 64 74 75 79 # 
#dt 4 1 13 15 49 53 64 66 80 #
#dt 5 1 15 18 52 #

.define lock_tables
        lock table booking_table, booking_hazmat, custdata2, edit_table,
        booking_rates, printer_table in share update mode
..
.define get_input
        select passkey, '//FAX(fax=' || passkey1, passkey2, 
               passkey3, passkey4, printer_name
          into input_booking_seq, fax_header, file_no, 
               input_print_rates, myNoteId, printer_name
          from edit_table
         where edit_table.tag = 'BOOKING'
           and edit_table.key = 'PRINT'
           and edit_table.user_id = user
..
.define get_user_info
        select  user_location,user_name, user_company, &fax_header || ';style=' || letterhead,
                fax_printer, nvl(fax_yn,'N')
        into    user_location, user_name, user_company, fax_header, fax_printer, fax_yn
        from    security_header
        where   user_id = lower(substr(user,5,10))
..
.define get_fax_printer
      select &fax_header || ';print = Confirm;printer = ' || &fax_printer || ')'
        into     fax_header
        from     dual

.define printMsg
 .execute formatMsg
 .if "&myNote = 'N/A' " then skipMyNote
 .print myNote
 .&skipMyNote
 .if "&myNoteExt = 'N/A' " then skipMyNoteExt
 .print myNoteExt
 .&skipMyNoteExt
 .add line_count line_count 9
..
.execute lock_tables
.execute get_input
.execute printer_controls
.execute get_top
.execute get_user_info
.execute get_user_office
.rem --------- this section is added to print bookings by file -------
.ifnull file_no skip_by_file
.report get_lots file_loop
.goto skip_to_end
.&skip_by_file
.rem ------------------------------------------------------------------
.if "&fcl_lcl = 'F' " then ck_fcl  
.execute adjust_letterhead_lcl
.goto skip_over_fcl
.&ck_fcl
.execute adjust_letterhead_fcl
.&skip_over_fcl
.if "&fax_yn = 'N' " then skip_confirm
.execute get_fax_printer
.goto skip_to_booking
.&skip_confirm
.execute set_no_confirm
.&skip_to_booking
.print_info
I need to write the code for a generic parser which will actually convert the above code in a .rpt file
into perl code and then finally the perl code would generate the report ...

Please help me out for this to process and suggest me if there is any parser module available for that

Jessica

Last edited by shabbir; 3Jul2007 at 17:46.. Reason: Code block
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Duplicate of Converting Oracle Report .rpt file code into Perl code. Thread closed.