PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 03/25/2021 1:19 PM by  agersh
4GL Cobol – Get Employee's current Job Code effective date
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages
agersh
Systems Analyst
Martin Health System
Veteran Member
(159 points)
Veteran Member
Posts:81


Send Message:

--
03/17/2021 2:19 PM

    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
    Private
    Private
    Veteran Member
    (1251 points)
    Veteran Member
    Posts:435


    Send Message:

    --
    03/17/2021 5:25 PM
    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
    Systems Analyst
    Martin Health System
    Veteran Member
    (159 points)
    Veteran Member
    Posts:81


    Send Message:

    --
    03/23/2021 10:29 AM

    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
    Private
    Private
    Veteran Member
    (1251 points)
    Veteran Member
    Posts:435


    Send Message:

    --
    03/23/2021 11:09 AM
    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
    Systems Analyst
    Martin Health System
    Veteran Member
    (159 points)
    Veteran Member
    Posts:81


    Send Message:

    --
    03/25/2021 1:19 PM

    Hi Ragu,  Thank you for your help.

    You are not authorized to post a reply.