Step 1 Create the Called Function

Visual LANSA

Step 1. Create the Called Function

FRM095 - Calling a Function

1.  Create the following new fields:

a.iiiNEWSAL, New Salary, Packed, 11, 2 Edit Mask N

b.iiiPERCNT – Percent Increase, Packed, 3, 2, Edit Mask N

c.iiiTOTSAL, should already exist. It was created in exercise FRM075.

2.  Check the new fields into the IBM i server.

3.  Create a new process iiiPRO01 - FRM Training. You do not need to open it in the editor.

4.  Create a new function iiiFN21 – Salary Review, belonging to process iiiPRO01. Create the function RDMLX enabled.

5.  Functions which receive and return a working list require a FUNCTION statement with a RCV_LIST() parameter. Define your FUNCTION statement as follows:

Function Rcv_List(#Employs)

 

6.  Define a working list EMPLOYS containing fields EMPNO, FULLNAME, DEPTMENT, SALARY and iiiNEWSAL. Entrys=*max

7.  Define a GROUP_BY, EMPDATA, containing fields EMPNO, SURNAME, GIVENAME, DEPTMENT, SALARY.

8.  Your function logic should be based on the following:

    Clear list EMPLOYS
    SELECT from file PSLMST1, using group_by EMPDATA, with a key of DEPTMENT
    Assign Fullname to Surname + Givename.
    Calculate iiiNEWSAL as (SALARY + (SALARY * (iiiPERCNT / 100))
    Add entry to EMPLOYS
    End selection
    Return

9.  Write your RDMLX based on the above. If necessary refer to Appendix A. FRM095 for a solution.

10. Compile your function

11. Check in and compile the function to the IBM i Server.

     Select your function IIIFN21 on the Repository tab, or Last Opened tab and use the right mouse menu to Check In.

     The process iiiPRO02 will be automatically checked in and compiled as well.

     Note: Always save your source or compile it locally (this automatically saves the current source) when using check in from tabs such as Repository or Last Opened.

     Alternatively, check in the object currently open in the Editor using the Check In command in the ribbon:

     You will learn more about Check In in exercise FRM125 - Check Out / In to IBM i.