Librarian UCR program FAIRSCAN delivers wrong scan results
search cancel

Librarian UCR program FAIRSCAN delivers wrong scan results

book

Article ID: 55008

calendar_today

Updated On:

Products

Librarian

Issue/Introduction

When the search string occurs many time within a word, the Librarian UCR program FAIRSCAN can deliver wrong scan results.

 

Environment

Version 4.4 
 

Resolution

FAIRSCAN is a general scan utility for use against the Librarian Master files. It's function is much like that of the Librarian SCAN utility. But this program should not lock out the entire library while performing it's scan.

FAISCAN is a User Contributed Routine and is shipped with the Librarian installation material. FAIRSCAN source can be found in the CALJSAMP dataset.

**  Be advised that FAIRSCAN (like all other User Contributed Routines) is not written or supported and not warranted by Broadcom.

The delivered FAIRSCAN program is faulty and can deliver wrong scan results if the search string occurs many times within a word in the document.

To solve the logic error in FAIRSCAN, make the following modifications in FAIRSCAN and re-compile and re-link the program finally.

  1. Add following lines at the end of working storage section after line 8640:
         01 SCAN-POS    PIC 9(3) VALUE 1. 
    01 SCAN-FOUND PIC 9(3) VALUE 0.
    01 SCAN-WORK PIC 9(3) VALUE 0.
  2. Replace the complete 260-SEARCH paragraph with following statements:

    260-SEARCH.
    MOVE 01 TO SCAN-SUB1.
    MOVE 01 TO SCAN-POS.
    MOVE ZERO TO SCAN-FOUND.
  3. Replace the complete 264-COMPARE paragraph with following statements:

    264-COMPARE.
    IF SH (SUB1) NOT = SR (SCAN-SUB1, SUB11)
    COMPUTE SCAN-WORK = SCAN-STOP (SCAN-SUB1) - SCAN-STRT (SCAN-SUB1) +1
    IF SCAN-FOUND > 0 AND SCAN-FOUND NOT = SCAN-WORK
    MOVE ZERO TO SCAN-FOUND
    MOVE SCAN-POS TO SUB1
    ADD 1 TO SCAN-POS
    MOVE SCAN-STRT (SCAN-SUB1) TO SUB11
    END-IF
    GO TO 265-CONT
    END-IF.
    IF SH (SUB1) NOT = SR (SCAN-SUB1, SUB11)
    GO TO 265-CONT.
    IF SUB11 EQUAL SCAN-STOP (SCAN-SUB1)
    GO TO 280-FOUND.
    ADD 1 TO SUB1, SUB11.
    ADD 01 TO SCAN-FOUND.
    IF SUB1 GREATER THAN SEARCH-STOP
    GO TO 300-END-SEARCHX.
    IF SUB11 GREATER THAN SCAN-STOP (SCAN-SUB1)
    GO TO 300-END-SEARCHX.
    GO TO 264-COMPARE.