Database Inquiry using 850-FIND-NLT- returns the 'Next' record

 1 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
maalimsimo
Veteran Member
Posts: 49
Veteran Member

    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
    Veteran Member
    Posts: 476
    Veteran Member
      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