#include 'inc_lib.inc'
!-----------------------------------------------------------------------------------------------------------------------
!Page Setup ------------------------------------------------------------------------------------------------------------
!-----------------------------------------------------------------------------------------------------------------------
begin-setup

declare-layout DEFAULT
top-margin=0
left-margin=0
max-columns={PAGE_WIDTH}
max-lines={PAGE_DEPTH}

end-declare
end-setup
!------------------------------------------------------------------------------------------------------------------------
!Page Heading -----------------------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------------------------------------
begin-heading 6
do lib_heading(#page_width,$rpt_num,$rpt_title,$syi_c ontractor_name,$agn_short_name,
$sub_agn_short_name,$begindt,$begindt_wkdy,$enddt, $enddt_wkdy)

end-heading

!-------------------------------------------------------------------------------------------------------------------------
!Main Procedure ----------------------------------------------------------------------------------------------------------
!-------------------------------------------------------------------------------------------------------------------------

begin-procedure main()

do lib_input($agn_short_name,#agn_agency_id,$sub_agn_ short_name,#sub_agn_agency_id,
$begindt,$begindt_wkdy,$enddt,$enddt_wkdy)

do lib_hdg_vars({PAGE_DEPTH},{PAGE_WIDTH},'DD01','DIR ECT DEPOSIT RETURNED BY BANK',
$agn_short_name,$aub_agn_short_name,$begindt,$begi ndt_wkdy,$enddt,$enddt_wkdy)

do load_table_good()

do load_table_no_good()

do good()

do nogood()

end-procedure
!--------------------------------------------------------------------------------------------------------------------------
!Procedure to Load a Temporary Table --------------------------------------------------------------------------------------
!--------------------------------------------------------------------------------------------------------------------------

begin-procedure load_table_good ()

begin-sql -xp -c1
insert ##status
select l_name,
trx_status_id,
total = count(*)

from tbl_trx t1,
retailer t2

where t1.acquirer_id = t2.ret_id
and dt_settlement = "06/24/2005"
and trx_type_id = 612
and ret_class_id = 3
and trx_status_id = 0

group by l_name,
trx_status_id
end-sql

end-procedure

!---------------------------------------------------------------------------------------------------------------------------
!Procedure to Load a Temporary Table for State:NOGOOD ----------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------

begin-procedure load_table_no_good()

begin-sql -xp -c1
insert ##status1
select l_name,
trx_status_id,
total = count(*)

from tbl_trx a1,
retailer a2

where a1.acquirer_id = a2.ret_id
and dt_settlement = "06/24/2005"
and trx_type_id = 612
and ret_class_id = 3
and trx_status_id <> 0

group by l_name,
trx_status_id
end-sql

end-procedure

!---------------------------------------------------------------------------------------------------------------------------
!Procedure that fill the Table Good ----------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------

begin-procedure good()

let #part = 1
begin-select
print l_name (,25) on-break before=select_state(#part) after=total_ins()
print trx_status_id (,35)
print count(*) (,45)

from ##status
order by l_name

end-select
end-procedure

!----------------------------------------------------------------------------------------------------------------------------
!Procedure That Fill the Table NoGood ---------------------------------------------------------------------------------------
!----------------------------------------------------------------------------------------------------------------------------
begin-procedure nogood()

let #part = 2
begin-select
print l_name (,25) on-break before=select_state(#part) after=total_ins()
print trx_status_id (,35)
print count(*) (,45)

from ##status1
order by l_name

end-select
end-procedure

!----------------------------------------------------------------------------------------------------------------------------
!Print Quantity Procedure ---------------------------------------------------------------------------------------------------
!----------------------------------------------------------------------------------------------------------------------------

begin-procedure total_ins ()

print 'Total Number of TTP: ' (+1,1)
print #qty () edit 999,999
let #qty = 0

end-procedure

!----------------------------------------------------------------------------------------------------------------------------
!Procedure that print the status of the TTP ---------------------------------------------------------------------------------
!----------------------------------------------------------------------------------------------------------------------------
begin-procedure select_state(#part)

if (#part = 1 )
print 'STATE: GOOD ' ()
else
print 'STATE: NOGOOD ' ()
end-if

do column_headings()

end-procedure

!------------------------------------------------------------------------------------------------------------------------------
!Procedure To Create Column Headings ------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------------------------------------------

begin-procedure column_headings()

print 'NAME' (,25)
print 'STATUS_ID'(,35)
print 'TOTAL'(,45)

end-procedure

!--------------------------------------------------------------------------------------------------------------------------------
!
!--------------------------------------------------------------------------------------------------------------------------------


The errors are in line 117 and 131
Could anyone help em on this erros