这样便于复用和共享,免得编写重复的大量代码 |
2,示例代码:
begin-procedure selectRpt($a) begin-select On-Error=Global-Got-Fatal-SQL-Error position (+1) rlp.mjaccttypcd &MJ rlp.miaccttypcd &MI MOVE &MJ TO $MJ MOVE &MI TO $MI DO GETMIMJACCTTYPDESC($MJ,$MI,$MJD,$MID) PRINT $MID (,2) rlp.ACCTNBR (,34) rlp.OLDRATE (,56) edit 9.999999nu rlp.INDEXRATE (,66) edit 9.999999nu rlp.MARGINFIXED (,80) edit 9.999999nu rlp.MARGINPCT (,91) edit 99.999999nu rlp.NEWRATE (,102) edit 9.999999nu rlp.RATEEFFDATE (,112) edit 'yyyy-mm-dd' RLP.PMTTYPCD &pt move &pt to $pt do GETPMTTYPDESC($pt,$ptd) !会调用过程getpmttypdesc print $ptd (,124) rlp.OLDPMTAMT (,134) EDIT 999,999,999.99 rlp.NEWPMTAMT (,150) EDIT 999,999,999.99 rlp.TERM (,166) edit 9999 position (+1) from OSIBANK.Rpt_SchedLnRatePmtChg_Process rlp where rgidnbr=$a end-select Move 'Done Get-Acct-Info' To $_Global-ProcName Let $_QueApplChkpt = 'Report Complete' Let $_QueApplRc = 0 Do Final-QueAppl-Update end-procedure !下述过程用于上述过程selectRpt调用 begin-procedure GETMIMJACCTTYPDESC ($MJ,$MI,:$MJD,:$MID) !:开头表示输出参数 BEGIN-SELECT LET $MJD='' !参数初始化 MJACCTTYPDESC &MJD LET $MJD=&MJD !参数赋值 $mjd即输出参数:$mjd FROM MJACCTTYP WHERE MJACCTTYPCD=$MJ END-SELECT BEGIN-SELECT LET $MID='' MIACCTTYPDESC &MID LET $MID=&MID FROM MJMIACCTTYP WHERE MJACCTTYPCD=$MJ AND MIACCTTYPCD=$MI END-SELECT END-PROCEDURE 这样有几个好处: 1,逻辑清晰 2,后期若修改代码,仅动每个子过程即可.不然全写在一个过 程中,改动太大. 3,减少了编写难度.由一个过程加工得到中间临时变量, 继而另一过程以此中间临时变量为输入参数,可得到另 一个临时变量,这个机制可以迭代进行. 特别对于编写begin-select节有大用.不然你的select的 from 表会有好多.其实就是分而治之的思想. |
3,页眉与每页开始输出不同,具体如下:
a,语法不同:页眉是alter-report heading,而每页开始为
use-procedure before-page