/*+-----------------------------------------------------------------+ | Name: ATTRCNTL.SCL | | Support: GRJ | | Product: SAS/AF | | Language: SCL | | Usage: call display('ATTRCNTL.PROGRAM', _WIDGET_); | | Purpose: Object attributes for a control object. | | History: 09Oct91 initial coding GRJ | | Notes: | | End | +----------------------------------------------------------------+*/ entry optional = _WIDGET_ 8 _UATTR_ $ _CLASS_ 8; length rc 8 oldname $ 8 wname $ 8; array colors{12} $ 8 ('Blue', 'Red', 'Pink', 'Green', 'Cyan', 'Yellow', 'White', 'Orange', 'Black', 'Magenta', 'Gray', 'Brown'); array ctypes{12} $ 8 ('OBJ9' , 'OBJ13', 'OBJ16', 'OBJ19', 'OBJ11', 'OBJ14', 'OBJ17', 'OBJ20', 'OBJ12', 'OBJ15', 'OBJ18', 'OBJ21'); init: control enter; oldcolor = ccolor; poplist = makelist(dim(colors)); do i = 1 to dim(colors); rc = setitemc(poplist, colors{i}, i); end; stype = getnitemn(_WIDGET_, "CONTROLTYPE"); ccolor = getnitemc(_WIDGET_, "COLOR"); fill = getnitemn(_WIDGET_, "FILLED"); cchar = getnitemc(_WIDGET_, "CONTROLCHAR"); call notify("TYPE", "_SET_COLOR_", ccolor); call notify("TYPE", "_SET_TYPE_", stype); call notify("TYPE", "_SET_FILL_", fill); do i=1 to dim(ctypes); call notify(ctypes{i}, "_SET_COLOR_", "GRAY"); end; call notify(ctypes{stype}, "_SET_COLOR_", "YELLOW"); oldname = ctypes{stype}; return; main: return; term: rc = setnitemn(_WIDGET_, stype, "CONTROLTYPE"); rc = setnitemc(_WIDGET_, ccolor, "COLOR"); rc = setnitemn(_WIDGET_, fill, "FILLED"); rc = setnitemc(_WIDGET_, cchar, "CONTROLCHAR"); if _STATUS_ = 'E' then do; if poplist > 0 then rc = dellist(poplist); end; return; OBJ9: OBJ11: OBJ12: OBJ13: OBJ14: OBJ15: OBJ16: OBJ17: OBJ18: OBJ19: OBJ20: OBJ21: call notify(".", "_GET_CURRENT_NAME_", wname); do i = 1 to dim(ctypes); if (ctypes{i} = wname) then do; stype = i; call notify("TYPE", "_SET_TYPE_", stype); call notify(oldname, "_SET_COLOR_", "GRAY"); call notify(wname, "_SET_COLOR_", "YELLOW"); oldname = wname; return; end; end; return; ccolor: /*+-----------------------------------------------------------------+ | Set color of text by typing it. | +-----------------------------------------------------------------+*/ _msg_ = ' '; if ccolor = _BLANK_ then ccolor = oldcolor; color1: clr = rgbdm(ccolor); if (clr = _BLANK_) then do; erroron ccolor; _MSG_ = 'ERROR: Invalid color specified.'; return; end; rc = fldcolor('CCOLOR', clr, 'NONE', 1, 8); rc = fldcolor('CCHAR', clr, 'NONE', 1, 8); call notify("TYPE", "_SET_COLOR_", ccolor); oldcolor = ccolor; return; ccombo: /*+-----------------------------------------------------------------+ | Set color of text by clicking on the combo box. | +-----------------------------------------------------------------+*/ _msg_=' '; sel = popmenu(poplist); if sel > 0 then do; ccolor = colors{sel}; end; if ccolor = _BLANK_ then ccolor = oldcolor; link color1; return; ccombo2: /*+-----------------------------------------------------------------+ | Set color of text by clicking on the combo box. | +-----------------------------------------------------------------+*/ ccolor = colorlist("?", 1, "Graphic text color"); if ccolor = _BLANK_ then ccolor = oldcolor; link color1; return; fill: call notify("TYPE", "_SET_FILL_", fill); return; help: /*+-----------------------------------------------------------------+ | Set object specific help. | +-----------------------------------------------------------------+*/ call display('ATTRHELP.FRAME', _widget_); return; target: call display('TARGET.FRAME', _widget_); return; links: call display('OBJLINK.FRAME', _widget_, _frame_); return; %eis; %defclass; %akeyfld; entry optional = _WIDGET_ 8 _UATTR_ $ _CLASS_ 8; length rc 8; init: if _WIDGET_ > 0 then do; source = getnitemc(_WIDGET_, "SOURCE"); variable = getnitemc(_WIDGET_, "VARIABLE"); end; call setfld(REQUIRED, source, variable); return; main: if upcase(word(1)) = 'SAVEAS' then do; link saveas; call display('CLASS.FRAME', ' ', _WIDGET_, _UATTR_, 1, _CLASS_); end; return; term: if dsid > 0 then rc = close(dsid); if _STATUS_ = 'C' then return; link saveas; return; saveas: call clrfld(REQUIRED, source, variable); if _WIDGET_ > 0 then do; rc = setnitemc(_WIDGET_, source, "SOURCE"); rc = setnitemc(_WIDGET_, variable, "VARIABLE"); end; call setfld(REQUIRED, source, variable); return; source: /*+-----------------------------------------------------------------+ | Check the data set name for valid sas names | +-----------------------------------------------------------------+*/ call clrfld(REQUIRED, source); erroroff source; if source = ' ' then do; variable = REQUIRED; call setfld(REQUIRED, source); return; end; if source = '?' then link dslist; loop: do i = 1 to 2; token = scan(source, i, '.'); if token ^= ' ' then do; if ^(sasname(token)) then do; erroron source; leave loop; end; end; else leave loop; if ^(exist(source)) then do; if ^(exist(source, "VIEW")) then _MSG_ = "Data does not exist."; end; end; call setfld(REQUIRED, source); return; variable: erroroff variable; if variable = ' ' then return; if source ^= ' ' and (exist(source) or exist(source, "VIEW")) then do; if variable = '?' then link varlist; if ^(sasname(variable)) then do; erroron variable; return; end; dsid = open(source); varnum = varnum(dsid, variable); if varnum = 0 then _MSG_ = 'Variable does not exist.'; if dsid > 0 then call close(dsid); dsid = 0; end; return; dslist: /*+-----------------------------------------------------------------+ | Pop listbox to choose a data set name. | +-----------------------------------------------------------------+*/ olddsn = source; erroroff source; source = dirlist('*', 'DATA VIEW', 1, 'Y'); cursor source; if olddsn ^= source and (exist(source) or exist(source, "VIEW")) then do; if variable ^= REQUIRED then do; if dsid > 0 then rc = close(dsid); dsid = open(source); varnum = varnum(dsid, variable); if varnum = 0 then variable = REQUIRED; end; end; return; varlist: /*+-----------------------------------------------------------------+ | Pop listbox to choose a variable. | +-----------------------------------------------------------------+*/ erroroff variable; call clrfld(REQUIRED, variable); if dsid <= 0 and source ^= REQUIRED then do; dsid = open(source); variable = varlist(dsid, 'C', 1, 'Select a Variable', 'Y'); end; cursor variable; return; links: call display('OBJLINK.FRAME', _WIDGET_, _FRAME_); return; /*+----------------------------------------------------------------+ | Name: BLDBRF.SCL | | Support: me | | Product: SAS/AF | | Language: SCL | | Usage: call display('BLDBRF.FRAME', &EPARMLST, | | , ); | | Purpose: Build window for briefing book object. | | History: initial coding me | | Notes: | | End | +----------------------------------------------------------------+*/ %eis; %eisentry optional=applname $ appltype $; %let leg1 = SAS/EIS: Briefing Book; %let emsg1 = ERROR: No values have been entered.; %let emsg2 = ERROR: A data set and variable must be specified.; %let emsg4 = ERROR: An application name is required.; %let emsg5 = Specify one or press Cancel to quit.; %let emsg7 = ERROR: One or more fields in error, correct error(s) to continue.; %let emsg8 = ERROR: Unable to locate object class.; %let emsg9 = ERROR: Specified application is not unique.; length rc icon 8 msg $ 80 catloc editpgm runpgm initpgm clickpgm pmenu $ 35; array fillmeths{2} $ 15 ('Enter values...', 'SAS data set...'); init: /*--------------------------------------------------------------+ | Initialize popmenu list. | +--------------------------------------------------------------*/ poplist = makelist(dim(fillmeths)); do i = 1 to dim(fillmeths); poplist = setitemc(poplist, fillmeths{i}, i); end; /*--------------------------------------------------------------+ | Initialize variables. | +--------------------------------------------------------------*/ %akeyfld; icon = 0; /*----------------------------------------------------------------+ | Query object database for methods. | +----------------------------------------------------------------+*/ call method('WOBJDSID.SCL', 'wobjdsid', wobjdsid); call set(wobjdsid); editpgm = ' '; runpgm = ' '; rc = where(wobjdsid, "name = '" || trim(appltype) || "'"); if (fetch(wobjdsid) ^= 0) then do; call display(%acatalog(eis, ERRMSG), 0, " ", "&emsg8"); link term; return; end; notes = ' '; descript = ' '; method = 1; fillit = fillmeths(method); vallist = 0; dsname = ' '; variable = ' '; catloc = ' '; applist = makelist(0); privdata = dsname(appldsid); rc = rewind(appldsid); call set(appldsid); /*--------------------------------------------------------------+ | Edit an existing application. | +--------------------------------------------------------------*/ if (applname ^= ' ') then do; newflag = 0; protect applname; cursor descript; /*--------------------------------------------------------------+ | Find control record and fillist from catloc. | +--------------------------------------------------------------*/ rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); if (fetch(appldsid) = 0) then do; if scan(catloc, 3, ' .') ^= ' ' then catloc = trim(privdata) || '.' || trim(scan(catloc, 3, ' .')) || '.EIS'; else catloc = trim(privdata) || '.' || trim(catloc); rc = fillist('eis', catloc, applist); /*--------------------------------------------------------------+ | Get items from list. | +--------------------------------------------------------------*/ if rc = 0 then do; method = getnitemn(applist, 'METHOD', 1, 1, 0); fillit = fillmeths(method); dsname = getnitemc(applist, 'DSNAME', 1, 1, ' '); variable = getnitemc(applist, 'VARIABLE', 1, 1, ' '); vallist = getniteml(applist, 'LIST', 1, 1, 0); notes = getnitemc(applist, 'NOTES'); initpgm = getnitemc(applist, 'INITPGM', 1, 1, ' '); clickpgm = getnitemc(applist, 'CLICKPGM', 1, 1, ' '); pmenu = getnitemc(applist, 'MENU', 1, 1, ' '); end; end; end; else do; newflag = 1; cursor applname; end; control enter; /*----------------------------------------------------------------+ | Put yourself on the bookmark list. | +----------------------------------------------------------------*/ call display(%acatalog(eis, PSHSTCK), "&leg1", pos); return; main: /*----------------------------------------------------------------+ | Handle common SAS/EIS commands. | +----------------------------------------------------------------*/ %eselect(pos, gbrc); otherwise; end; /*----------------------------------------------------------------+ | Check bookmark status to see if you need to end yourself. | +----------------------------------------------------------------*/ if gbrc = 1 then do; link term; return; end; return; term: if _STATUS_ ^= 'C' then do; /*----------------------------------------------------------------+ | Error checking. Don't allow user to leave create method | | without required information or with fields in error. | +----------------------------------------------------------------*/ if error(applname) then do; /*----------------------------------------------------------------+ | Give an error message and set _STATUS_ to keep "R"unning. | +----------------------------------------------------------------*/ _MSG_ = "&emsg7"; _STATUS_ = 'R'; cursor applname; /*----------------------------------------------------------------+ | Remove bookmark request if there was one. | +----------------------------------------------------------------*/ if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | A name for the application being created is required. | +----------------------------------------------------------------*/ else if applname = _BLANK_ then do; call display(%acatalog(eis, ERRMSG), 0, "&emsg4", "&emsg5"); _STATUS_ = 'R'; cursor applname; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | If user chose to list out graphs to display, make sure the | | list isn't empty. | +----------------------------------------------------------------*/ else if method = 1 & listlen(vallist) <= 0 then do; call display(%acatalog(eis,ERRMSG),0,"&emsg1", "&emsg5"); _STATUS_ = 'R'; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | If user chose to specify a data set and variable containing | | graph names, make sure both are specified. | +----------------------------------------------------------------*/ else if method = 2 & (dsname = _BLANK_ | variable = _BLANK_) then do; call display(%acatalog(eis,ERRMSG),0,"&emsg2", "&emsg5"); _STATUS_ = 'R'; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; link update; end; /*+-----------------------------------------------------------------+ | Clean up lists and pop yourself off bookmark stack before | | ending. | +-----------------------------------------------------------------+*/ if applist > 0 then rc = dellist(applist,'Y'); if poplist > 0 then rc = dellist(poplist,'Y'); call display(%acatalog(eis, POPSTCK)); _STATUS_ = 'H'; return; update: link setappl; /*+-----------------------------------------------------------------+ | Get a unique catalog entry name to store info... | +-----------------------------------------------------------------+*/ if catloc = ' ' then do; catloc = trim(privdata) || "." || trim(applname) || ".EIS"; call display(%acatalog(eis, UNIQUE.SCL), catloc); end; /*+-----------------------------------------------------------------+ | Make the catalog entry into a 4-level name if it already exists.| +-----------------------------------------------------------------+*/ else if scan(catloc, 3, ' .') ^= ' ' then catloc = trim(privdata) || '.' || trim(scan(catloc, 3, ' .')) || '.EIS'; else catloc = trim(privdata) || '.' || trim(catloc); /*+-----------------------------------------------------------------+ | Save the instance variable values out to the catalog entry. | +-----------------------------------------------------------------+*/ rc = savelist('eis', catloc, applist, 0, descript); rc = rewind(appldsid); catloc = trim(scan(catloc, 3, ' .')) || '.EIS'; /*+-----------------------------------------------------------------+ | Write a record out to the application database or update the | | existing record if this isn't a new application. | +-----------------------------------------------------------------+*/ if newflag then rc = append(appldsid); else do; rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); rc = fetch(appldsid,'NOSET'); rc = update(appldsid); rc = where(appldsid,'UNDO'); end; return; setappl: /*+-----------------------------------------------------------------+ | Set up instance variable list for this object class type. | +-----------------------------------------------------------------+*/ rc = setnitemn(applist, method, 'METHOD'); rc = setnitemc(applist, dsname, 'DSNAME'); rc = setnitemc(applist, variable, 'VARIABLE'); rc = setniteml(applist, vallist, 'LIST'); rc = setnitemc(applist, notes, 'NOTES'); rc = setnitemc(applist, initpgm, 'INITPGM'); rc = setnitemc(applist, clickpgm, 'CLICKPGM'); rc = setnitemc(applist, pmenu, 'MENU'); return; test: /*+-----------------------------------------------------------------+ | Set up a temporary instance of this object type to use for | | a test. | +-----------------------------------------------------------------+*/ oldname = applname; ocatloc = catloc; applname = 'XTSTAPPX'; catloc = trim(privdata) || "." || trim(applname) || ".EIS"; call display(%acatalog(eis, UNIQUE.SCL), catloc); link setappl; rc = savelist('EIS', catloc, applist, 0, descript); rc = append(appldsid); /*+-----------------------------------------------------------------+ | Run the "test" instance through the SAS/EIS runtime control | | program. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, RUNEIS), &EPARMLST, trim(applname) || '.' || trim(appltype), rc); /*+-----------------------------------------------------------------+ | Delete the "test" instance after running it. | +-----------------------------------------------------------------+*/ rc = where(appldsid, "applname='XTSTAPPX' and appltype='" || trim(appltype) || "'"); if fetch(appldsid) = 0 then rc = delobs(appldsid); if cexist(catloc) then rc = delete(catloc, 'CATALOG'); rc = where(appldsid); applname = oldname; catloc = ocatloc; /*+-----------------------------------------------------------------+ | Check the bookmark stack to see if we need to come down. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, CHKSTCK), pos, gbrc); if gbrc = 1 then do; link term; return; end; return; applname: /*+-----------------------------------------------------------------+ | Check for a unique application name | +-----------------------------------------------------------------+*/ erroroff applname; rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); if (fetch(appldsid, 'NOSET') = 0 & newflag = 1) then do; _MSG_ = "&emsg9"; erroron applname; end; rc = where(appldsid, 'UNDO'); return; fillcntl: /*+----------------------------------------------------------------+ | Pop a menu of fill methods | +----------------------------------------------------------------+*/ sel = popmenu(poplist); if sel > 0 then do; oldval = method; method = sel; link fillit; if (sysrc(1) < 0) then do; method = oldval; end; else fillit = fillmeths{sel}; end; return; fillit: select(method); /*+----------------------------------------------------------------+ | Fill in graph names interactively. | +----------------------------------------------------------------+*/ when(1) do; if vallist <= 0 | vallist = . then vallist = makelist(0); call display('ENTER.FRAME', vallist); end; /*+----------------------------------------------------------------+ | Choose a data set containing graph names. | +----------------------------------------------------------------+*/ when(2) do; call display('DSET.FRAME', dsname, variable); end; otherwise; end; return; ncombo: /*+----------------------------------------------------------------+ | Display a list of existing notes when the combo box arrow is | | chosen. | +----------------------------------------------------------------+*/ notes = catlist('*', 'SOURCE', 1, 'Y'); return; notes: /*+----------------------------------------------------------------+ | Verify the notes entry if the end user types it in. | +----------------------------------------------------------------+*/ erroroff notes; if notes = _BLANK_ then return; call method('SASHELP.FSP.CATNCHK.SCL', 'catalog', notes, 'SOURCE', 'SOURCE', 3, msg, rc); if rc then do; _MSG_ = msg; erroron notes; cursor notes; end; return; methods: /*+----------------------------------------------------------------+ | Precede or override methods associated with this instance. | +----------------------------------------------------------------+*/ call display(%acatalog(eis, METHODS), &EPARMLST, initpgm, clickpgm, pmenu, appltype); return; /*+----------------------------------------------------------------+ | Name: BLDBRFM.SCL | | Support: me | | Product: SAS/AF | | Language: SCL | | Usage: call display('BLDBRFM.FRAME', &EPARMLST, | | , ); | | Purpose: Build window for briefing book object. | | History: initial coding me | | Add metabase calls to briefing book. me | | Notes: | | End | +----------------------------------------------------------------+*/ %eis; %eisentry optional=applname $ appltype $; %let leg1 = SAS/EIS: Briefing Book; %let emsg1 = ERROR: No values have been entered.; %let emsg2 = ERROR: A data set and variable must be specified.; %let emsg4 = ERROR: An application name is required.; %let emsg5 = Specify one or press Cancel to quit.; %let emsg7 = ERROR: One or more fields in error, correct error(s) to continue.; %let emsg8 = ERROR: Unable to locate object class.; %let emsg9 = ERROR: Specified application is not unique.; length rc icon 8 msg $ 80 mbname mlname $ 35 _mbrc_ 4 _mbmsg_ $ 80 catloc editpgm runpgm initpgm clickpgm pmenu $ 35; array fillmeths{2} $ 15 ('Enter values...', 'SAS data set...'); init: /*---------------------------------------------------------------+ | Initialize popmenu list. | +---------------------------------------------------------------+*/ poplist = makelist(dim(fillmeths)); do i = 1 to dim(fillmeths); poplist = setitemc(poplist, fillmeths{i}, i); end; /*----------------------------------------------------------------+ | Initialize variables. | +----------------------------------------------------------------+*/ %akeyfld; icon = 0; /*----------------------------------------------------------------+ | Query object database for methods. | +----------------------------------------------------------------+*/ call method('WOBJDSID.SCL', 'wobjdsid', wobjdsid); call set(wobjdsid); editpgm = ' '; runpgm = ' '; rc = where(wobjdsid, "name = '" || trim(appltype) || "'"); if (fetch(wobjdsid) ^= 0) then do; call display(%acatalog(eis, ERRMSG), 0, " ", "&emsg8"); link term; return; end; notes = ' '; descript = ' '; method = 1; fillit = fillmeths(method); vallist = 0; dsname = ' '; variable = ' '; catloc = ' '; /*+---------------------------------------------------------------+ | Get current metalist and metabase. | +---------------------------------------------------------------+*/ envlist = envlist('L'); mlname = getnitemc(envlist,'MLNAME'); mbname = getnitemc(envlist,'MBNAME'); mblist = makelist(); applist = makelist(0); privdata = dsname(appldsid); rc = rewind(appldsid); call set(appldsid); /*----------------------------------------------------------------+ | Edit an existing application. | +----------------------------------------------------------------+*/ if (applname ^= ' ') then do; newflag = 0; protect applname; cursor descript; /*----------------------------------------------------------------+ | Find control record and fillist from catloc. | +----------------------------------------------------------------+*/ rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); if (fetch(appldsid) = 0) then do; if scan(catloc, 3, ' .') ^= ' ' then catloc = trim(privdata) || '.' || trim(scan(catloc, 3, ' .')) || '.EIS'; else catloc = trim(privdata) || '.' || trim(catloc); rc = fillist('eis', catloc, applist); /*----------------------------------------------------------------+ | Get items from list. | +----------------------------------------------------------------+*/ if rc = 0 then do; method = getnitemn(applist, 'METHOD', 1, 1, 0); fillit = fillmeths(method); dsname = getnitemc(applist, 'DSNAME', 1, 1, ' '); variable = getnitemc(applist, 'VARIABLE', 1, 1, ' '); vallist = getniteml(applist, 'LIST', 1, 1, 0); notes = getnitemc(applist, 'NOTES'); initpgm = getnitemc(applist, 'INITPGM', 1, 1, ' '); clickpgm = getnitemc(applist, 'CLICKPGM', 1, 1, ' '); pmenu = getnitemc(applist, 'MENU', 1, 1, ' '); mlname = getnitemc(applist, 'MLNAME', 1, 1, mlname); mbname = getnitemc(applist, 'MBNAME', 1, 1, mbname); /*+---------------------------------------------------------------+ | If data set specified, go check meta information. | +---------------------------------------------------------------+*/ if method = 2 then do; link chkerr; if regerr then link disperr; end; end; end; end; else do; newflag = 1; cursor applname; end; control enter; /*----------------------------------------------------------------+ | Put yourself on the bookmark list. | +----------------------------------------------------------------+*/ call display(%acatalog(eis, PSHSTCK), "&leg1", pos); return; main: /*----------------------------------------------------------------+ | Handle common SAS/EIS commands. | +----------------------------------------------------------------+*/ %eselect(pos, gbrc); otherwise; end; if cmdline = 'SETUP' then do; link chkerr; if regerr then link disperr; end; /*----------------------------------------------------------------+ | Check bookmark status to see if you need to end yourself. | +----------------------------------------------------------------+*/ if gbrc = 1 then do; link term; return; end; return; term: if _STATUS_ ^= 'C' then do; /*----------------------------------------------------------------+ | Error checking. Don't allow user to leave create method | | without required information or with fields in error. | +----------------------------------------------------------------+*/ if error(applname) then do; /*----------------------------------------------------------------+ | Give an error message and set _STATUS_ to keep "R"unning. | +----------------------------------------------------------------+*/ _MSG_ = "&emsg7"; _STATUS_ = 'R'; cursor applname; /*----------------------------------------------------------------+ | Remove bookmark request if there was one. | +----------------------------------------------------------------+*/ if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | A name for the application being created is required. | +----------------------------------------------------------------+*/ else if applname = _BLANK_ then do; call display(%acatalog(eis, ERRMSG), 0, "&emsg4", "&emsg5"); _STATUS_ = 'R'; cursor applname; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | If user chose to list out graphs to display, make sure the | | list isn't empty. | +----------------------------------------------------------------+*/ else if method = 1 & listlen(vallist) <= 0 then do; call display(%acatalog(eis,ERRMSG),0,"&emsg1", "&emsg5"); _STATUS_ = 'R'; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | If user chose to specify a data set and variable containing | | graph names, make sure both are specified. | +----------------------------------------------------------------+*/ else if method = 2 & (dsname = _BLANK_ | variable = _BLANK_) then do; call display(%acatalog(eis,ERRMSG),0,"&emsg2", "&emsg5"); _STATUS_ = 'R'; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; else if regerr then do; link disperr; _STATUS_ = 'R'; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; link update; end; /*+-----------------------------------------------------------------+ | Clean up lists and pop yourself off bookmark stack before | | ending. | +-----------------------------------------------------------------+*/ if applist > 0 then rc = dellist(applist,'Y'); if poplist > 0 then rc = dellist(poplist); if mblist > 0 then rc = dellist(mblist); call display(%acatalog(eis, POPSTCK)); _STATUS_ = 'H'; return; update: link setappl; /*+-----------------------------------------------------------------+ | Get a unique catalog entry name to store info... | +-----------------------------------------------------------------+*/ if catloc = ' ' then do; catloc = trim(privdata) || "." || trim(applname) || ".EIS"; call display(%acatalog(eis, UNIQUE.SCL), catloc); end; /*+-----------------------------------------------------------------+ | Make the catalog entry into a 4-level name if it already exists.| +-----------------------------------------------------------------+*/ else if scan(catloc, 3, ' .') ^= ' ' then catloc = trim(privdata) || '.' || trim(scan(catloc, 3, ' .')) || '.EIS'; else catloc = trim(privdata) || '.' || trim(catloc); /*+-----------------------------------------------------------------+ | Save the instance variable values out to the catalog entry. | +-----------------------------------------------------------------+*/ rc = savelist('eis', catloc, applist, 0, descript); rc = rewind(appldsid); catloc = trim(scan(catloc, 3, ' .')) || '.EIS'; /*+-----------------------------------------------------------------+ | Write a record out to the application database or update the | | existing record if this isn't a new application. | +-----------------------------------------------------------------+*/ if newflag then rc = append(appldsid); else do; rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); rc = fetch(appldsid, 'NOSET'); rc = update(appldsid); rc = where(appldsid, 'UNDO'); end; return; setappl: /*+-----------------------------------------------------------------+ | Set up instance variable list for this object class type. | +-----------------------------------------------------------------+*/ rc = setnitemn(applist, method, 'METHOD'); rc = setnitemc(applist, dsname, 'DSNAME'); rc = setnitemc(applist, variable, 'VARIABLE'); rc = setniteml(applist, vallist, 'LIST'); rc = setnitemc(applist, notes, 'NOTES'); rc = setnitemc(applist, initpgm, 'INITPGM'); rc = setnitemc(applist, clickpgm, 'CLICKPGM'); rc = setnitemc(applist, pmenu, 'MENU'); return; test: /*+-----------------------------------------------------------------+ | Set up a temporary instance of this object type to use for | | a test. | +-----------------------------------------------------------------+*/ oldname = applname; ocatloc = catloc; applname = 'XTSTAPPX'; catloc = trim(privdata) || "." || trim(applname) || ".EIS"; call display(%acatalog(eis, UNIQUE.SCL), catloc); link setappl; rc = savelist('EIS', catloc, applist, 0, descript); rc = append(appldsid); /*+-----------------------------------------------------------------+ | Run the "test" instance through the SAS/EIS runtime control | | program. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, RUNEIS), &EPARMLST, trim(applname) || '.' || trim(appltype), rc); /*+-----------------------------------------------------------------+ | Delete the "test" instance after running it. | +-----------------------------------------------------------------+*/ rc = where(appldsid, "applname='XTSTAPPX' and appltype='" || trim(appltype) || "'"); if fetch(appldsid) = 0 then rc = delobs(appldsid); if cexist(catloc) then rc = delete(catloc, 'CATALOG'); rc = where(appldsid); applname = oldname; catloc = ocatloc; /*+-----------------------------------------------------------------+ | Check the bookmark stack to see if we need to come down. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, CHKSTCK), pos, gbrc); if gbrc = 1 then do; link term; return; end; return; applname: /*+-----------------------------------------------------------------+ | Check for a unique application name | +-----------------------------------------------------------------+*/ erroroff applname; rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); if (fetch(appldsid, 'NOSET') = 0 & newflag = 1) then do; _MSG_ = "&emsg9"; erroron applname; end; rc = where(appldsid, 'UNDO'); return; fillcntl: /*+----------------------------------------------------------------+ | Pop a menu of fill methods | +----------------------------------------------------------------+*/ sel = popmenu(poplist); if sel > 0 then do; oldval = method; method = sel; link fillit; if (sysrc(1) < 0) then do; method = oldval; end; else fillit = fillmeths{sel}; end; return; fillit: select(method); /*+----------------------------------------------------------------+ | Fill in graph names interactively. | +----------------------------------------------------------------+*/ when(1) do; if vallist <= 0 | vallist = . then vallist = makelist(0); call display('ENTER.FRAME', vallist); end; /*+----------------------------------------------------------------+ | Choose a registered data set containing graph names from the | | metabase. | +----------------------------------------------------------------+*/ when(2) do; call display('DSETM.FRAME', dsname, variable, mldsid, mbdsid, mlname, mbname); end; otherwise; end; return; ncombo: /*+----------------------------------------------------------------+ | Display a list of existing notes when the combo box arrow is | | chosen. | +----------------------------------------------------------------+*/ notes = catlist('*', 'SOURCE', 1, 'Y'); return; notes: /*+----------------------------------------------------------------+ | Verify the notes entry if the end user types it in. | +----------------------------------------------------------------+*/ erroroff notes; if notes = _BLANK_ then return; call method('SASHELP.FSP.CATNCHK.SCL', 'catalog', notes, 'SOURCE', 'SOURCE', 3, msg, rc); if rc then do; _MSG_ = msg; erroron notes; cursor notes; end; return; methods: /*+----------------------------------------------------------------+ | Precede or override methods associated with this instance. | +----------------------------------------------------------------+*/ call display(%acatalog(eis, METHODS), &EPARMLST, initpgm, clickpgm, pmenu, appltype); return; chkerr: regerr = 0; /*+----------------------------------------------------------------+ | Open metalist. | +----------------------------------------------------------------*/ %MLOPEN(mldsid, mlname, 'U', 1, 0); if _mbrc_ > 0 then do; regerr = 1; return; end; /*+----------------------------------------------------------------+ | Open metabase. | +----------------------------------------------------------------*/ %MBOPEN(mbdsid, mbname, 'U', 1, mldsid); if _mbrc_ > 0 then do; regerr = 2; return; end; if dsname = _BLANK_ then return; /*+----------------------------------------------------------------+ | Query the metabase for registered data sets. | +----------------------------------------------------------------*/ rc = clearlist(mblist); rc = setnitemc(mblist, dsname, 'DSETNAME'); %MLQUERY(mblist, reg, mldsid, mbdsid, ''); if ^reg then do; regerr = 3; return; end; /*+----------------------------------------------------------------+ | Query the metabase for variables with the GRAPH attribute. | +----------------------------------------------------------------*/ rc = clearlist(mblist); rc = setnitemc(mblist, dsname, 'DSETNAME'); rc = setnitemc(mblist, 'GRAPH', 'ATTRIBUTE', 1); %MBQUERY(mblist, nd, mbdsid, mblist, mblist, mblist, '', 'R'); if nd > 0 then do; if variable ^= _BLANK_ then do; name = trim(dsname) || '.' || trim(variable) || '.GRAPH'; if ^nameditem(mblist, name) then do; regerr = 4; return; end; end; end; else do; regerr = 5; return; end; return; disperr: select(regerr); when(0); when(1) /*+-----------------------------------------------------------------+ | The metalist could not be opened. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, ERRMSG), 0, "&amsg01", mlname, "&amsg03"); when(2) /*+-----------------------------------------------------------------+ | The metabase could not be opened. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, ERRMSG), 0, "&amsg02", mbname, "&amsg03"); when(3) /*+-----------------------------------------------------------------+ | The data set is not registered. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, ERRMSG), 0, 'ERROR: ' || trim(mbname), "&amsg06", dsname); when(4) /*+-----------------------------------------------------------------+ | There was not a variable with the GRAPH attribute. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, ERRMSG), 0, "&amsg04", 'GRAPH', "&amsg07"); when(5) /*+-----------------------------------------------------------------+ | The data set registration did not contain the GRAPH attribute. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, ERRMSG), 0, "&amsg04", 'GRAPH', "&amsg05"); otherwise; end; return; /*+----------------------------------------------------------------+ | Name: BLDBRFS.SCL | | Support: me | | Product: SAS/AF | | Language: SCL | | Usage: call display('BLDBRFS.FRAME', &EPARMLST, | | , ); | | Purpose: Build window for briefing book object. | | History: initial coding me | | Add use of graph source. me | | Notes: | | End | +----------------------------------------------------------------+*/ %eis; %eisentry optional=applname $ appltype $; %let leg1 = SAS/EIS: Briefing Book; %let emsg1 = ERROR: No values have been entered.; %let emsg2 = ERROR: A data set and variable must be specified.; %let emsg4 = ERROR: An application name is required.; %let emsg5 = Specify one or press Cancel to quit.; %let emsg7 = ERROR: One or more fields in error, correct error(s) to continue.; %let emsg8 = ERROR: Unable to locate object class.; %let emsg9 = ERROR: Specified application is not unique.; length rc icon 8 msg $ 80 catloc editpgm runpgm initpgm clickpgm pmenu $ 35; array fillmeths{2} $ 15 ('Enter values...', 'SAS data set...'); init: /*---------------------------------------------------------------+ | Initialize popmenu list. | +---------------------------------------------------------------+*/ poplist = makelist(dim(fillmeths)); do i = 1 to dim(fillmeths); poplist = setitemc(poplist, fillmeths{i}, i); end; /*----------------------------------------------------------------+ | Initialize variables. | +----------------------------------------------------------------+*/ %akeyfld; icon = 0; /*----------------------------------------------------------------+ | Query object database for methods. | +----------------------------------------------------------------+*/ call method('WOBJDSID.SCL', 'wobjdsid', wobjdsid); call set(wobjdsid); editpgm = ' '; runpgm = ' '; rc = where(wobjdsid, "name = '" || trim(appltype) || "'"); if (fetch(wobjdsid) ^= 0) then do; call display(%acatalog(eis, ERRMSG), 0, " ", "&emsg8"); link term; return; end; notes = ' '; descript = ' '; method = 1; fillit = fillmeths(method); vallist = 0; dsname = ' '; variable = ' '; source = ' '; catloc = ' '; applist = makelist(0); privdata = dsname(appldsid); rc = rewind(appldsid); call set(appldsid); /*----------------------------------------------------------------+ | Edit an existing application. | +----------------------------------------------------------------+*/ if (applname ^= ' ') then do; newflag = 0; protect applname; cursor descript; /*----------------------------------------------------------------+ | Find control record and fillist from catloc. | +----------------------------------------------------------------+*/ rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); if (fetch(appldsid) = 0) then do; if scan(catloc, 3, ' .') ^= ' ' then catloc = trim(privdata) || '.' || trim(scan(catloc, 3, ' .')) || '.EIS'; else catloc = trim(privdata) || '.' || trim(catloc); rc = fillist('eis', catloc, applist); /*----------------------------------------------------------------+ | Get items from list. | +----------------------------------------------------------------+*/ if rc = 0 then do; method = getnitemn(applist, 'METHOD', 1, 1, 0); fillit = fillmeths(method); dsname = getnitemc(applist, 'DSNAME', 1, 1, ' '); variable = getnitemc(applist, 'VARIABLE', 1, 1, ' '); source = getnitemc(applist, 'SOURCE', 1, 1, ' '); vallist = getniteml(applist, 'LIST', 1, 1, 0); notes = getnitemc(applist, 'NOTES'); initpgm = getnitemc(applist, 'INITPGM', 1, 1, ' '); clickpgm = getnitemc(applist, 'CLICKPGM', 1, 1, ' '); pmenu = getnitemc(applist, 'MENU', 1, 1, ' '); end; end; end; else do; newflag = 1; cursor applname; end; control enter; /*----------------------------------------------------------------+ | Put yourself on the bookmark list. | +----------------------------------------------------------------+*/ call display(%acatalog(eis, PSHSTCK), "&leg1", pos); return; main: /*----------------------------------------------------------------+ | Handle common SAS/EIS commands. | +----------------------------------------------------------------+*/ %eselect(pos, gbrc); otherwise; end; /*----------------------------------------------------------------+ | Check bookmark status to see if you need to end yourself. | +----------------------------------------------------------------+*/ if gbrc = 1 then do; link term; return; end; return; term: if _STATUS_ ^= 'C' then do; /*----------------------------------------------------------------+ | Error checking. Don't allow user to leave create method | | without required information or with fields in error. | +----------------------------------------------------------------+*/ if error(applname) then do; /*----------------------------------------------------------------+ | Give an error message and set _STATUS_ to keep "R"unning. | +----------------------------------------------------------------+*/ _MSG_ = "&emsg7"; _STATUS_ = 'R'; cursor applname; /*----------------------------------------------------------------+ | Remove bookmark request if there was one. | +----------------------------------------------------------------+*/ if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | A name for the application being created is required. | +----------------------------------------------------------------+*/ else if applname = _BLANK_ then do; call display(%acatalog(eis, ERRMSG), 0, "&emsg4", "&emsg5"); _STATUS_ = 'R'; cursor applname; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | If user chose to list out graphs to display, make sure the | | list isn't empty. | +----------------------------------------------------------------+*/ else if method = 1 & listlen(vallist) <= 0 then do; call display(%acatalog(eis,ERRMSG),0,"&emsg1", "&emsg5"); _STATUS_ = 'R'; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; /*----------------------------------------------------------------+ | If user chose to specify a data set and variable containing | | graph names, make sure both are specified. | +----------------------------------------------------------------+*/ else if method = 2 & (dsname = _BLANK_ | variable = _BLANK_) thena do; call display(%acatalog(eis,ERRMSG),0,"&emsg2", "&emsg5"); _STATUS_ = 'R'; if gbrc then call display(%acatalog(eis,RMVSTCK)); return; end; link update; end; /*+-----------------------------------------------------------------+ | Clean up lists and pop yourself off bookmark stack before | | ending. | +-----------------------------------------------------------------+*/ if applist > 0 then rc = dellist(applist,'Y'); if poplist > 0 then rc = dellist(poplist,'Y'); call display(%acatalog(eis, POPSTCK)); _STATUS_ = 'H'; return; update: link setappl; /*+-----------------------------------------------------------------+ | Get a unique catalog entry name to store info... | +-----------------------------------------------------------------+*/ if catloc = ' ' then do; catloc = trim(privdata) || "." || trim(applname) || ".EIS"; call display(%acatalog(eis, UNIQUE.SCL), catloc); end; /*+-----------------------------------------------------------------+ | Make the catalog entry into a 4-level name if it already exists.| +-----------------------------------------------------------------+*/ else if scan(catloc, 3, ' .') ^= ' ' then catloc = trim(privdata) || '.' || trim(scan(catloc, 3, ' .')) || '.EIS'; else catloc = trim(privdata) || '.' || trim(catloc); /*+-----------------------------------------------------------------+ | Save the instance variable values out to the catalog entry. | +-----------------------------------------------------------------+*/ rc = savelist('eis', catloc, applist, 0, descript); rc = rewind(appldsid); catloc = trim(scan(catloc, 3, ' .')) || '.EIS'; /*+-----------------------------------------------------------------+ | Write a record out to the application database or update the | | existing record if this isn't a new application. | +-----------------------------------------------------------------+*/ if newflag then rc = append(appldsid); else do; rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); rc = fetch(appldsid, 'NOSET'); rc = update(appldsid); rc = where(appldsid, 'UNDO'); end; return; setappl: /*+-----------------------------------------------------------------+ | Set up instance variable list for this object class type. | +-----------------------------------------------------------------+*/ rc = setnitemn(applist, method, 'METHOD'); rc = setnitemc(applist, dsname, 'DSNAME'); rc = setnitemc(applist, variable, 'VARIABLE'); rc = setnitemc(applist, source, 'SOURCE'); rc = setniteml(applist, vallist, 'LIST'); rc = setnitemc(applist, notes, 'NOTES'); rc = setnitemc(applist, initpgm, 'INITPGM'); rc = setnitemc(applist, clickpgm, 'CLICKPGM'); rc = setnitemc(applist, pmenu, 'MENU'); return; test: /*+-----------------------------------------------------------------+ | Set up a temporary instance of this object type to use for | | a test. | +-----------------------------------------------------------------+*/ oldname = applname; ocatloc = catloc; applname = 'XTSTAPPX'; catloc = trim(privdata) || "." || trim(applname) || ".EIS"; call display(%acatalog(eis, UNIQUE.SCL), catloc); link setappl; rc = savelist('EIS', catloc, applist, 0, descript); rc = append(appldsid); /*+-----------------------------------------------------------------+ | Run the "test" instance through the SAS/EIS runtime control | | program. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, RUNEIS), &EPARMLST, trim(applname) || '.' || trim(appltype), rc); /*+-----------------------------------------------------------------+ | Delete the "test" instance after running it. | +-----------------------------------------------------------------+*/ rc = where(appldsid, "applname='XTSTAPPX' and appltype='" || trim(appltype) || "'"); if fetch(appldsid) = 0 then rc = delobs(appldsid); if cexist(catloc) then rc = delete(catloc, 'CATALOG'); rc = where(appldsid); applname = oldname; catloc = ocatloc; /*+-----------------------------------------------------------------+ | Check the bookmark stack to see if we need to come down. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, CHKSTCK), pos, gbrc); if gbrc = 1 then do; link term; return; end; return; applname: /*+-----------------------------------------------------------------+ | Check for a unique application name | +-----------------------------------------------------------------+*/ erroroff applname; rc = where(appldsid, "applname = '" || trim(applname) || "'" || " and appltype = '" || trim(appltype) || "'"); if (fetch(appldsid, 'NOSET') = 0 & newflag = 1) then do; _MSG_ = "&emsg9"; erroron applname; end; rc = where(appldsid, 'UNDO'); return; fillcntl: /*+----------------------------------------------------------------+ | Pop a menu of fill methods | +----------------------------------------------------------------+*/ sel = popmenu(poplist); if sel > 0 then do; oldval = method; method = sel; link fillit; if (sysrc(1) < 0) then do; method = oldval; end; else fillit = fillmeths{sel}; end; return; fillit: select(method); /*+----------------------------------------------------------------+ | Fill in graph names interactively. | +----------------------------------------------------------------+*/ when(1) do; if vallist <= 0 | vallist = . then vallist = makelist(0); call display('ENTERS.FRAME', vallist); end; /*+----------------------------------------------------------------+ | Choose a data set containing graph names. | +----------------------------------------------------------------+*/ when(2) do; call display('DSETS.FRAME', dsname, variable, source); end; otherwise; end; return; ncombo: /*+----------------------------------------------------------------+ | Display a list of existing notes when the combo box arrow is | | chosen. | +----------------------------------------------------------------+*/ notes = catlist('*', 'SOURCE', 1, 'Y'); return; notes: /*+----------------------------------------------------------------+ | Verify the notes entry if the end user types it in. | +----------------------------------------------------------------+*/ erroroff notes; if notes = _BLANK_ then return; call method('SASHELP.FSP.CATNCHK.SCL', 'catalog', notes, 'SOURCE', 'SOURCE', 3, msg, rc); if rc then do; _MSG_ = msg; erroron notes; cursor notes; end; return; methods: /*+----------------------------------------------------------------+ | Precede or override methods associated with this instance. | +----------------------------------------------------------------+*/ call display(%acatalog(eis, METHODS), &EPARMLST, initpgm, clickpgm, pmenu, appltype); return; /*+----------------------------------------------------------------+ | Name: BRFINIT.SCL | | Support: HZG | | Product: SAS/EIS | | Language: SCL | | Usage: | | Purpose: Run user init program. | | History: 03Feb93 initial coding HZG | | Notes: | | End | +----------------------------------------------------------------+*/ %eis; %eisentry applist 8; length rc 8; init: method = getnitemn(applist, 'METHOD'); /* get init info from list */ if method = 1 then do; listid = getniteml(applist, 'LIST'); do i = 1 to listlen(listid); source = getitemc(getiteml(listid, 1), 2); link source; end; end; /* get init info from dataset */ if method = 2 then do; dsname = getnitemc(applist, 'DSNAME'); varname = getnitemc(applist, 'SOURCE'); if dsname ^= ' ' then do; dsid = open(dsname); if dsid > 0 then do; do i = 1 to nobs(dsid); rc = fetchobs(dsid, i); source = getvarc(dsid, varnum(dsid, varname)); link source; end; end; end; end; return; main: return; term: return; source: if source ^= _blank_ then do; /*---- copy source into preview window -----*/ rc = preview('clear') ; rc = preview('copy', source); /*--------- submit code to sas ----------*/ if (rc = 0) then do ; submit continue ; endsubmit ; end; end; return; /*+----------------------------------------------------------------+ | Name: CHNGGRPH.SCL | | Support: me | | Product: SAS/EIS | | Language: SCL | | Usage: | | Purpose: Methods for briefing book and arrows classes. | | History: initial coding me | | Notes: | | End | +----------------------------------------------------------------+*/ length type 8 source $ 17 variable $ 8; firstone: method; /*+----------------------------------------------------------------+ | Init method for briefing book class. | +----------------------------------------------------------------+*/ call super(_SELF_, '_INIT_'); /*+----------------------------------------------------------------+ | The automatic instance variables for the briefing book class | | are: | | SOURCE the data set containing the graph names. | | VARIABLE the variable in the data set containing the graph | | names. | | DSID the data set id of the open SOURCE. | | INDEX the position in the data set of the currently | | displayed graph...the initial value is 1. | +----------------------------------------------------------------+*/ /*+----------------------------------------------------------------+ | Open the SOURCE data set. | +----------------------------------------------------------------+*/ if source ^= ' ' then do; dsid = open(source); if dsid > 0 then do; /*+----------------------------------------------------------------+ | Get the first graph to display and display it. | +----------------------------------------------------------------+*/ rc = fetchobs(dsid, index); graph = getvarc(dsid, varnum(dsid, variable)); end; call send(_SELF_, '_SET_GRAPH_', graph); end; endmethod; postinit: method; /*+----------------------------------------------------------------+ | Notify all regions that this is the first graph, so they can | | take appropriate action...e.g. Hide "PREV" arrows. | +----------------------------------------------------------------+*/ call send(_SELF_, '_BROADCAST_', 'FIRST', 1, ' '); endmethod; controls: method; /*+----------------------------------------------------------------+ | Select method for arrows class. | +----------------------------------------------------------------+*/ type = getnitemn(_SELF_, 'CONTROLTYPE'); /*+----------------------------------------------------------------+ | Handle all the different types of arrow and give them a value | | to broadcast of either NEXT or PREV. | +----------------------------------------------------------------+*/ select(type); when(1) call send(_SELF_, '_BROADCAST_', 'NEXT', 1, ' '); when(2) call send(_SELF_, '_BROADCAST_', 'NEXT', 1, ' '); when(3) call send(_SELF_, '_BROADCAST_', 'PREV', 1, ' '); when(4) call send(_SELF_, '_BROADCAST_', 'PREV', 1, ' '); when(5) call send(_SELF_, '_BROADCAST_', 'NEXT', 1, ' '); when(6) call send(_SELF_, '_BROADCAST_', 'NEXT', 1, ' '); when(7) call send(_SELF_, '_BROADCAST_', 'PREV', 1, ' '); when(8) call send(_SELF_, '_BROADCAST_', 'PREV', 1, ' '); when(9) call send(_SELF_, '_BROADCAST_', 'NEXT', 1, ' '); when(10) call send(_SELF_, '_BROADCAST_', 'NEXT', 1, ' '); when(11) call send(_SELF_, '_BROADCAST_', 'PREV', 1, ' '); when(12) call send(_SELF_, '_BROADCAST_', 'PREV', 1, ' '); otherwise; end; endmethod; rcontrol: method msg $ num 8 text $ sender 8; /*+----------------------------------------------------------------+ | Receive method for arrows class. | +----------------------------------------------------------------+*/ type = getnitemn(_SELF_, 'CONTROLTYPE'); if msg = 'FIRST' then do; /*+----------------------------------------------------------------+ | Hide all arrows indicating PREV if this is the first graph in | | the list. | +----------------------------------------------------------------+*/ select(type); when(3) call send(_SELF_, '_HIDE_'); when(4) call send(_SELF_, '_HIDE_'); when(7) call send(_SELF_, '_HIDE_'); when(8) call send(_SELF_, '_HIDE_'); when(11) call send(_SELF_, '_HIDE_'); when(12) call send(_SELF_, '_HIDE_'); otherwise; end; end; else if msg = 'LAST' then do; /*+----------------------------------------------------------------+ | Hide all arrows indicating NEXT if this is the last graph in | | the list. | +----------------------------------------------------------------+*/ select(type); when(1) call send(_SELF_, '_HIDE_'); when(2) call send(_SELF_, '_HIDE_'); when(5) call send(_SELF_, '_HIDE_'); when(6) call send(_SELF_, '_HIDE_'); when(9) call send(_SELF_, '_HIDE_'); when(10) call send(_SELF_, '_HIDE_'); otherwise; end; end; else /*+----------------------------------------------------------------+ | Make all types of arrows visible if the graph being displayed | | is somewhere in the middle of the list. | +----------------------------------------------------------------+*/ call send(_SELF_, '_UNHIDE_'); endmethod; receive: method msg $ num 8 text $ sender 8; if index < 1 then index = 1; /*+----------------------------------------------------------------+ | Receive method for briefing book class. | +----------------------------------------------------------------+*/ select(msg); /*+----------------------------------------------------------------+ | Increment index based on the received message. | +----------------------------------------------------------------+*/ when('PREV') if index > 1 then index = index - 1; when('NEXT') index = index + 1; when('LAST') index = nobs(dsid); otherwise; end; if dsid > 0 then do; /*+----------------------------------------------------------------+ | Get the graph in the current index position. | +----------------------------------------------------------------+*/ rc = fetchobs(dsid, index); if rc = 0 then graph = getvarc(dsid, varnum(dsid, variable)); end; /*+----------------------------------------------------------------+ | If we haven't reached the end of the list, display the graph. | +----------------------------------------------------------------+*/ if rc = 0 then call send(_SELF_, '_SET_GRAPH_', graph); /*+----------------------------------------------------------------+ | Notify all regions of where the index in the list of | | graphs, so arrows can be hidden or unhidden if needed. | +----------------------------------------------------------------+*/ if index = nobs(dsid) then call send(_SELF_, '_BROADCAST_', 'LAST', 1, ' '); else if index = 1 then call send(_SELF_, '_BROADCAST_', 'FIRST', 1, ' '); else call send(_SELF_, '_BROADCAST_', 'MIDDLE', 1, ' '); endmethod; lastone: method; /*+----------------------------------------------------------------+ | Term method for briefing book class. | +----------------------------------------------------------------+*/ /*+----------------------------------------------------------------+ | Close up the data set containing the graph names. | +----------------------------------------------------------------+*/ if dsid > 0 then rc = close(dsid); call super(_SELF_, '_TERM_'); endmethod; /*+----------------------------------------------------------------+ | Name: DSET.SCL | | Support: ALW | | Product: SAS/EIS | | Language: SCL | | Usage: call display('DSET.FRAME' , data, var ); | Purpose: Specify data set and variable with graph names | | History: 02Mar93 initial coding RMH | | Notes: | | End | +----------------------------------------------------------------+*/ entry data $ var $ ; length rc 8; %let emsg1 = ERROR: Invalid data set name.; %let emsg2 = WARNING: Invalid libref; %let emsg3 = WARNING: The data set specified does not exist.; %let emsg4 = ERROR: Invalid data set variable name.; %let emsg5 = ERROR: A variable and a dataset must be supplied.; %let emsg6 = NOTE: The data set specified cannot be opened.; %let emsg7 = NOTE: The variable specified is not in the data set.; %let emsg9 = ERROR: The data set name specified cannot be blank.; init: dsname = data; vname = var; odsname = dsname; ovname = vname; combo = 0; return; main: return; dscombo: combo = 1; dsname: erroroff dsname; if ( substr(dsname,1,1) = '?' or combo = 1 ) then do ; if (combo = 0) then dsname = _BLANK_; else combo = 0 ; dsname = dirlist('*','DATA VIEW',1,'Y') ; if (dsname = ' ') then dsname = odsname; else odsname = dsname; return; end; if ( dsname = _BLANK_ ) then return; if (index(dsname, '.')) then do; lib = scan(dsname, 1, '.'); mem = scan(dsname, 2, '.'); end; else do; lib = 'WORK'; mem = dsname; dsname = trim(lib) || '.' || trim(mem); end; if (sasname(lib) = 0 | sasname(mem) = 0) then do; _MSG_ = " &emsg1"; erroron dsname; return; end; if (libref(lib) ^= 0) then do; _MSG_ = " &emsg2" || ' ' || lib; return; end ; if ^exist(dsname) and ^exist(dsname, 'view') then do; _MSG_ = "&emsg3"; return; end; if ( vname ^= _BLANK_ ) then do; dsid = open(dsname); if dsid < 1 then do; _MSG_ = "&emsg6"; return; end; if varnum(dsid,vname) = 0 then _MSG_ = "&emsg7"; rc = close(dsid); end; odsname = dsname; return; term: if _STATUS_ = 'C' then return; if ((dsname = ' ') & (vname ^= ' ')) then do; _msg_ = " &emsg5"; erroron dsname; _status_='R'; return; end; if ((dsname ^= ' ') & (vname = ' ')) then do; _msg_ = " &emsg5"; erroron vname; _status_='R'; return; end; data = dsname; var = vname; return; vcombo: combo = 1; vname: erroroff vname; erroroff dsname; dsid = 0; if (dsname = _BLANK_) then do; _MSG_ = "&emsg9"; combo = 0 ; erroron dsname; return; end; dsid = open(dsname); if dsid < 1 then do; _MSG_ = "&emsg6"; combo = 0 ; return; end; if substr(vname,1,1) = '?' or combo = 1 then do; if ( combo = 0 ) then vname = _BLANK_; else combo = 0 ; vname = varlist(dsid,'all',1); if (vname = _BLANK_) then vname = ovname; else ovname = vname; if ( dsid ) then rc = close(dsid); return; end; else if vname ^= ' ' & ^(sasname(vname)) then do; _MSG_ = "&emsg4"; erroron vname; cursor vname; if ( dsid ) then rc = close(dsid); return; end; if (vname ^= ' ') and (varnum(dsid,vname) = 0) then _MSG_ = "&emsg7"; ovname = vname; rc = close(dsid); return; /*+----------------------------------------------------------------+ | Name: DSETM.SCL | | Support: ALW | | Product: SAS/EIS | | Language: SCL | | Usage: call display('DSETM.FRAME', data, var, meta info | Purpose: Specify data set and variable with graph names | | History: 02Mar93 initial coding ALW | | 10Mar93 Added metabase ALW | | Notes: | | End | +----------------------------------------------------------------+*/ entry data $ var $ mldsid mbdsid 8 mlname mbname $; length rc 8 _mbrc_ 4 _mbmsg_ $ 80; %let emsg1 = ERROR: Invalid data set name.; %let emsg2 = WARNING: Invalid libref; %let emsg3 = WARNING: The data set specified does not exist.; %let emsg4 = ERROR: Invalid data set variable name.; %let emsg5 = ERROR: A variable and a dataset must be supplied.; %let emsg6 = NOTE: The data set specified cannot be opened.; %let emsg7 = NOTE: The variable specified is not in the data set.; %let emsg9 = ERROR: The data set name specified cannot be blank.; init: dsname = data; vname = var; mblist = makelist(); link chkerr; if regerr then link disperr; return; main: return; term: if _STATUS_ = 'C' then do; rc = dellist(mblist); return; end; if ((dsname = ' ') & (vname ^= ' ')) then do; _msg_ = " &emsg5"; erroron dsname; _status_='R'; return; end; if regerr then do; link disperr; _status_='R'; return; end; if ((dsname ^= ' ') & (vname = ' ')) then do; _msg_ = " &emsg5"; erroron vname; _status_='R'; return; end; data = dsname; var = vname; rc = dellist(mblist); return; dscombo: dsname: erroroff dsname; call display('sashelp.eis.mbdirlst',mbdsid,dsname,' ',' ', mldsid,1,'','GRAPHDS'); mlname = dsname(mldsid); mbname = dsname(mbdsid); if dsname = _blank_ then vname = _blank_; if ( dsname = _BLANK_ ) then return; if (index(dsname, '.')) then do; lib = scan(dsname, 1, '.'); mem = scan(dsname, 2, '.'); end; else do; lib = 'WORK'; mem = dsname; dsname = trim(lib) || '.' || trim(mem); end; if (sasname(lib) = 0 | sasname(mem) = 0) then do; _MSG_ = " &emsg1"; erroron dsname; return; end; if (libref(lib) ^= 0) then do; _MSG_ = " &emsg2" || ' ' || lib; return; end ; if ^exist(dsname) and ^exist(dsname, 'view') then do; _MSG_ = "&emsg3"; return; end; if ( vname ^= _BLANK_ ) then do; dsid = 0; dsid = open(dsname); if dsid < 1 then do; _MSG_ = "&emsg6"; return; end; if varnum(dsid,vname) = 0 then _MSG_ = "&emsg7"; rc = close(dsid); end; return; vcombo: vname: erroroff vname; erroroff dsname; dsid = 0; if (dsname = _BLANK_) then do; _MSG_ = "&emsg9"; erroron dsname; return; end; dsid = 0; dsid = open(dsname); if dsid < 1 then do; _MSG_ = "&emsg6"; return; end; call display(%acatalog(eis,MBVARLST), vname, mbdsid, dsname, 'GRAPH', 1); if vname = _blank_ then return; if ^(sasname(vname)) then do; _MSG_ = "&emsg4"; erroron vname; cursor vname; if ( dsid ) then rc = close(dsid); return; end; if (varnum(dsid,vname) = 0) then _MSG_ = "&emsg7"; rc = close(dsid); return; chkerr: regerr = 0; /*+--------------------------------------------------+ | Open metalist | +--------------------------------------------------*/ %MLOPEN(mldsid,mlname,'U',1,0); if _mbrc_ > 0 then do; regerr = 1; return; end; /*+--------------------------------------------------+ | Open metabase | +--------------------------------------------------*/ %MBOPEN(mbdsid,mbname,'U',1,mldsid); if _mbrc_ > 0 then do; regerr = 2; return; end; if dsname = _blank_ then return; /*+--------------------------------------------------+ | Is the dataset registered? | +--------------------------------------------------*/ rc = clearlist(mblist); rc = setnitemc(mblist,dsname,'DSETNAME'); %MLQUERY(mblist,reg,mldsid,mbdsid,''); if ^reg then do; regerr = 3; return; end; /*+--------------------------------------------------+ | are there any variables with the Graph attr | +--------------------------------------------------*/ rc = clearlist(mblist); rc = setnitemc(mblist,dsname,'DSETNAME'); rc = setnitemc(mblist,'GRAPH','ATTRIBUTE',1); %MBQUERY(mblist,nd,mbdsid,mblist,mblist,mblist,'','R'); if nd > 0 then do; if vname ^= _blank_ then do; name = trim(dsname) || '.' || trim(vname) || '.GRAPH'; if ^nameditem(mblist,name) then do; regerr = 4; return; end; end; end; else do; regerr = 5; return; end; return; disperr: select(regerr); when(0); when(1)call display(%acatalog(eis,ERRMSG),0,"&amsg01",mlname, "&amsg03"); when(2)call display(%acatalog(eis,ERRMSG),0,"&amsg02",mbname, "&amsg03"); when(3)call display(%acatalog(eis,ERRMSG),0,'ERROR: ' || trim(mbname), "&amsg06",dsname); when(4)call display(%acatalog(eis,ERRMSG),0,"&amsg04", 'GRAPH',"&amsg07"); when(5)call display(%acatalog(eis,ERRMSG),0,"&amsg04", 'GRAPH',"&amsg05"); otherwise; end; return; /*+----------------------------------------------------------------+ | Name: DSETS.SCL | | Support: ALW | | Product: SAS/EIS | | Language: SCL | | Usage: call display('DSETS.FRAME", data, var, src); | Purpose: Specify data set and variable with graph names | | History: 02Mar93 initial coding ALW | | 10Mar93 Added source name ALW | | Notes: | | End | +----------------------------------------------------------------+*/ entry data $ var $ src $; length rc 8; %let emsg1 = ERROR: Invalid data set name.; %let emsg2 = WARNING: Invalid libref; %let emsg3 = WARNING: The data set specified does not exist.; %let emsg4 = ERROR: Invalid data set variable name.; %let emsg5 = ERROR: A variable and a dataset must be supplied.; %let emsg6 = NOTE: The data set specified cannot be opened.; %let emsg7 = NOTE: The variable specified is not in the data set.; %let emsg9 = ERROR: The data set name specified cannot be blank.; init: dsname = data; vname = var; sname = src; odsname = dsname; ovname = vname; osname = sname; combo = 0; return; main: return; term: if _STATUS_ = 'C' then return; if dsname = ' ' & (vname ^= ' ' | sname ^= ' ') then do; _msg_ = " &emsg5"; erroron dsname; _status_='R'; return; end; if dsname ^= ' ' & vname = ' ' then do; _msg_ = " &emsg5"; erroron vname; _status_='R'; return; end; data = dsname; var = vname; src = sname; return; dscombo: combo = 1; dsname: erroroff dsname; if ( substr(dsname,1,1) = '?' or combo = 1 ) then do ; if (combo = 0) then dsname = _BLANK_; else combo = 0 ; dsname = dirlist('*','DATA VIEW',1,'Y') ; if (dsname = ' ') then dsname = odsname; else odsname = dsname; return; end; if ( dsname = _BLANK_ ) then return; if (index(dsname, '.')) then do; lib = scan(dsname, 1, '.'); mem = scan(dsname, 2, '.'); end; else do; lib = 'WORK'; mem = dsname; dsname = trim(lib) || '.' || trim(mem); end; if (sasname(lib) = 0 | sasname(mem) = 0) then do; _MSG_ = " &emsg1"; erroron dsname; return; end; if (libref(lib) ^= 0) then do; _MSG_ = " &emsg2" || ' ' || lib; return; end ; if ^exist(dsname) and ^exist(dsname, 'view') then do; _MSG_ = "&emsg3"; return; end; if ( vname ^= _BLANK_ ) then do; dsid = 0; dsid = open(dsname); if dsid < 1 then do; _MSG_ = "&emsg6"; return; end; if varnum(dsid,vname) = 0 then _MSG_ = "&emsg7"; rc = close(dsid); end; if ( sname ^= _BLANK_ ) then do; dsid = 0; dsid = open(dsname); if dsid < 1 then do; _MSG_ = "&emsg6"; return; end; if varnum(dsid,sname) = 0 then _MSG_ = "&emsg7"; rc = close(dsid); end; odsname = dsname; return; vcombo: combo = 1; vname: erroroff vname; erroroff dsname; dsid = 0; if (dsname = _BLANK_) then do; _MSG_ = "&emsg9"; combo = 0 ; erroron dsname; return; end; dsid = open(dsname); if dsid < 1 then do; _MSG_ = "&emsg6"; combo = 0 ; return; end; if substr(vname,1,1) = '?' or combo = 1 then do; if ( combo = 0 ) then vname = _BLANK_; else combo = 0 ; vname = varlist(dsid,'all',1,'','Y','Y',sname); if (vname = _BLANK_) then vname = ovname; else ovname = vname; if ( dsid ) then rc = close(dsid); return; end; else if vname ^= ' ' & ^(sasname(vname)) then do; _MSG_ = "&emsg4"; erroron vname; cursor vname; if ( dsid ) then rc = close(dsid); return; end; if (vname ^= ' ') and (varnum(dsid,vname) = 0) then _MSG_ = "&emsg7"; ovname = vname; rc = close(dsid); return; scombo: combo = 1; sname: erroroff sname; erroroff dsname; dsid = 0; if (dsname = _BLANK_) then do; _MSG_ = "&emsg9"; combo = 0 ; erroron dsname; return; end; dsid = open(dsname); if dsid < 1 then do; _MSG_ = "&emsg6"; combo = 0 ; return; end; if substr(sname,1,1) = '?' or combo = 1 then do; if ( combo = 0 ) then sname = _BLANK_; else combo = 0 ; sname = varlist(dsid,'all',1,'','Y','Y',vname); if (sname = _BLANK_) then sname = osname; else osname = sname; if ( dsid ) then rc = close(dsid); return; end; else if sname ^= ' ' & ^(sasname(sname)) then do; _MSG_ = "&emsg4"; erroron sname; cursor sname; if ( dsid ) then rc = close(dsid); return; end; if (sname ^= ' ') and (varnum(dsid,sname) = 0) then _MSG_ = "&emsg7"; osname = sname; rc = close(dsid); return; /*+----------------------------------------------------------------+ | Name: ENTER.SCL | | Support: ALW | | Product: AF | | Language: SCL | | Usage: call display('enter.frame', vallist); | | Purpose: Enter graph names | | History: 09Mar93 initial coding HG | | Notes: | | End | +----------------------------------------------------------------+*/ entry vallist 8; length rc 8 item $ 200 msg $ 80; %let msg1 = Add Mode On; %let msg2 = Add Mode Off; %let msg3 = Delete; %let msg4 = Unselect All; init: control enter error; addflag = 0; text = ' '; otext = ' '; txt = ' '; link getlist; /*+-----------------------------------------------------------------+ | Hide name fields. | +-----------------------------------------------------------------+*/ call notify('NEW', '_HIDE_'); call notify('RESET', '_HIDE_'); /*--------------------------------------------------------------+ | Turn add mode on if no entries | +--------------------------------------------------------------*/ if listlen(textlist) = 0 then link add; return; main: if (_STATUS_ = 'P' or upcase(word(1)) = 'ACTIONS') then do; /*--------------------------------------------------------------+ | Process action list | +--------------------------------------------------------------*/ rc = popmenu(actlist); select(rc); when(1) do; /*--------------------------------------------------------------+ | Turn add mode on(addflag=0) or off(addflag=1) | +--------------------------------------------------------------*/ if addflag = 0 then do; /*--------------------------------------------------------------+ | Save current graph name if coming from edit mode | +--------------------------------------------------------------*/ if editflag = 1 then do; link text; if runlabel = 0 then do; if currsel > 0 then call notify('TEXTBOX', '_SELECT_ROW_', currsel); return; end; call notify('TEXTBOX', '_GET_TOPROW_', toprow); rc = setitemc(textlist, text, currsel); link populate; runlabel = 0; editflag = 0; call notify('TEXTBOX', '_SET_TOPROW_', toprow); if num > 0 then call notify('TEXTBOX', '_SELECT_ROW_', num); end; link add; end; else link canadd; end; when(2) link delete; when(3) link unselall; otherwise; end; end; runlabel = 1; call nextcmd(); return; term: if _STATUS_ = 'C' then return; /*--------------------------------------------------------------+ | Save any changes to last edited item | +--------------------------------------------------------------*/ if editflag = 1 then do; link text; if runlabel = 0 then do; if currsel > 0 then call notify('TEXTBOX', '_SELECT_ROW_', currsel); _STATUS_ = 'R'; return; end; rc = setitemc(textlist, text, currsel); end; /*--------------------------------------------------------------+ | Save item if in add mode | +--------------------------------------------------------------*/ if addflag = 1 then do; link canadd; if runlabel = 0 then do; _STATUS_ = 'R'; return; end; end; /*--------------------------------------------------------------+ | Update vallist | +--------------------------------------------------------------*/ rc = dellist(vallist,'Y'); vallist = makelist(); do i = 1 to listlen(textlist); sublist = makelist(); item = getitemc(textlist,i); rc = insertc(sublist,item,-1); rc = insertl(vallist,sublist,-1); end; rc = dellist(textlist); rc = dellist(actlist); return; getlist: /*+-----------------------------------------------------------------+ | Create scl list 'textlist' to fill listbox. ! +-----------------------------------------------------------------+*/ textlist = makelist(); do i = 1 to listlen(vallist); sublist = getiteml(vallist,i); item = upcase(getitemc(sublist,1)); rc = insertc(textlist,item,-1); end; /*+-----------------------------------------------------------------+ | Set up popmenu list for 'actions'. | +-----------------------------------------------------------------+*/ actlist = makelist(3); rc = setitemc(actlist, "&msg1", 1); rc = setitemc(actlist, "&msg3", 2); rc = setitemc(actlist, "&msg4", 3); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; return; populate: /*+-----------------------------------------------------------------+ | Populate listbox. | +-----------------------------------------------------------------+*/ text = ' '; call notify('TEXTBOX', '_REPOPULATE_'); return; text: if runlabel = 0 then return; erroroff text; text = upcase(text); /*+-------------------------------------------------------------+ | Check for a valid graph | +-------------------------------------------------------------+*/ if text ^= _blank_ then do; call method('sashelp.fsp.catnchk.scl','catalog',text, 'GRSEG','GRSEG',3,msg,rc,'',0); if rc > 0 & rc < 6 then do; _msg_ = msg; erroron text; cursor text; runlabel = 0; return; end; end; return; textbox: /*+-----------------------------------------------------------------+ | Display info for selected item | +-----------------------------------------------------------------+*/ cursor text; if listlen(getiteml(textbox,1)) = 0 then do; /*--------------------------------------------------------------+ | De-selected item; Check if was in edit mode | +--------------------------------------------------------------*/ if editflag = 1 then do; link text; if runlabel = 0 then return; rc = setitemc(textlist, text, currsel); link populate; runlabel = 0; editflag = 0; end; rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); call notify('RESET', '_HIDE_'); text = ' '; editflag = 0; call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; return; end; /*--------------------------------------------------------------+ | If was in add mode, add item to list | +--------------------------------------------------------------*/ if addflag = 1 then do; /*--------------------------------------------------------------+ | Save position of selected item | +--------------------------------------------------------------*/ call notify('TEXTBOX', '_GET_LAST_SEL_', num, issel, txt); /*--------------------------------------------------------------+ | Update the item being added | +--------------------------------------------------------------*/ link canadd; /*--------------------------------------------------------------+ | Save the number of the current toprow | +--------------------------------------------------------------*/ call notify('TEXTBOX', '_GET_TOPROW_', toprow); /*--------------------------------------------------------------+ | Check for errors in text field(runlabel=0) | +--------------------------------------------------------------*/ if runlabel = 0 then do; if currsel > 0 then call notify('TEXTBOX', '_SET_TOPROW_', currsel); call notify('TEXTBOX', '_UNSELECT_ALL_'); return; end; /*--------------------------------------------------------------+ | Reset currently selected item and current toprow | +--------------------------------------------------------------*/ call notify('TEXTBOX', '_SET_TOPROW_', toprow); if num > 0 then call notify('TEXTBOX', '_SELECT_ROW_', num); text = ' '; otext = ' '; end; if addflag = 1 then addflag = 0; else /* find position of selected item */ call notify('TEXTBOX', '_GET_LAST_SEL_', num, issel, txt); /* if previously selected item has been edited */ /* update it before displaying next item. */ if editflag = 1 and modified(text) then do; /* save list of selected messages */ numlist = copylist(getiteml(textbox, 2)); link text; if runlabel = 0 then do; if currsel > 0 then call notify('TEXTBOX', '_SELECT_ROW_', currsel); return; end; call notify('TEXTBOX', '_GET_TOPROW_', toprow); rc = setitemc(textlist, text, currsel); link populate; runlabel = 0; editflag = 0; call notify('TEXTBOX', '_SET_TOPROW_', toprow); /* reset list of selected messages */ do i = 1 to listlen(numlist); num = getitemn(numlist, i); if num > 0 then call notify('TEXTBOX', '_SELECT_ROW_', num); end; end; /* if more than one message selected */ if listlen(getiteml(textbox,1)) > 1 then do; call notify('RESET', '_HIDE_'); call notify('NEW', '_HIDE_'); rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'ACTIVE', 2); rc = setlattr(actlist, 'ACTIVE', 3); editflag = 0; text = ' '; call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; return; end; /* only one item is selected */ text = getitemc(getiteml(textbox, 1), 1); currsel = getitemn(getiteml(textbox, 2), 1); call notify('TEXT', '_SET_BORDER_COLOR_', 'YELLOW'); unprotect text; call notify('RESET', '_UNHIDE_'); editflag = 1; /* save info in case of reset */ otext = text; rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'ACTIVE', 2); rc = setlattr(actlist, 'ACTIVE', 3); return; reset: /* reset if in add mode */ cursor text; text = otext; erroroff _ALL_; runlabel = 0; return; unselall: /* unselect all messages */ call notify('TEXTBOX', '_UNSELECT_ALL_'); link textbox; return; delete: numlist = copylist(getiteml(textbox,2)); txtlist = copylist(getiteml(textbox,1)); rc = setlattr(numlist, 'UPDATE'); rc = setlattr(txtlist, 'UPDATE'); call display('SASHELP.FSP.DELVER2.FRAME', txtlist, numlist, rc); call notify('TEXTBOX', '_GET_TOPROW_', toprow); if rc = 1 then do; value = listlen(numlist); rc = sortlist(numlist); do i = listlen(numlist) to 1 by -1; num = getitemn(numlist, i); rc = delitem(textlist, num); end; call notify('TEXTBOX', '_REPOPULATE_'); if listlen(textlist) > 1 then call notify('TEXTBOX', '_SET_TOPROW_', toprow); rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); rc = dellist(txtlist); rc = dellist(numlist); call notify('RESET', '_HIDE_'); editflag = 0; text = ' '; call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; _msg_ = 'NOTE: Message(s) deleted: ' || put(value, 2.); end; else _msg_ = 'NOTE: Message(s) deleted: 0.'; return; add: _msg_ = ' '; addflag = 1; text = ' '; otext = ' '; call notify('TEXTBOX', '_UNSELECT_ALL_'); call notify('TEXT', '_SET_BORDER_COLOR_', 'YELLOW'); unprotect text; call notify('NEW', '_UNHIDE_'); call notify('RESET', '_UNHIDE_'); rc = setitemc(actlist, "&msg2", 1); rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); cursor text; return; new: /* update item being added */ if text = ' ' then return; link text; if runlabel = 0 then return; runlabel = 0; rc = insertc(textlist, text, -1); link populate; cursor text; return; canadd: if text ^= ' ' then do; link text; if runlabel = 0 then return; rc = insertc(textlist, text, -1); link populate; end; text = ' '; rc = setitemc(actlist, "&msg1", 1); rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; call notify('NEW', '_HIDE_'); call notify('RESET', '_HIDE_'); addflag = 0; return; /*+----------------------------------------------------------------+ | Name: ENTERS.SCL | | Support: ALW | | Product: AF | | Language: SCL | | Usage: call display('enter.frame', vallist); | | Purpose: Enter graph names | | History: 09Mar93 initial coding HG | | Notes: | | End | +----------------------------------------------------------------+*/ entry vallist 8; length rc 8 item $ 200 msg $ 80; %let msg1 = Add Mode On; %let msg2 = Add Mode Off; %let msg3 = Delete; %let msg4 = Unselect All; init: control enter error; addflag = 0; text = ' '; otext = ' '; txt = ' '; link getlist; /*+-----------------------------------------------------------------+ | Hide name fields. | +-----------------------------------------------------------------+*/ call notify('NEW', '_HIDE_'); call notify('RESET', '_HIDE_'); /*--------------------------------------------------------------+ | Turn add mode on if no entries | +--------------------------------------------------------------*/ if listlen(textlist) = 0 then link add; return; main: if (_STATUS_ = 'P' or upcase(word(1)) = 'ACTIONS') then do; /*--------------------------------------------------------------+ | Process action list | +--------------------------------------------------------------*/ rc = popmenu(actlist); select(rc); when(1) do; /*--------------------------------------------------------------+ | Turn add mode on(addflag=0) or off(addflag=1) | +--------------------------------------------------------------*/ if addflag = 0 then do; /*--------------------------------------------------------------+ | Save current graph name if coming from edit mode | +--------------------------------------------------------------*/ if editflag = 1 then do; link text; link stext; if runlabel = 0 then do; if currsel > 0 then call notify('TEXTBOX', '_SELECT_ROW_', currsel); return; end; call notify('TEXTBOX', '_GET_TOPROW_', toprow); item = trim(text) || ' - ' || trim(stext); rc = setitemc(textlist, item, currsel); link populate; runlabel = 0; editflag = 0; call notify('TEXTBOX', '_SET_TOPROW_', toprow); if num > 0 then call notify('TEXTBOX', '_SELECT_ROW_', num); end; link add; end; else link canadd; end; when(2) link delete; when(3) link unselall; otherwise; end; end; runlabel = 1; call nextcmd(); return; term: if _STATUS_ = 'C' then return; /*--------------------------------------------------------------+ | Save any changes to last edited item | +--------------------------------------------------------------*/ if editflag = 1 then do; link text; link stext; if runlabel = 0 then do; if currsel > 0 then call notify('TEXTBOX', '_SELECT_ROW_', currsel); _STATUS_ = 'R'; return; end; item = trim(text) || ' - ' || trim(stext); rc = setitemc(textlist, item, currsel); end; /*--------------------------------------------------------------+ | Save item if in add mode | +--------------------------------------------------------------*/ if addflag = 1 then do; link canadd; if runlabel = 0 then do; _STATUS_ = 'R'; return; end; end; /*--------------------------------------------------------------+ | Update vallist | +--------------------------------------------------------------*/ rc = dellist(vallist,'Y'); vallist = makelist(); do i = 1 to listlen(textlist); sublist = makelist(); item = getitemc(textlist,i); text = scan(item,1,'-'); stext = scan(item,2,'-'); rc = insertc(sublist,text,-1); rc = insertc(sublist,stext,-1); rc = insertl(vallist,sublist,-1); end; rc = dellist(textlist); rc = dellist(actlist); return; getlist: /*+-----------------------------------------------------------------+ | Create scl list 'textlist' to fill listbox. ! +-----------------------------------------------------------------+*/ textlist = makelist(); do i = 1 to listlen(vallist); sublist = getiteml(vallist,i); text = upcase(getitemc(sublist,1)); stext = upcase(getitemc(sublist,2)); item = trim(text) || ' - ' || trim(stext); rc = insertc(textlist,item,-1); end; /*+-----------------------------------------------------------------+ | Set up popmenu list for 'actions'. | +-----------------------------------------------------------------+*/ actlist = makelist(3); rc = setitemc(actlist, "&msg1", 1); rc = setitemc(actlist, "&msg3", 2); rc = setitemc(actlist, "&msg4", 3); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); call notify('STEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; protect stext; return; populate: /*+-----------------------------------------------------------------+ | Populate listbox. | +-----------------------------------------------------------------+*/ text = ' '; stext = ' '; call notify('TEXTBOX', '_REPOPULATE_'); return; text: erroroff text; text = upcase(text); /*+-------------------------------------------------------------+ | Check for a valid graph | +-------------------------------------------------------------+*/ if text ^= _blank_ then do; call method('sashelp.fsp.catnchk.scl','catalog',text, 'GRSEG','GRSEG',3,msg,rc,'',0); if rc > 0 & rc < 6 then do; _msg_ = msg; erroron text; cursor text; runlabel = 0; return; end; end; return; stext: erroroff stext; stext = upcase(stext); /*+-------------------------------------------------------------+ | Check for a valid graph | +-------------------------------------------------------------+*/ if stext ^= _blank_ then do; call method('sashelp.fsp.catnchk.scl','catalog',stext, 'SOURCE','SOURCE',3,msg,rc,'',0); if rc > 0 & rc < 6 then do; _msg_ = msg; erroron stext; cursor stext; runlabel = 0; return; end; end; return; textbox: /*+-----------------------------------------------------------------+ | Display info for selected item | +-----------------------------------------------------------------+*/ cursor text; if listlen(getiteml(textbox,1)) = 0 then do; /*--------------------------------------------------------------+ | De-selected item; Check if was in edit mode | +--------------------------------------------------------------*/ if editflag = 1 then do; link text; link stext; if runlabel = 0 then return; item = trim(text) || ' - ' || trim(stext); rc = setitemc(textlist, item, currsel); link populate; runlabel = 0; editflag = 0; end; rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); call notify('RESET', '_HIDE_'); text = ' '; stext = ' '; editflag = 0; call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); call notify('STEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; protect stext; return; end; /*--------------------------------------------------------------+ | If was in add mode, add item to list | +--------------------------------------------------------------*/ if addflag = 1 then do; /*--------------------------------------------------------------+ | Save position of selected item | +--------------------------------------------------------------*/ call notify('TEXTBOX', '_GET_LAST_SEL_', num, issel, txt); /*--------------------------------------------------------------+ | Update the item being added | +--------------------------------------------------------------*/ link canadd; /*--------------------------------------------------------------+ | Save the number of the current toprow | +--------------------------------------------------------------*/ call notify('TEXTBOX', '_GET_TOPROW_', toprow); /*--------------------------------------------------------------+ | Check for errors in text field(runlabel=0) | +--------------------------------------------------------------*/ if runlabel = 0 then do; if currsel > 0 then call notify('TEXTBOX', '_SET_TOPROW_', currsel); call notify('TEXTBOX', '_UNSELECT_ALL_'); return; end; /*--------------------------------------------------------------+ | Reset currently selected item and current toprow | +--------------------------------------------------------------*/ call notify('TEXTBOX', '_SET_TOPROW_', toprow); if num > 0 then call notify('TEXTBOX', '_SELECT_ROW_', num); text = ' '; otext = ' '; stext = ' '; ostext = ' '; end; if addflag = 1 then addflag = 0; else /* find position of selected item */ call notify('TEXTBOX', '_GET_LAST_SEL_', num, issel, txt); /* if previously selected item has been edited */ /* update it before displaying next item. */ if editflag = 1 and (modified(text) | modified(stext)) then do; /* save list of selected messages */ numlist = copylist(getiteml(textbox, 2)); link text; link stext; if runlabel = 0 then do; if currsel > 0 then call notify('TEXTBOX', '_SELECT_ROW_', currsel); return; end; call notify('TEXTBOX', '_GET_TOPROW_', toprow); item = trim(text) || ' - ' || trim(stext); rc = setitemc(textlist, item, currsel); link populate; runlabel = 0; editflag = 0; call notify('TEXTBOX', '_SET_TOPROW_', toprow); /* reset list of selected messages */ do i = 1 to listlen(numlist); num = getitemn(numlist, i); if num > 0 then call notify('TEXTBOX', '_SELECT_ROW_', num); end; end; /* if more than one message selected */ if listlen(getiteml(textbox,1)) > 1 then do; call notify('RESET', '_HIDE_'); call notify('NEW', '_HIDE_'); rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'ACTIVE', 2); rc = setlattr(actlist, 'ACTIVE', 3); editflag = 0; text = ' '; stext = ' '; call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; call notify('STEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect stext; return; end; /* only one item is selected */ item = getitemc(getiteml(textbox, 1), 1); text = scan(item,1,'-'); stext = scan(item,2,'-'); currsel = getitemn(getiteml(textbox, 2), 1); call notify('TEXT', '_SET_BORDER_COLOR_', 'YELLOW'); unprotect text; call notify('STEXT', '_SET_BORDER_COLOR_', 'YELLOW'); unprotect stext; call notify('RESET', '_UNHIDE_'); editflag = 1; /* save info in case of reset */ otext = text; ostext = stext; rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'ACTIVE', 2); rc = setlattr(actlist, 'ACTIVE', 3); return; reset: /* reset if in add mode */ cursor text; text = otext; cursor stext; text = ostext; erroroff _ALL_; runlabel = 0; return; unselall: /* unselect all messages */ call notify('TEXTBOX', '_UNSELECT_ALL_'); link textbox; return; delete: numlist = copylist(getiteml(textbox,2)); txtlist = copylist(getiteml(textbox,1)); rc = setlattr(numlist, 'UPDATE'); rc = setlattr(txtlist, 'UPDATE'); call display('SASHELP.FSP.DELVER2.FRAME', txtlist, numlist, rc); call notify('TEXTBOX', '_GET_TOPROW_', toprow); if rc = 1 then do; value = listlen(numlist); rc = sortlist(numlist); do i = listlen(numlist) to 1 by -1; num = getitemn(numlist, i); rc = delitem(textlist, num); end; call notify('TEXTBOX', '_REPOPULATE_'); if listlen(textlist) > 1 then call notify('TEXTBOX', '_SET_TOPROW_', toprow); rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); rc = dellist(txtlist); rc = dellist(numlist); call notify('RESET', '_HIDE_'); editflag = 0; text = ' '; call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; call notify('STEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect stext; _msg_ = 'NOTE: Message(s) deleted: ' || put(value, 2.); end; else _msg_ = 'NOTE: Message(s) deleted: 0.'; return; add: _msg_ = ' '; addflag = 1; text = ' '; otext = ' '; stext = ' '; ostext = ' '; call notify('TEXTBOX', '_UNSELECT_ALL_'); call notify('TEXT', '_SET_BORDER_COLOR_', 'YELLOW'); unprotect text; call notify('STEXT', '_SET_BORDER_COLOR_', 'YELLOW'); unprotect stext; call notify('NEW', '_UNHIDE_'); call notify('RESET', '_UNHIDE_'); rc = setitemc(actlist, "&msg2", 1); rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); cursor text; return; new: /* update item being added */ if text = ' ' then return; link text; link stext; if runlabel = 0 then return; runlabel = 0; item = trim(text) || ' - ' || trim(stext); rc = insertc(textlist, item, -1); link populate; cursor text; return; canadd: if text ^= ' ' then do; link text; link stext; if runlabel = 0 then return; item = trim(text) || ' - ' || trim(stext); rc = insertc(textlist, item, -1); link populate; end; text = ' '; stext = ' '; rc = setitemc(actlist, "&msg1", 1); rc = setlattr(actlist, 'ACTIVE', 1); rc = setlattr(actlist, 'INACTIVE', 2); rc = setlattr(actlist, 'INACTIVE', 3); call notify('TEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect text; call notify('STEXT', '_SET_BORDER_COLOR_', 'GRAY'); protect stext; call notify('NEW', '_HIDE_'); call notify('RESET', '_HIDE_'); addflag = 0; return; /*+------------------------------------------------------------+ | Name: MMDELGPH.SCL | | Support: ALW | | Product: SAS/EIS | | Language: SCL | | Usage: call display('MMDELGPH.program',...); | | Purpose: Remove GRAPH/GRAPHDS attribute | | History: 03Mar93 initial coding ALW | | Notes: | | End | +-----------------------------------------------------------+*/ %eis; entry mbdsid 8 dsid 8 dsn varname attribut value $; length rc 8 _mbrc_ 4 _mbmsg_ $ 80; init: %akeyfld; rc = 0; mblist = makelist(); /*---------------------------------------------------------+ | Delete GRAPH variable attribute(varname not blank) | | or GRAPHDS data set attribute(varname blank) | +---------------------------------------------------------*/ if varname ^= none then link delvar; else link delds; return; main: return; term: rc = dellist(mblist); return; delvar: /*---------------------------------------------------------+ | Delete variable attribute | +---------------------------------------------------------*/ mbname = dsname(mbdsid); /*---------------------------------------------------------+ | remove GRAPH attribute for variable selected | +---------------------------------------------------------*/ call display(%acatalog(eis, MBDELREC), mbrc, mbname, mbdsid, dsn, varname, 'GRAPH'); /*---------------------------------------------------------+ | If no variables left with GRAPH attribute | | delete the GRAPHDS data set attribute also | +---------------------------------------------------------*/ nrecs = 0; rc = setnitemc(mblist,dsn,'DSETNAME'); rc = setnitemc(mblist,'GRAPH','ATTRIBUTE'); %MBQUERY(mblist,nrecs,mbdsid,mblist,mblist,mblist,'','R'); if nrecs = 0 then do; varname = ' '; call display(%acatalog(eis, MBDELREC), mbrc, mbname, mbdsid, dsn, varname, 'GRAPHDS'); end; attribut = ' '; return; delds: /*---------------------------------------------------------+ | Delete GRAPHDS data set attribute | +---------------------------------------------------------*/ mbname = dsname(mbdsid); varname = ' '; /*---------------------------------------------------------+ | Remove GRAPH variable attribute from all variables | +---------------------------------------------------------*/ call display(%acatalog(eis, MBDELREC), mbrc, mbname, mbdsid, dsn, varname, 'GRAPH'); attribut = ' '; return; /*+--------------------------------------------------------+ | Name: MMGRAPH.SCL | | Support: ALW | | Product: SAS/EIS | | Language: SCL | | Usage: call display('MMGRAPH.program',...); | | Purpose: Assign GRAPH attribute | | History: 03Mar93 initial coding ALW | | Notes: | | End | +---------------------------------------------------------+*/ %eis; entry mbdsid 8 dsid 8 dsn varname attribut value $; %let emsg1 = does not have any character variables; %let emsg2 = The GRAPHDS attribute cannot be assigned.; length rc 8 _mbrc_ 4 _mbmsg_ $ 80; array recarray (99) $ 58 _temporary_ ; init: %akeyfld; rc = 0; retvar = ' '; selvar = ' '; var = ' '; mblist = makelist(); /*---------------------------------------------------------+ | Assign variable attribute GRAPH(varname not blank) | | Assign data set attribute GRAPHDS(varname blank) | +---------------------------------------------------------*/ if varname ^= none then link asgvar; else link asgds; return; main: return; term: rc = dellist(mblist); return; asgvar: /*---------------------------------------------------------+ | Assign variable attribute GRAPH(varname not blank) | | Assign GRAPHDS attribute if not already assigned. | | GRAPH attribute assigned when return to calling pgm | +---------------------------------------------------------*/ nrecs = 0; rc = setnitemc(mblist,dsn,'DSETNAME'); rc = setnitemc(mblist,'GRAPH','ATTRIBUTE'); %MBQUERY(mblist,nrecs,mbdsid,mblist,mblist,mblist,'','R'); if nrecs > 0 then /*---------------------------------------------------------+ | Already assigned, return | +---------------------------------------------------------*/ return; else do; /*---------------------------------------------------------+ | Not assigned, assign GRAPHDS | +---------------------------------------------------------*/ mldsid = getnitemn(envlist('L'), 'MLDSID'); mbname = dsname(mbdsid); call display(%acatalog(eis, MBADRECN), kbrc, mbname, mbdsid, dsn, none, 'GRAPHDS', ' ', ' ', mldsid); end; return; asgds: /*---------------------------------------------------------+ | Assign GRAPHDS attribute to data set | | check for at least one character variable | +---------------------------------------------------------*/ nrecs = 0; rc = clearlist(mblist); rc = setnitemc(mblist,dsn,'DSETNAME'); rc = setnitemc(mblist,'VARTYPE','ATTRIBUTE'); %MBQUERY(mblist,nrecs,mbdsid,mblist,mblist,mblist,'','R'); if searchc(mblist,'C') = 0 then do; msg3 = 'ERROR: ' || dsn; call display(%acatalog(eis,ERRMSG),0,' ',msg3, "&emsg1", "&emsg2"); attribut = ' '; return; end; mldsid = getnitemn(envlist('L'), 'MLDSID'); mbname = dsname(mbdsid); /*---------------------------------------------------------+ | Get a list of variables that currently have GRAPH | +---------------------------------------------------------*/ nrecs = 0; rc = clearlist(mblist); rc = setnitemc(mblist,dsn,'DSETNAME'); rc = setnitemc(mblist,'GRAPH','ATTRIBUTE'); %MBQUERY(mblist,nrecs,mbdsid,mblist,mblist,mblist,'','R'); /*---------------------------------------------------------+ | Build string of GRAPH variables to pass to MBVARLST | +---------------------------------------------------------*/ if nrecs > 0 then do; retvar = ''; selvar = ''; do i = 1 to nrecs; selvar = scan(getitemc(mblist,i),3,'.'); retvar = retvar || ' ' || selvar; call display(%acatalog(eis, MBDELREC), kbrc, mbname, mbdsid, dsn, selvar, 'GRAPH'); end; end; /*---------------------------------------------------------+ | Select new GRAPH variables | +---------------------------------------------------------*/ varname = ' '; call display(%acatalog(eis, MBVARLST), retvar, mbdsid, dsn, 'VARTYPE=C', 20, 'Select GRAPH variable(s)', 'Y', ' ', varname); if retvar = ' ' then do; /*---------------------------------------------------------+ | No variables selected. Do not assign GRAPHDS | +---------------------------------------------------------*/ attribut = ' '; return; end; /*---------------------------------------------------------+ | Assign GRAPH to each selected variable. | | GRAPHDS will be assigned when return to calling pgm | +---------------------------------------------------------*/ n = 1; do while (scan(retvar, n, ' ') ^= ' '); var = scan(retvar, n, ' '); call display(%acatalog(eis, MBADRECN), kbrc, mbname, mbdsid, dsn, var, 'GRAPH', ' ', ' ', mldsid); n = n + 1; end; value = retvar; return; /*+----------------------------------------------------------------+ | Name: RUNBRF.SCL | | Support: me | | Product: SAS/EIS | | Language: SCL | | Usage: call display('RUNBRF.SCL', &EPARMLST, applname, | | appltype); | | Purpose: Run a briefing book object class. | | History: initial coding me | | Notes: | | End | +----------------------------------------------------------------+*/ %eis; %eisentry applname appltype $ 8; length where $ 80 rc 8 descript $ 40; %let emsg1 = WARNING: The application specified,; %let emsg2 = does not exist.; %let emsg3 = ERROR: The application specified,; %let emsg4 = is missing information.; %let emsg5 = NOTE: The specified initialization method ; %let emsg5a = is not available.; init: /*--------------------------------------------------------------+ | Initialize variables. | +--------------------------------------------------------------*/ control enter; catloc = ' '; notes = ' '; cmdline = ' '; descript = ' '; applist = 0; icon = 0; method = 0; /*--------------------------------------------------------------+ | Locate record in application database. | +--------------------------------------------------------------*/ call set(appldsid); where = 'applname = ' || "'" || trim(applname) || "'" || 'and appltype = ' || "'" || trim(appltype) || "'"; rc = where(appldsid, where); if fetch(appldsid) ^= 0 then do; call display(%acatalog(eis, ERRMSG), 0, "&emsg3", trim(applname) || '.' || trim(appltype) || ',', "&emsg2"); link term; return; end; rc = icon(icon); /*--------------------------------------------------------------+ | Fill list with instance variables from application catalog. | +--------------------------------------------------------------*/ privdata = dsname(appldsid); if scan(catloc, 3, ' .') ^= ' ' then catloc = trim(privdata) || '.' || trim(scan(catloc, 3, ' .')) || '.EIS'; else catloc = trim(privdata) || '.' || trim(catloc); if cexist(catloc) then do; applist = makelist(); rc = fillist('eis', catloc, applist); end; else do; call display(%acatalog(eis, ERRMSG), 0, "&emsg3", trim(applname) || '.' || trim(appltype), "&emsg4"); link term; return; end; /*--------------------------------------------------------------+ | Get instance variables. | +--------------------------------------------------------------*/ link getlist; /*----------------------------------------------------------------+ | Put yourself on the bookmark list. | +----------------------------------------------------------------*/ if descript ^= ' ' then call display(%acatalog(eis, PSHSTCK), descript, pos); else call display(%acatalog(eis, PSHSTCK), trim(applname) || '.' || trim(appltype), pos); return; main: if _STATUS_ = 'E' then return; /*----------------------------------------------------------------+ | Handle common SAS/EIS commands. | +----------------------------------------------------------------*/ %eselect(pos, gbrc); otherwise; end; /*----------------------------------------------------------------+ | Check bookmark status to see if you need to end yourself. | +----------------------------------------------------------------*/ if gbrc = 1 then do; link term; return; end; return; term: /*+-----------------------------------------------------------------+ | Clean up lists and pop yourself off bookmark stack before | | ending. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, POPSTCK)); rc = where(appldsid, 'UNDO'); if applist then rc = dellist(applist); if dsid > 0 then rc = close(dsid); _STATUS_ = 'H'; return; getlist: /*--------------------------------------------------------------+ | Get items from list. | +--------------------------------------------------------------*/ index = 1; method = getnitemn(applist, 'METHOD'); /*--------------------------------------------------------------+ | Display graphs from a "list" of graphs. | +--------------------------------------------------------------*/ if method = 1 then do; listid = getniteml(applist, 'LIST'); graph = getitemc(getiteml(listid, 1), 1); /*--------------------------------------------------------------+ | Hide "down" arrow if the displayed graph is the last one. | +--------------------------------------------------------------*/ if index = listlen(listid) then call notify('DOWN', '_HIDE_'); end; /*--------------------------------------------------------------+ | Display graphs from a data set containing graph names. | +--------------------------------------------------------------*/ if method = 2 then do; dsname = getnitemc(applist, 'DSNAME'); varname = getnitemc(applist, 'VARIABLE'); index = getnitemn(applist, 'INDEX', 1, 1, 1); if dsname ^= ' ' then do; dsid = open(dsname); if dsid > 0 then do; rc = fetchobs(dsid, index); graph = getvarc(dsid, varnum(dsid, varname)); end; end; /*--------------------------------------------------------------+ | Hide "down" arrow if the displayed graph is the last one. | +--------------------------------------------------------------*/ if index = nobs(dsid) then call notify('DOWN', '_HIDE_'); end; /*--------------------------------------------------------------+ | Save the number of graphs and the data set id of the data | | containing graph names if that was the method used. | +--------------------------------------------------------------*/ rc = setnitemn(applist, index, 'INDEX'); rc = setnitemn(applist, dsid, 'DSID'); /*--------------------------------------------------------------+ | Since this is the first graph displayed, hide the "up" arrow | | and display the first graph in the series. | +--------------------------------------------------------------*/ call notify('UP', '_HIDE_'); call notify('MLTGRPH', '_SET_GRAPH_', graph); return; up: /*--------------------------------------------------------------+ | Handle the user's request to scroll up in the series of | | graphs. | +--------------------------------------------------------------*/ /*--------------------------------------------------------------+ | Decrement the location in the series of graphs. Get the | | next graph to display. | +--------------------------------------------------------------*/ index = index - 1; if method = 1 then link nextlst; else link nextds; /*--------------------------------------------------------------+ | If we're at the top of the series, hide the "up" arrow. | | Unhide the "down" arrow to allow scrolling to the next graph.| +--------------------------------------------------------------*/ if index = 1 then call notify('UP', '_HIDE_'); call notify('DOWN', '_UNHIDE_'); return; down: /*--------------------------------------------------------------+ | Handle the user's request to scroll down in the series of | | graphs. | +--------------------------------------------------------------*/ /*--------------------------------------------------------------+ | Increment the location in the series of graphs. Get the | | next graph to display. | +--------------------------------------------------------------*/ index = index + 1; /*--------------------------------------------------------------+ | If we're at the bottom of the series, hide the "down" arrow. | | Unhide the "up" arrow to allow scrolling to the prev graph. | +--------------------------------------------------------------*/ if method = 1 then do; link nextlst; if index = listlen(listid) then call notify('DOWN', '_HIDE_'); end; else do; link nextds; if index = nobs(dsid) then call notify('DOWN', '_HIDE_'); end; call notify('UP', '_UNHIDE_'); return; nextds: /*--------------------------------------------------------------+ | Get the next graph to display from the data set. Save out | | the current index being displayed and display the graph. | +--------------------------------------------------------------*/ rc = fetchobs(dsid, index); if rc = 0 then graph = getvarc(dsid, varnum(dsid, varname)); if rc = 0 then do; rc = setnitemn(applist, index, 'INDEX'); call notify('MLTGRPH', '_SET_GRAPH_', graph); end; return; nextlst: /*--------------------------------------------------------------+ | Get the next graph to display from the list. Save out | | the current index being displayed and display the graph. | +--------------------------------------------------------------*/ graph = getitemc(getiteml(listid, index), 1); rc = setnitemn(applist, index, 'INDEX'); call notify('MLTGRPH', '_SET_GRAPH_', graph); return; /*+----------------------------------------------------------------+ | Name: RUNBRFS.SCL | | Support: me | | Product: SAS/EIS | | Language: SCL | | Usage: call display('RUNBRFS.SCL', &EPARMLST, applname, | | appltype); | | Purpose: Run a briefing book object class allowing for | | source that needs to be run. | | History: initial coding me | | Notes: | | End | +----------------------------------------------------------------+*/ %eis; %eisentry applname appltype $ 8; length where $ 80 rc 8 graph $ 35 descript $ 40; %let emsg1 = WARNING: The application specified,; %let emsg2 = does not exist.; %let emsg3 = ERROR: The application specified,; %let emsg4 = is missing information.; %let emsg5 = NOTE: The specified initialization method ; %let emsg5a = is not available.; init: /*--------------------------------------------------------------+ | Initialize variables. | +--------------------------------------------------------------*/ control enter; catloc = ' '; notes = ' '; cmdline = ' '; descript = ' '; applist = 0; icon = 0; method = 0; /*--------------------------------------------------------------+ | Locate record in application database. | +--------------------------------------------------------------*/ call set(appldsid); where = 'applname = ' || "'" || trim(applname) || "'" || 'and appltype = ' || "'" || trim(appltype) || "'"; rc = where(appldsid, where); if fetch(appldsid) ^= 0 then do; call display(%acatalog(eis, ERRMSG), 0, "&emsg3", trim(applname) || '.' || trim(appltype) || ',', "&emsg2"); link term; return; end; rc = icon(icon); /*--------------------------------------------------------------+ | Fill list with instance variables from application catalog. | +--------------------------------------------------------------*/ privdata = dsname(appldsid); if scan(catloc, 3, ' .') ^= ' ' then catloc = trim(privdata) || '.' || trim(scan(catloc, 3, ' .')) || '.EIS'; else catloc = trim(privdata) || '.' || trim(catloc); if cexist(catloc) then do; applist = makelist(); rc = fillist('eis', catloc, applist); end; else do; call display(%acatalog(eis, ERRMSG), 0, "&emsg3", trim(applname) || '.' || trim(appltype), "&emsg4"); link term; return; end; /*--------------------------------------------------------------+ | Get instance variables. | +--------------------------------------------------------------*/ link getlist; initpgm = getnitemc(applist,'INITPGM'); fullinit = searchpath(initpgm); /*--------------------------------------------------------------+ | Call initialization method if it exists and display first | | graph in the series. | +--------------------------------------------------------------*/ link userinit; call notify('MLTGRPH', '_SET_GRAPH_', graph); /*----------------------------------------------------------------+ | Put yourself on the bookmark list. | +----------------------------------------------------------------*/ if descript ^= ' ' then call display(%acatalog(eis, PSHSTCK), descript, pos); else call display(%acatalog(eis, PSHSTCK), trim(applname) || '.' || trim(appltype), pos); return; main: if _STATUS_ = 'E' then return; /*----------------------------------------------------------------+ | Handle common SAS/EIS commands. | +----------------------------------------------------------------*/ %eselect(pos, gbrc); otherwise; end; /*----------------------------------------------------------------+ | Check bookmark status to see if you need to end yourself. | +----------------------------------------------------------------*/ if gbrc = 1 then do; link term; return; end; return; term: /*+-----------------------------------------------------------------+ | Clean up lists and pop yourself off bookmark stack before | | ending. | +-----------------------------------------------------------------+*/ call display(%acatalog(eis, POPSTCK)); rc = where(appldsid, 'UNDO'); if applist then rc = dellist(applist); if dsid > 0 then rc = close(dsid); _STATUS_ = 'H'; return; getlist: /*--------------------------------------------------------------+ | Get items from list. | +--------------------------------------------------------------*/ index = 1; method = getnitemn(applist, 'METHOD'); /*--------------------------------------------------------------+ | Display graphs from a "list" of graphs. | +--------------------------------------------------------------*/ if method = 1 then do; listid = getniteml(applist, 'LIST'); graph = getitemc(getiteml(listid, 1), 1); /*--------------------------------------------------------------+ | Hide "down" arrow if the displayed graph is the last one. | +--------------------------------------------------------------*/ if index = listlen(listid) then call notify('DOWN', '_HIDE_'); end; /*--------------------------------------------------------------+ | Display graphs from a data set containing graph names. | +--------------------------------------------------------------*/ if method = 2 then do; dsname = getnitemc(applist, 'DSNAME'); varname = getnitemc(applist, 'VARIABLE'); index = getnitemn(applist, 'INDEX', 1, 1, 1); if dsname ^= ' ' then do; dsid = open(dsname); if dsid > 0 then do; rc = fetchobs(dsid, index); graph = getvarc(dsid, varnum(dsid, varname)); end; end; /*--------------------------------------------------------------+ | Hide "down" arrow if the displayed graph is the last one. | +--------------------------------------------------------------*/ if index = nobs(dsid) then call notify('DOWN', '_HIDE_'); end; /*--------------------------------------------------------------+ | Save the number of graphs and the data set id of the data | | containing graph names if that was the method used. | +--------------------------------------------------------------*/ rc = setnitemn(applist, index, 'INDEX'); rc = setnitemn(applist, dsid, 'DSID'); /*--------------------------------------------------------------+ | Since this is the first graph displayed, hide the "up" arrow | | and display the first graph in the series. | +--------------------------------------------------------------*/ call notify('UP', '_HIDE_'); return; up: /*--------------------------------------------------------------+ | Handle the user's request to scroll up in the series of | | graphs. | +--------------------------------------------------------------*/ /*--------------------------------------------------------------+ | Decrement the location in the series of graphs. Get the | | next graph to display. | +--------------------------------------------------------------*/ index = index - 1; if method = 1 then link nextlst; else link nextds; /*--------------------------------------------------------------+ | If we're at the top of the series, hide the "up" arrow. | | Unhide the "down" arrow to allow scrolling to the next graph.| +--------------------------------------------------------------*/ if index = 1 then call notify('UP', '_HIDE_'); call notify('DOWN', '_UNHIDE_'); return; down: /*--------------------------------------------------------------+ | Handle the user's request to scroll down in the series of | | graphs. | +--------------------------------------------------------------*/ /*--------------------------------------------------------------+ | Increment the location in the series of graphs. Get the | | next graph to display. | +--------------------------------------------------------------*/ index = index + 1; /*--------------------------------------------------------------+ | If we're at the bottom of the series, hide the "down" arrow. | | Unhide the "up" arrow to allow scrolling to the prev graph. | +--------------------------------------------------------------*/ if method = 1 then do; link nextlst; if index = listlen(listid) then call notify('DOWN', '_HIDE_'); end; else do; link nextds; if index = nobs(dsid) then call notify('DOWN', '_HIDE_'); end; call notify('UP', '_UNHIDE_'); return; nextds: /*--------------------------------------------------------------+ | Get the next graph to display from the data set. Save out | | the current index being displayed and display the graph. | +--------------------------------------------------------------*/ rc = fetchobs(dsid, index); if rc = 0 then graph = getvarc(dsid, varnum(dsid, varname)); if rc = 0 then do; rc = setnitemn(applist, index, 'INDEX'); call notify('mltgrph', '_SET_GRAPH_', graph); end; return; nextlst: /*--------------------------------------------------------------+ | Get the next graph to display from the list. Save out | | the current index being displayed and display the graph. | +--------------------------------------------------------------*/ graph = getitemc(getiteml(listid, index), 1); rc = setnitemn(applist, index, 'INDEX'); call notify('mltgrph', '_SET_GRAPH_', graph); return; userinit: /*--------------------------------------------------------------+ | If there is a user initialization method, call it. | +--------------------------------------------------------------*/ if initpgm = _BLANK_ then return; if fullinit ^= _BLANK_ then call display(fullinit, &EPARMLST, applist); else call display(%acatalog(eis, ERRMSG), 0, "&emsg5", "&emsg5a"); return; mltgrph: /*--------------------------------------------------------------+ | If there is source associated with the graphs, get it and | | link to code to submit it to SAS. | +--------------------------------------------------------------*/ if method = 1 then do; source = getitemc(getiteml(listid, index), 2); link source; end; if method = 2 then do; varname = getnitemc(applist, 'SOURCE'); source = getvarc(dsid, varnum(dsid, varname)); link source; end; call notify('MLTGRPH','_UPDATE_'); return; source: /*--------------------------------------------------------------+ | Submit source to re-generate graphs to SAS. | +--------------------------------------------------------------*/ if source ^= _BLANK_ then do; rc = preview('clear') ; rc = preview('copy', source); if (rc = 0) then do ; submit continue ; endsubmit ; end; end; return;