$G - Global Variable#

Global Variables are variables that hold their value beyond the existing UserCalc; the value will not be lost once the UserCalc has completed. In this way they differ from local variables, which hold their value only for the current UserCalc.

The value of a global variable may be calculated in one UserCalc, and then referenced, edited or used by another UserCalc. For this reason, timing is important when accessing and modifying global variables.

A global variable must exist prior to creating the line within a UserCalc that refers to it.

Statement
If the employee is in the Full-Time unit return TRUE, otherwise return FALSE.

Line CMD OT Operand 1 OPER OT Operand2 OT Operand3 If Goto Else GoTo 00010 IF DB DUN.UNIT EQ A FULL-TIME 00100 00200 00100 LET $G FULL-TIME EQ B TRUE 99999 00200 LET $G FULL-TIME EQ B FALSE 99999 99999 RET $G FULL-TIME 99999

Statement
If the employee is in the Full-Time unit (as determined in the previous UserCalc and stored in global variable FULL-TIME) then calculate the Union Dues, otherwise exit.

In this example, we can see that Operand 1 (Full-Time) in Line 00100 of the previous UserCalc is now used in Line 00010 of the UserCalc below.

If the employee is full time, Line 00100 tells the UserCalc to calculate 1.5% (Operand3) of their gross pay (Operand2). Line 00110 then instructs the UserCalc to round that amount to the nearest cent (Operand3).

Line CMD OT Operand 1 OPER OT Operand2 OT Operand3 If Goto Else GoTo 00010 IF $G FULL-TIME EQ B TRUE 00100 99999 00100 LET PC 300 PERC EC GROSS PAY N 1.5 00110 00110 LET PC 300 RDN PC 300 N .01 99999 99999 EXIT 99999

Global variables may be created, viewed, modified or deleted in the Globals tab of the Define UserCalcs (IMUC) form. Further Global details can be found in section – 3.1.1.

UserCalc Global Variables data is stored in the P2K_AM_USER_CALC_GLOBALS table.