/* Source Code for Obswww12 - Van Meter */ ******************************************************************************* ******************************************************************************* /* LOGIN.PROGRAM */ INIT: cursor userid; RETURN; MAIN: select(choice); when('Continue') do; if userid='' then do; msg1=''; msg2='Please specify your userid.'; msg3=''; link usermsg; cursor userid; return; end; if pw='' then do; msg1=''; msg2='Please specify your password.'; msg3=''; link usermsg; cursor pw; return; end; /* validate password */ if userid ne '' then do; ul=open('sysdata.userlst','input'); lrc=locatec(ul,varnum(ul,'userid'),userid); if lrc gt 0 then do; password=getvarc(ul,varnum(ul,'pw')); if ul gt 0 then ul=close(ul); if password ne pw then do; msg1=''; msg2='Password is invalid.'; msg3='Specify password and press Continue.'; link usermsg; pw=''; cursor pw; return; end; /* build the menu and launch the application */ pmenuid='PMENU0'; call display('catlg.system.pmenubld.scl',userid,pmenuid); call display('catlg.invest.main.frame'); _status_='H'; end; end; /* end if userid ne '' */ end; /* end when('continue') */ when('Go Back') _status_='H'; otherwise; end; /* end select(choice) */ RETURN; TERM: RETURN; USERMSG: call symput('msg1',msg1); call symput('msg2',msg2); call symput('msg3',msg3); call display('catlg.utility.usermsg.program'); RETURN; ******************************************************************************* /* PMENUBLD.SCL */ entry userid $10 pmenuid $20; length text $80 menu menucall $20 item $40 slec $10 menusort drc 8 access $80; INIT: menu=''; menucall=''; item=''; slec=''; menusort=.; dsname='work.'||trim(pmenuid); /* determine user access types */ link usrsetup; /* subset sysdata.pmenu and create work.pmenu */ link sortpm; /* open pmenu file, get num obs and gen proc statement */ pm1=open(dsname,'input'); numobs=attrn(pm1,'nobs'); oldsort=.; call set(pm1); frc=fetchobs(pm1,1); if menusort gt 0 then do; text='proc pmenu cat=work.invest;'; link subtext; end; /* loop and generate the menu and item statements */ do i=1 to numobs; call set(pm1); frc=fetchobs(pm1,i); if frc then; if menusort ne oldsort then do; text='menu '||trim(menu)||';'; link subtext; end; select(menucall); when('') do; text="item '"||trim(item)||"' selection="||trim(slec)||';'; link subtext; end; otherwise do; text="item '"||trim(item)||"' menu="||trim(menucall)||';'; link subtext; end; end; oldsort=menusort; end; /* loop and generate the selection statements */ do i=1 to numobs; call set(pm1); frc=fetchobs(pm1,i); if frc ne 0 then do; msg1='Unable to fetch record '||trim(put(i,4.))||' of work.pmenu.'; msg2=sysmsg(); msg3=''; link usermsg; _status_='H'; if pm1 gt 0 then pm1=close(pm1); return; end; select(menucall); when('') do; text='selection '||trim(slec)||" '"||trim(slec)||"';"; link subtext; end; otherwise; end; end; /* run all generated source code */ submit continue; run; quit; endsubmit; if pm1 gt 0 then pm1=close(pm1); RETURN; SORTPM: if exist(dsname) then drc=delete(dsname); clause="pmenu='"||pmenuid||"' and access in("||access||')'; put clause=; pm0=open('sysdata.pmenu(where=('||clause||"))'",'input'); src=sort(pm0,'pmenu menusort','/output='||dsname); if src ne 0 then do; msg1='Unsuccessful sort of systdata.pmenu.'; msg2=sysmsg(); msg3=''; link usermsg; _status_='H'; end; if pm0 gt 0 then pm0=close(pm0); RETURN; SUBTEXT: if text ne '' then do; call symput('text',text); submit continue; &text endsubmit; end; RETURN; USERMSG: call symput('msg1',msg1); call symput('msg2',msg2); call symput('msg3',msg3); call display('catlg.utility.usermsg.program'); RETURN; USRSETUP: clause="userid='"||userid||"'"; ua=open('sysdata.useracc(where=('||clause||"))'",'input'); do until(frc ne 0); frc=fetch(ua); if frc=0 then do; acctype=getvarc(ua,varnum(ua,'acctype')); if access ne '' then access=access||",'"||trim(acctype)||"'"; else access=access||"'"||trim(acctype)||"'"; end; end; if ua gt 0 then ua=close(ua); RETURN; ******************************************************************************* /* MAIN.FRAME SCL */ length pmenuid $20 slec $10; INIT: control always; pmenuid='PMENU0'; RETURN; MAIN: slec=word(1); /* pass the selection to pmenuexe.scl for execution */ if slec ne '' then call display('catlg.system.pmenuexe.scl',pmenuid,slec); RETURN; ******************************************************************************* /* PMENUEXE.SCL */ entry pmenuid $20 slec $10; length prog $80 msg1-msg3 $50; INIT: dsname='work.'||trim(pmenuid); pm=open(dsname,'input'); if pm le 0 then do; msg1='Unable open pmenu dataset '||dsname; msg2=''; msg3=sysmsg(); link usermsg; return; end; lrc=locatec(pm,varnum(pm,'slec'),slec); if lrc le 0 then do; msg1='Unable to locate selection '||slec; msg2='in '||dsname||'.'; msg3=sysmsg(); link usermsg; if pm gt 0 then pm=close(pm); return; end; if lrc gt 0 then prog=getvarc(pm,varnum(pm,'prog')); if prog='' then do; msg1='No program specified for selection '||slec; msg2='in '||dsname||'.'; msg3=sysmsg(); link usermsg; if pm gt 0 then pm=close(pm); return; end; /* close the pmenu dataset and execute the command/program */ if pm gt 0 then pm=close(pm); call display(prog); RETURN; USERMSG: call symput('msg1',msg1); call symput('msg2',msg2); call symput('msg3',msg3); call display('catlg.utility.usermsg.program'); RETURN; *******************************************************************************