是不是自定义函数这段代码需要单独吗?
FUNCTION 建考场表(n级i, n场i, n列i, n行i)
LOCAL i, n列k, n行k
SELECT * FROM 学生表 WHERE 级==n级i INTO CURSOR 级表
SELECT 级表
INDEX on RAND(班+RECNO()) TAG 班序
&& 乱序
GO TOP IN "级表"
n列k = n列i
n行k = n行i
DO WHILE !EOF("级表")
IF n列k > n列
n行k = n行k + n行
IF (n行k+1) <= RECCOUNT("考场表")
n列k = n列i
ELSE
n场i = n场i + 1
&& 新场
IF n列i = 2
n行i = n行k
ENDIF
n列i = 1
n列k = n列i
ENDIF
ENDIF
* 写一列
i = 1
DO WHILE !EOF("级表") AND (i <= n行)
IF (n行k+i) <= RECCOUNT("考场表")
GO (n行k+i) IN "考场表"
ELSE
APPEND BLANK IN "考场表"
REPLACE 考场 WITH n场i IN "考场表"
ENDIF
REPLACE ("列"+TRANSFORM(n列k)) WITH 级表.名 IN "考场表"
i = i + 1
SKIP IN "级表"
ENDDO
n列k = n列k + 2
ENDDO
ENDFUNC