.rem **********************************************************************
.rem
.rem ------------------------ booking_table variables ---------------------
.rem
.declare booking_no a13 ###### Means CHAR(13)
.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 weight 9999999.99 ####### Number type with specified width
.declare cube 9999999.999
.set page_no 1
.set first "N"
.set no_more_clauses "N"
.set line_count 0
.set del_count 0
.set pick_count 0
.set sys_date $$DATE$$
.rem ----------------------------------------------------------------------
#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 #
#dt 6 1 22 23 77 #
#dt 7 1 15 17 77 #
.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 get_user_office
select name, address1, address2, address3 || ' ' || state
|| ' ' || zip_cnty, 'PHONE: ' || telephone, 'FAX: ' || fax,
fax || '.'
into name, address1, address2, address3, phone, fax, fax1
from custdata2
where custdata2.code = &user_location ##### Here user_location is passed by argument
..
.define get_lots
select booking_seq
into input_booking_seq
from itemdata
where reference = &file_no
..
.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
..
.rem -------------------------------------------------------------------
.rem main logic
.rem -------------------------------------------------------------------
.rem
.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
.ifnull hz_code skip_to_end
.if "&hz_code = '000' or &hz_code = 'N' " then skip_to_end
.rem .report get_hazmat_data print_hz_page
.&skip_to_end
.execute update_inet_upd
.execute delete_input
.commit
.stop
####
#cen - to define a centred title
#dt - table definition
rpt - To produce the report
.declare - variable declaration with o/p format
.define - macro to specify SQL commands to be used to retrieve data
== .define statement is terminated by two full stops at the beginning of a line. ==
.report - executes a select macro
.execute - executes a select macro
.if - tests values and allows conditional execution
.goto - control execution
#t 2 - starts using table 2 format
#te - reverts to the previous table format
#np - start a new page
#n - start a new line
#p - start a new paragraph
#nc next column
# end literal output and start formatting again.
.rem - comments
& - execute or call macros
####
COMPANY ADDRESS
_________________
ADDRESS 1
________________
ADDRESS 2
_____________________
PHONE:
___________________
FAX:
B O O K I N G C O N F I R M A T I O N
*** BOOKING NO: CHIJOH1592318 ***
TO: ADDRESS ONE DATE : 19-JUN-2007
STREET OUR CONTACT : MACH
ROAD
PHONE: YOUR REFERENCE :
P.O. NUMBER :
ATTN: DENZIL F.
WE THANK YOU FOR YOUR BOOKING, WHICH WE HEREBY CONFIRM AS FOLLOWS:
_______________________________________________________________________________
BOX: NEW TOOL FROM: NEWYORK DATE: 26-JUN-2007
NUMBERS : 351 LOAD: LA DATE: 05-JUL-2007(ETS)
DISCH PLACE : PHILIPPINES DEST: PHILIPPINES DATE: 06-AUG-2007(ETA)
_______________________________________________________________________________
___________ ___________ ______ ____
NUMBER/TYPE DESCRIPTION WEIGHT CUBE
4 COMPUTER SUPPLIES 1959 LBS 200.000 CFT
________________________________________________________________________________