Our windows application was developed in PowerBuilder 8 and it has been migrated to PowerBuilder 2019 R3. The PB 8 build application is not crashing for a very long time and the filter method is working properly. When it was migrated to PB2019 R3 and deployed to production, the application crashes when it reached the line of code with the filter method. When the PB IDE is in the debugging mode, it did not encounter the crashing so I've implemented a message box every 20 to 30 lines and re-build the EXE, to narrow down where exactly the cause of crashing inside the function and that's how I figured out, the crashing occurs when the execution is in the line of filter method.
Is it a PowerBuilder bug specifically in the filter method? Appreciate any idea or thoughts on how to resolve the mentioned crashing issue.
Here is the code of the function of_filter( ) with an argument type of string :as_status
String ls_filter
integer li_rc
Long ll_primary_rowcount, ll_filter_rowcount
Long ll_row
long ll_rows
long ll_found
decimal ld_job_id
string ls_sort
string ls_server_date_time
long ll_job_search
DateTime ldt_ship_date, ldt_cancel_date
dw_list.SetRedraw( FALSE )
iuo_parent.SetRedraw( FALSE)
ib_filter_in_progress = true
IF iuo_parent.dw_job_search.Rowcount() > 0 THEN
ld_job_id = iuo_parent.dw_job_search.object.job_id[iuo_parent.dw_job_search.Getrow()]
End If
ll_primary_rowcount = iuo_parent.dw_job_search.RowCount()
ll_filter_rowcount = iuo_parent.dw_job_search.FilteredCount()
IF ll_filter_rowcount > 0 THEN
li_rc = iuo_parent.dw_job_search.RowsMove &
(1, ll_filter_rowcount, Filter!, &
iuo_parent.dw_job_search, 1, Primary!)
END IF
iuo_parent.dw_job_search.SetFilter(" ")
MessageBox("Debugging","of_Filter : Begin Filter")
iuo_parent.dw_job_search.Filter( ) //This is the line where the application crashes.
MessageBox("Debugging","of_Filter : End Filter")
ll_rows = iuo_parent.dw_job_search.RowCount()
CHOOSE CASE as_status
CASE 'W'
ls_server_date_time = string(sqlca.of_get_server_datetime(),"YYYY-MM-DD")
ls_sort = 'Long(bill_customer_no) A, enter_date A, prefix_sort A'
ls_filter = "( isnull(ship_date) and status not in ( 'CANCEL' , 'STKCANCL') ) "+&
"or (date(ship_date) = "+ls_server_date_time+") "+&
"or (status in ( 'CANCEL', 'STKCANCL' ) "+&
" and date(cancel_date) = "+ls_server_date_time+")"
dw_list.Object.date_holder_t.text = 'Ship Date'
FOR ll_row = 1 TO ll_rows
//dw_list.Object.date_holder[ll_row] = dw_list.Object.ship_date[ll_row]
//dw_list.Object.date_holder[ll_row] = iuo_parent.dw_job_search.Object.ship_date[ll_row]
ldt_ship_date = iuo_parent.dw_job_search.GetItemDateTime(ll_Row,'ship_date')
IF NOT ISNULL(ldt_ship_date) THEN
dw_List.SetItem(ll_Row,'date_holder',ldt_ship_date)
END IF
NEXT
CASE 'S'
ls_sort = 'Long(bill_customer_no) A, ship_date A, prefix_sort A'
dw_list.Object.date_holder_t.text = 'Ship Date'
FOR ll_row = 1 TO ll_rows
//dw_list.Object.date_holder[ll_row] = dw_list.Object.ship_date[ll_row]
//dw_list.Object.date_holder[ll_row] = iuo_parent.dw_job_search.Object.ship_date[ll_row]
ldt_ship_date = iuo_parent.dw_job_search.GetItemDateTime(ll_Row,'ship_date')
IF NOT ISNULL(ldt_ship_date) THEN
dw_List.SetItem(ll_Row,'date_holder',ldt_ship_date)
END IF
NEXT
ls_filter = 'Not IsNull( ship_date )'
CASE 'C'
ls_sort = 'Long(bill_customer_no) A, cancel_date A, prefix_sort A'
dw_list.Object.date_holder_t.text = 'Cancel Date'
FOR ll_row = 1 TO ll_rows
//dw_list.Object.date_holder[ll_row] = iuo_parent.dw_job_search.Object.cancel_date[ll_row]
//dw_list.Object.date_holder[ll_row] = dw_list.Object.cancel_date[ll_row]
ldt_cancel_date = iuo_parent.dw_job_search.GetItemDateTime(ll_Row,'cancel_date')
IF NOT ISNULL(ldt_cancel_date) THEN
dw_List.SetItem(ll_Row,'date_holder',ldt_cancel_date)
END IF
NEXT
ls_filter = 'Not IsNull( cancel_date )'
CASE 'A'
ls_sort = 'Long(bill_customer_no) A, enter_date A, prefix_sort A'
ls_filter = ''
dw_list.Object.date_holder_t.text = 'Ship Date'
FOR ll_row = 1 TO ll_rows
//dw_list.Object.date_holder[ll_row] = iuo_parent.dw_job_search.Object.ship_date[ll_row]
//dw_list.Object.date_holder[ll_row] = dw_list.Object.ship_date[ll_row]
ldt_ship_date = iuo_parent.dw_job_search.GetItemDateTime(ll_Row,'ship_date')
IF NOT ISNULL(ldt_ship_date) THEN
dw_List.SetItem(ll_Row,'date_holder',ldt_ship_date)
END IF
NEXT
END CHOOSE
li_rc = iuo_parent.dw_job_search.SetFilter( ls_filter )
If IsNull(li_rc) or li_rc < 1 Then
error.of_application_error(this,"of_filter",&
"Error encountered when setting filter.~r~n"+&
" Return code = "+f_null_check(li_rc)+"~r~n"+&
" Filter command = "+f_null_check(ls_filter))
End IF
li_rc = iuo_parent.dw_job_search.Filter()
If IsNull(li_rc) or li_rc < 1 Then
error.of_application_error(this,"of_filter",&
"Error encountered when filtering job list.~r~n"+&
" Return code = "+f_null_check(li_rc)+"~r~n"+&
" Filter command = "+f_null_check(ls_filter))
End IF
li_rc = iuo_parent.dw_job_search.SetSort( ls_sort )
If IsNull(li_rc) or li_rc < 1 Then
error.of_application_error(this,"of_filter",&
"Error encountered when setting sort criteria.~r~n"+&
" Return code = "+f_null_check(li_rc)+"~r~n"+&
" Sort command = "+f_null_check(ls_sort))
End IF
li_rc = iuo_parent.dw_job_search.Sort()
If IsNull(li_rc) or li_rc < 1 Then
error.of_application_error(this,"of_filter",&
"Error encountered when sorting job list.~r~n"+&
" Return code = "+f_null_check(li_rc)+"~r~n"+&
" Sort command = "+f_null_check(ls_sort))
End IF
ib_filter_in_progress = false
// Put the current row back to the same job id if the job id exists
// in the current list.
ll_found = 0
IF not ISNULL(ld_job_id) and ld_job_id <> 0 THEN
ll_found=iuo_parent.dw_job_search.Find("job_id = " + `String(ld_job_id),1,iuo_parent.dw_job_search.RowCount())`
End If
If ll_found = 0 or ll_found <> iuo_parent.dw_job_search.getrow() or ll_found > 0 Then
iuo_parent.dw_job_search.ScrollTorow(max(1,ll_found))
End If
dw_list.SetRedraw( TRUE )
iuo_parent.SetRedraw( TRUE)
THIS.Event vs_set_environment()
In addition, I was able to reproduced the issue on both Oracle 10g and 19c environments and here is the event Log description of the crash:
Faulting application name: customer.exe, version: 5.0.0.0, time stamp: 0x6100e416 Faulting module name: orageneric12.dll, version: 12.2.0.1, time stamp: 0x58a2624c Exception code: 0xc0000005 Fault offset: 0x01136007 Faulting process ID: 0x4578 Faulting application start time: 0x01d9c4e68bb84a68 Faulting application path: C:\SourceTree\Build Release\V05.22.00-VSDEV819\customer\customer.exe Faulting module path: C:\Oracle\Win.32\12.2_InstantClient\bin\orageneric12.dll Report ID: a16e707a-0f52-40d3-8fb2-e868019a4cd3 Faulting package full name: Faulting package-relative application ID: