CA-Librarian UCR program FAIRSCAN can deliver wrong scan results if the search string occurs many times within a word in the document.

Document ID : KB000055008
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

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 CLJ43UCR dataset. Please be advised that FAIRSCAN (like all other User Contributed Routines) is not written or supported and not warranted by CA. See System Services Guide Page 12-8/9.

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

Solution:

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.