Calculation Specifications

All procedural code follows strict naming standards. The following rules apply to procedural code.

  • Lawson standards allow GOTO statements, but only if the statements are confined to the procedure and always go to a TAG that is below the GOTO statement.

  • Use meaningful procedure and data names. For example, most procedures within a program will be named Sn@xxxx, where "n" is the number of the screen the procedure applies to, and "xxxx" is the characters that describe the function of the procedure. For example, S1@MVDT is the "Move Data" procedure for the first screen. In addition, procedures available for all programs within an application or suite begin with "L" and Environment procedures (available to all applications) begin with "U." Using meaningful procedure and data names can be difficult, but the effort results in code that is easier to maintain.

  • If variables need to be initialized, they should be initialized in the definition specification.

    • Use the defined value of *HIVAL to initialize a value to HIGH-VALUES.

    • Use the defined value of *LOVAL to initialize a value to LOW-VALUES.

    • For binary operations, use the Lawson-defined values TRUE and FALSE.

Calculation Specifications Example (from PA01PD.COPYPGM)

P******************************************************************
P* S1@CLCLCN - Calculate Counts
P*******************************************************************
P S1@CLCLCN B
D S1@CLCLCN PI
C*
C EVAL VPAPAB@CMPNY = DPQPCMPNY
C EVAL VPAPAB@PSTN = DPQPPSTN
C EVAL VPAPAB@EFFCTD = E@SYSTEMDYMD
C CLEAR VPAPAB@PRCSLV
C CLEAR VPAPAB@DPRTMN
C CLEAR VPAPAB@JBCD
C CALLP LFNCRBD Find Current Budget
C IF E@ERRORNBR = *ZEROS
C EVAL F1@PPUSAT(I1) = VPAPPR@USATH
C IF VPAPPR@USATH = 'Y'
C EVAL F1@PBHDCN(I1) = VPAPAB@ATHHDC
C Z-ADD VPAPAB@ATHFT T@1@6@3 9 6
C EVAL F1@PABFTE(I1) = %ABS(T@1@9@6)
C ELSE
C EVAL F1@PBHDCN(I1) = VPAPAB@HDCNT
C Z-ADD VPAPAB@FTE T@1@6@3 9 6
C EVAL F1@PABFTE(I1) = %ABS(T@1@9@6)
C ENDIF
C ELSE
C EVAL E@ERRORNBR = *ZEROS
C ENDIF
C EVAL VPAAT@CMPNY = DPQPCMPNY
C EVAL VPAAT@PSTN = DPQPPSTN
C CLEAR VPAAT@PRCSLV
C CLEAR VPAAT@DPRTMN
C CLEAR VPAAT@JBCD
C CALLP LCLTTAS Calc Total Assigned
C EVAL F1@VRHDCN(I1) = VPAAT@VRHDCN
C Z-ADD VPAAT@VARFTE F1@VARFTE(I1)
C*
P S1@CLCLCN E