PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 8/1/2019 2:27 PM by  Ragu Raghavan
Database Inquiry using 850-FIND-NLT-<index> returns the 'Next' record
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages
maalimsimo
Private
Private
Veteran Member
(114 points)
Veteran Member
Posts:48


Send Message:

--
8/1/2019 2:04 PM

    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?


    Ragu Raghavan
    Private
    Private
    Veteran Member
    (1297 points)
    Veteran Member
    Posts:451


    Send Message:

    --
    8/1/2019 2:27 PM
    Maybe STL-MGR-NAME or ZOT-MGR-NAME has some special characters you cannot see? Dump it using rngdbdump and open it with an editor that will show you hex values
    You are not authorized to post a reply.