Bug #5956
FWD does not reset AVAILABLE flag after UDF error.
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
01/08/2022
Due date:
% Done:
0%
billable:
No
vendor_id:
GCD
case_num:
History
#2 Updated by Igor Skornyakov over 2 years ago
- File available.p added
Consider the following code (attached):
define temp-table udftest field id as integer field fdate as date field fmt as character field fstr-result as character index pk as primary id . OUTPUT TO available.txt. create udftest. id = 1. fdate = date(07, 19, 2021). fmt = '999999'. fstr-result = "071921". create udftest. id = 2. fdate = date(07, 05, 2021). fmt = '99999'. fstr-result = ?. message "After create:" AVAILABLE udftest. run test(?, ?) NO-ERROR. run test(date(07, 05, 2021), '99999') NO-ERROR. run test(date(07, 19, 2021), '999999') NO-ERROR. run test(date(07, 05, 2021), '99999') NO-ERROR. message 'done'. procedure test: def input param val as date. def input param fmt as char. def var err-flag as logical init true. def var nmsg as integer no-undo. message "test(" val "," fmt ")". inner: do on stop undo, leave inner: FIND FIRST udftest WHERE udftest.fdate = val AND udftest.fmt = fmt AND string(fdate, fmt) = udftest.fstr-result NO-ERROR . err-flag = false. end. message "After find - ERROR:" ERROR-STATUS:ERROR "NUM-MESSAGES:" ERROR-STATUS:NUM-MESSAGES "AVAILABLE:" AVAILABLE udftest "err-flag:" err-flag. IF ERROR-STATUS:NUM-MESSAGES > 0 THEN DO: do nmsg = 1 to ERROR-STATUS:NUM-MESSAGES: message "***" ERROR-STATUS:GET-NUMBER(nmsg) ':' ERROR-STATUS:GET-MESSAGE(nmsg). end. END. end. OUTPUT CLOSE.
The STRING(date(07, 05, 2021), '99999')
causes ** Date format 99999 is incomplete. (154)
error.
The output with 4GL is:
After create: yes test( ? , ? ) After find - ERROR: yes NUM-MESSAGES: 1 AVAILABLE: no err-flag: no *** 565 : ** FIND FIRST/LAST failed for table udftest. (565) test( 07/05/21 , 99999 ) ** Date format 99999 is incomplete. (154) After find - ERROR: no NUM-MESSAGES: 1 AVAILABLE: no err-flag: yes *** 154 : ** Date format 99999 is incomplete. (154) test( 07/19/21 , 999999 ) After find - ERROR: no NUM-MESSAGES: 0 AVAILABLE: yes err-flag: no test( 07/05/21 , 99999 ) ** Date format 99999 is incomplete. (154) After find - ERROR: no NUM-MESSAGES: 1 AVAILABLE: no err-flag: yes *** 154 : ** Date format 99999 is incomplete. (154) done
With FWD it is:
After create: yes test( ? , ? ) After find - ERROR: yes NUM-MESSAGES: 1 AVAILABLE: no err-flag: no *** 565 : ** FIND FIRST/LAST failed for table udftest. (565) test( 07/05/21 , 99999 ) ** Date format 99999 is incomplete. (154) After find - ERROR: no NUM-MESSAGES: 2 AVAILABLE: no err-flag: yes *** 154 : ** Date format 99999 is incomplete. (154) *** 154 : ** Date format 99999 is incomplete. (154) test( 07/19/21 , 999999 ) After find - ERROR: no NUM-MESSAGES: 0 AVAILABLE: yes err-flag: no test( 07/05/21 , 99999 ) ** Date format 99999 is incomplete. (154) After find - ERROR: no NUM-MESSAGES: 2 AVAILABLE: yes err-flag: yes *** 154 : ** Date format 99999 is incomplete. (154) *** 154 : ** Date format 99999 is incomplete. (154) doneWe see the following.
- After the temp-table population both with 4GL and FWD
AVAILABLE udftest
==
yes
. - After
run test(?, ?)
both with 4GL and FWDAVAILABLE udftest
==
no
- After first
test(date(07, 05, 2021), '99999')
both with 4GL and FWDAVAILABLE udftest
==
no
. - After
test(date(07, 19, 2021), '999999')
both with 4GL and FWDAVAILABLE udftest
==
yes
. - After second
test(date(07, 05, 2021), '99999')
both with 4GLAVAILABLE udftest
==
no
but with FWD it isyes
.
The duplicate ** Date format 99999 is incomplete. (154)
message with FWD is a separate issue (see #5930).