I have created a new custom index to a custom table to access records through either 850-FIND-NLT- or 850-FIND-BEGRNG-.
The index has 2 numeric fields,one PIC 9(4)) and the other PIC 9(8) for date (format YYYMMDD). The next to last field is a PIC X(32) for names (e.g 'Adam Smith'), and the last field is numeric that I move zeroes as I populate the index:
MOVE STL-DIVISION TO DB-DIVISION.
MOVE STL-PAYROLL-DATE TO DB-PAYROLL-DATE.
MOVE STL-MGR-NAME TO DB-MGR-NAME.
MOVE ZEROES TO DB-DISTRICT.
PERFORM 850-FIND-NLT-ZOTSET2.
IF (ZHMGROTHRS-FOUND)
MOVE ZOT-DIVISION TO WS-DIVISION
MOVE ZOT-PAYROLL-DATE TO WS-PAYROLL-DATE
MOVE ZOT-MGR-NAME TO WS-MGR-NAME
PERFORM 1300-GET-XXXX
THRU 1300-END
UNTIL (ZOT DIVISION NOT = WS-DIVISION)
OR (XXXXXXXXXXXXXXXXXXXXXX)
The intention is to return all districts under the manager.
What is happening is that after the 850-FIND, the condition (ZHMGROTHRS-FOUND) is true, BUT the ZOT-MGR-NAME value returned from the API does not equal the one I am passing to the API. It returns the NEXT one after the one in the table!
When I use the 850-BEGRNG, (of course with 'MOVE ZOTSET2-DIST-NBR TO WS-DB-BEG-RNG') the condition (ZHMGROTHRS-FOUND) is 'False'
Any ideas why this is happening?