When the search string occurs many time within a word, the Librarian UCR program FAIRSCAN can deliver wrong scan results.
Version 4.4
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.
01 SCAN-POS PIC 9(3) VALUE 1.
01 SCAN-FOUND PIC 9(3) VALUE 0.
01 SCAN-WORK PIC 9(3) VALUE 0.
260-SEARCH.
MOVE 01 TO SCAN-SUB1.
MOVE 01 TO SCAN-POS.
MOVE ZERO TO SCAN-FOUND.
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.