Project

General

Profile

Bug #20

NO-ERROR does not work for FIND statement on preselected results

Added by Stanislav Lomany over 12 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:

History

#1 Updated by Stanislav Lomany over 12 years ago

@45268 - issue description:

NO-ERROR option does not work in P2J for FIND statement on preselected results (affects Majic!).

  def temp-table a
     field a1 as integer
     field a2 as integer
     field a3 as integer
     index idxa a1 a2.

  create a. a1 = 1.
  create a. a1 = 2.

  /* correct output is "avail, avail, not avail" */
  REPEAT PRESELECT EACH a: 
    find next a no-error.
    if avail(a) then message "avail".
    else do: 
      message "not avail".
      leave.
    end.
  end.

#2 Updated by Stanislav Lomany over 12 years ago

@45269 - Majic issues:

I found 5 places in Majic that use this feature. Some use find no-error + if not avail then leave construction. In this case error may not be noticed.

    repeat preselect each itemloc
           where itemloc.item          = it-req.item
             and itemloc.site          = it-req.site
             and itemloc.facility-code = it-req.facility-code
           exclusive-lock
           by itemloc.rank
           by itemloc.item:
      find next itemloc no-error.
      if not available itemloc
      then
        leave.
      t-rank = t-rank + 1.
      itemloc.rank = t-rank.
    end.  

    However some use more complicated logic:

do preselect each jobtran no-lock
       where jobtran.co-num = job.co-num
         and jobtran.timco-oper = job.timco-oper
       by co-num
       by timco-oper
       by trans-date:

      find first jobtran
           no-error.
      if available jobtran
      then
        s-date = jobtran.trans-date.
      else
        s-date = ?.
      find last jobtran
           no-error.
      if available jobtran
      then
        e-date = jobtran.trans-date.
      else
        e-date = ?.
      if s-date = ? or
         e-date = ?
      then
        t-elapsed = 0.
      else
        t-elapsed = e-date - s-date + 1.
    end.

I found the facility (CUSTOMER 124 FILE EXPORT) that just don't work because of this error. The only logical explanation why this error was unnoticed is that TIMCO has never used this facility.

#3 Updated by Stanislav Lomany over 12 years ago

@45270 - possible solution:

It seems the conversion must emit something different:  either we bracket the first/last/next/previous retrieval methods with calls to ErrorManager.silentError{En|Dis}able() or we replace or overload the retrieval methods with no-error versions/signatures.  Personally, I prefer the latter;  we can hide the ErrorManager calls in the runtime instead of having 2 extra lines in the converted code.

#4 Updated by Stanislav Lomany about 12 years ago

Imported from JPRM on 2012-04-12 11:23:12.339:

TASKID      = 6125
PROJECTID   = 124
STATUS      = 3 (Hold)
DESCRIPTION = NO-ERROR does not work for FIND statement on preselected results
OWNER       = SVL
ASSIGNEE    = 
BILLABLE    = false
PRIORITY    = 5 (Normal)
PHASE       = 52 (Problem Resolution)
COMPONENT   = 0
ESTEFFORT   = 0.000000
ESTSTART    = 2011-09-24
ESTSTOP     = 
ACTSTOP     = 
CASENUM     = 
VENDORID    = 
COMMENT     = ''
LASTWIP     = 

Also available in: Atom PDF