+ " ORDER BY parseInt(getSimpleFieldValue(getZNRecordFromMap(:LIVEINSTANCESMAP, mapSubKey), 'SCN'))";
Query josqlQuery = new Query();
josqlQuery.setVariable("LIVEINSTANCES", liveInstances);
josqlQuery.setVariable("LIVEINSTANCESMAP", liveInstanceMap);
josqlQuery.addFunctionHandler(new ZNRecordRow());
josqlQuery.addFunctionHandler(new ZNRecordJosqlFunctionHandler());
josqlQuery.addFunctionHandler(new Integer(0));
try {
josqlQuery.parse(josql);
QueryResults qr = josqlQuery.execute(ZNRecordRow.convertMapFields(externalView));