1,创建一个procedure程序
HNOMAIN
D CalcPay PR 8P 2
D Rate 5P 2 VALUE
D Hours 10U 0 VALUE
D Bonus 5P 2 VALUE
P CalcPay B EXPORT
D CalcPay PI 8P 2
D Rate 5P 2 VALUE
D Hours 10U 0 VALUE
D Bonus 5P 2 VALUE
D Overtime S 5P 2 INZ(0)
/free
// Determine any overtime hours to be paid.
if Hours > 40;
Overtime = (Hours - 40) * Rate * 1.5;
Hours = 40;
endif;
// Calculate the total pay and return it to the caller.
return Rate * Hours + Bonus + Overtime;
/end-free
P CalcPay E
用CRTRPGMOD编译该程序为calcpay。DBGVIEW为*list
2,测试上面的procedure程序。
D Pay S 8P 2
D emp_Rate S 5P 2 inz(3.1)
D emp_Hours S 10U 0 inz(20)
D emp_Bonus S 5P 2 inz(10.5)
D CalcPay PR 8P 2
D Rate 5P 2 VALUE
D Hours 10U 0 VALUE
D Bonus 5P 2 VALUE
C eval Pay = CalcPay(emp_rate:emp_hours:emp_bonus)
C Pay dsply
C*
C SETON
C RETURN
用CRTRPGMOD编译该程序为test。DBGVIEW为*list
用CRTPGM把上面的module编译成PGM
CRTPGM PGM(PTRLIB/TEST) MODULE(PTRLIB/TEST PTRLIB/CALCPAY)
3,调试
STRDBG PGM(PTRLIB/TEST) 设置断点。
调用程序开始调试。
阅读(2307) | 评论(0) | 转发(2) |