You should just be able to disable the 'NE' and then re-enable it around the function call. That being said, I confirmed the operation of 'NE' using the following Object and test programs:
Object (with error cascading):
When I ran this I got the following:
If you remove the ERR=CascadeErr from the object the error occurs if running with 'NE' enabled:
I would strongly recommend you use the ERR= branch to detect if a item is missing. The return value of a null string ("") doesn't let you know if the value is undefined versus defined explicitly in the JSON as "".
Object (with error cascading):
Code Select
def class "test"
!
! Method
!
function method$(a$)
enter a$
x$=_obj'subMethod$(a$,err=CascadeErr)
return x$
!
CascadeErr:
exit err
!
! Submethod
!
function subMethod$(a$)
enter a$
if a$="bad" \
then exit 11
return ucs(a$)
!
end defTest Program:Code Select
oTest=new("test" for program)
set_param 'NE'=0 ! Default setting
gosub DoTest
!
set_param 'NE'=1
gosub DoTest
!
end
!
DoTest:
print "--------",'LF',"Test with 'NE'=",prm('NE')
!
print oTest'method$("good")
print otest'method$("bad",err=RptErr)
escape ! Should not get here
!
RptErr:
print "Error exit taken"
return When I ran this I got the following:
->run "test
--------
Test with 'NE'= 0
GOOD
Error exit taken
--------
Test with 'NE'= 1
GOOD
Error exit taken
If you remove the ERR=CascadeErr from the object the error occurs if running with 'NE' enabled:
->run "test
--------
Test with 'NE'= 0
GOOD
Error exit taken
--------
Test with 'NE'= 1
GOOD
0007 LET x$=_obj'subMethod$(a$) ! ,err=CascadeErr)
Error #11: Record not found or Duplicate key on write
I would strongly recommend you use the ERR= branch to detect if a item is missing. The return value of a null string ("") doesn't let you know if the value is undefined versus defined explicitly in the JSON as "".