4GL Cobol – Get Employee's current Job Code effective date

 4 Replies
 1 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
agersh
Veteran Member
Posts: 81
Veteran Member

    Hi,

    Using Lawson 4GL Cobol what code/programming can I use to get an employee’s current Job Code effective date?

    Thank you,

    agersh

    Ragu Raghavan
    Veteran Member
    Posts: 476
    Veteran Member
      1. lookup table PADICT to fetch field_number related to Job Code
      2. lookup table HRHISTORY for the employee/field_number with the most recent effect_date. That will be it. (ignore any future dates, just in case some have been entered)
      agersh
      Veteran Member
      Posts: 81
      Veteran Member

        Hi Ragu, Thank you for your reply.

        Does this code look corrrect?

                       MOVE SF-EMP-COMPANY         TO DB-COMPANY
                       MOVE SF-EMP-EMPLOYEE        TO DB-EMPLOYEE
                       MOVE ZERO                   TO DB-OBJ-ID
                       MOVE 19                     TO DB-FLD-NBR
                       MOVE HRHSET1-FLD-NBR        TO WS-DB-BEG-RNG
                       PERFORM 850-FIND-BEGRNG-HRHSET1
                       PERFORM
                         UNTIL (HRHISTORY-NOTFOUND)
                           MOVE HRH-BEG-DATE        TO WS-JC-EFF-DATE
                       END-PERFORM.

         

        Ragu Raghavan
        Veteran Member
        Posts: 476
        Veteran Member
          That logic will likely cause an infinite loop on the HRHISTORY lookup. This is how I would do it.

          * RESET THE VARIABLE FOR EACH EMPLOYEE
          MOVE ZEROES TO WS-JC-EFF-DATE.

          MOVE SF-EMP-COMPANY TO DB-COMPANY
          MOVE SF-EMP-EMPLOYEE TO DB-EMPLOYEE
          MOVE ZERO TO DB-OBJ-ID
          MOVE 19 TO DB-FLD-NBR
          MOVE HRHSET1-FLD-NBR TO WS-DB-BEG-RNG
          PERFORM 850-FIND-BEGRNG-HRHSET1
          PERFORM
          UNTIL (HRHISTORY-NOTFOUND)
          * MAKE SURE NO FUTURE DATES
          * PICK MOST RECENT EFF-DATE
          IF (HRH-BEG-DATE > WS-JC-EFF-DATE)
          AND (HRH-BEG-DATE <= WS-SYSTEM-DATE-YMD)
          MOVE HRH-BEG-DATE TO WS-JC-EFF-DATE
          END-IF
          * LOOP UNTIL NOT FOUND
          PERFORM 860-FIND-NXTRNG-HRHSET1
          END-PERFORM.
          agersh
          Veteran Member
          Posts: 81
          Veteran Member

            Hi Ragu,  Thank you for your help.