Query query = new Query();
QueryBuildDataSource qbds;
QueryRun queryRun;
CustTable custTable;
//Add a datasource to a query
qbds = query.addDataSource(tablenum(CustTable));
//Order by accountnum
qbds.addOrderByField(fieldnum(CustTable, AccountNum));
//Instantiate a Queryrun class
queryRun= new QueryRun(Query);
queryRun.literals(true);
// Enable position paging for the queryrun object
queryRun.enablePositionPaging(true);
//Provide page range
queryRun.addPageRange(1,10);
while (queryRun.next())
{
custTable= queryRun.getNo(1);
info(strFmt("% 1 :", custTable.AccountNum));
}