$PBExportHeader$f_init_sys_plan.srf global type f_init_sys_plan from function_object end type forward prototypes global subroutine f_init_sys_plan () end prototypes global subroutine f_init_sys_plan ();datastore ds_funcpwr ds_funcpwr = CREATE datastore ds_funcpwr.DataObject = 'ds_sys_funcpwr' ds_funcpwr.SetTransObject(sqlca) Long maxFuncId,maxFuncIdRow SELECT sys_pwrstr,sys_optionstr,if_development INTO :sys_pwrstr,:sys_optionstr,:sys_development FROM sys_DB_version; IF sqlca.SQLCode <> 0 THEN //sys_pwrstr = Fill('1',5000) //sys_optionstr = Fill('1',1000) END IF IF sys_optionstr = '' THEN sys_optionstr = Fill('1',1000) END IF IF sys_pwrstr = '' THEN //sys_pwrstr = Fill('1',5000) maxFuncId = ds_funcpwr.Object.funcid[ds_funcpwr.RowCount()] maxFuncIdRow = ds_funcpwr.Find("funcid > " + String(maxFuncId), 1, ds_funcpwr.RowCount()) DO WHILE maxFuncIdRow > 0 maxFuncId = ds_funcpwr.Object.funcid[maxFuncIdRow] maxFuncIdRow = ds_funcpwr.Find("funcid > " + String(maxFuncId), 1, ds_funcpwr.RowCount()) LOOP IF maxFuncId <= 0 THEN maxFuncId = 5000 END IF sys_pwrstr = Fill('1',maxFuncId) END IF Int modulesCount modulesCount = UpperBound(sys_enabledModules) IF modulesCount <= 0 THEN RETURN String moduleidStr = '(' Int i modulesCount = modulesCount FOR i = 1 TO UpperBound(sys_enabledModules) moduleidStr += String(sys_enabledModules[i]) IF i < modulesCount THEN moduleidStr += ',' END IF NEXT moduleidStr += ')' Long curFuncid FOR curFuncid = 1 TO Len(sys_pwrstr) IF Mid(sys_pwrstr,curFuncid,1) = '0' THEN CONTINUE IF ds_funcpwr.Find("funcid = " + String(curFuncid) + " AND moduleid IN " + moduleidStr, 1, ds_funcpwr.RowCount()) <= 0 THEN sys_pwrstr = Replace(sys_pwrstr,curFuncid,1,"0") END IF NEXT end subroutine