$P - Parameter #

Parameters are number amounts, character strings, Boolean values, or date values that are passed automatically to Functions and Qualifications UserCalcs. (The number and types of parameters that are passed to a Function or Qualifier may differ depending on the calling program or application.)

Parameters are exclusively used in the Benefit or Attendance applications as Functions or Qualifiers.

Statement
If the employee has worked 2000 hours in the current year, award the employee the full entitlement - $200. If the employee has worked more than 1040 hours in the current year, award the employee 50% of the entitlement. Otherwise, award the employee 20% of the entitlement.

In the example below, the UserCalc will operate as such:

Line 00010Captures the value of the entitlement, $200
Line 00100Checks if the employee worked more than 2000 hours.
If so, the UserCalc goes to Line 99999 which returns a value of the full amount of the entitlement, $200.
If not, the UserCalc goes to Line 00200
Line 00200Checks to see if the employee worked more than 1040 hours.
If so, the UserCalc goes to Line 00300 to calculate 50% of the entitlement. $200 x .50 = $100
If not, the UserCalc goes to Line 00400 to calculate 20% of the entitlement. $200 x .20 = $40
Line 00300 & 00400Once the calculation is complete in these lines, the UserCalc goes to Line 99999 to return the appropriate value.

LineCMDOTOperand 1OPEROTOperand2OTOperand3If Goto Else GoTo
00010 LET V ENTITLEMENT EQ $PNUMBER-PARAMETER 00100
00100 IF EY TIME WORKED GT N 2000 99999 00200
00200 IF EY TIME WORKED GT N 1040 00300 00400
00300 LET V ENTITLEMENT MLT V ENTITLEMENT N 0.50 99999
00400 LET V ENTITLEMENT MLT V ENTITLEMENT N 0.20 99999
99999 RET V ENTITLEMENT 99999