| Date: | Fri, 17 Nov 2000 16:14:59 GMT |
| Reply-To: | aratcliffe@CIX.COMPULINK.CO.UK |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | aratcliffe@CIX.COMPULINK.CO.UK |
| Organization: | CIX - Compulink Information eXchange |
| Subject: | Re: registration of MDDB |
|---|
In article <006301c04e3e$bfcbfe90$030ba8c0@resta.ee>, Rain.Oks@RESTA.EE
(Rain Oks) wrote:
> Is it possible to registrate MDDB in repository using SAS program, not
> using SAS EIS interface?
Hi Rain,
In V8 you can try the code that I've pasted to the end of this message. To
try my code, just make sure you have a c:\temp\eisreg_playarea, else
change the assignment of the libname in the code.
The code will register the SASHELP.PRDMDDB mddb in the repository at
"reposname". It will then remove the registration for the mddb, and then
delete the repository. You didn't ask for the latter two actions, but it
makes the demo complete!
Some items to note.
-- Run the program as an AF application, i.e. ==> AF C=lib.cat.entry.SCL
-- The macros are not necessary, but I find they help
-- I couldn't find a path through the EIS documentation to the resenv
class, but if you find it in the SAS explorer and right-click you'll get
the documentation for it. Among other things, it creates the EIS
environment for you and saves running your application with ==> RUNEIS
APPL=blah.blah.blah.AF
-- The 8.1 version of SAS/EIS has one or two non-optimal features
in it (classic British understatement), viz the need to terminate the EIS
environment and then re-start it before attempting the deletion of the
repository
Good luck
Hope this helps
-Andrew
============================================================
Andrew Ratcliffe ---- Ratcliffe Technical Services Limited
SAS Institute Registered Partner
Office: +44 (0) 1322-525672
Mobile: +44 (0) 7714-719206, (SMS email: aratcliffe@sms.genie.co.uk)
Fax: +44 (0) 870-050-9662
Web site: http://www.ratcliffe.demon.co.uk
============================================================
%macro putbox(string,w=1,char=*);
do;
dcl char string = trim(&string);
dcl num stringLength = length(&string);
dcl char hliner = repeat("&char"
,stringLength + 3 + (&w-1)*2
);
dcl char vliner = repeat("&char"
,&w-1
);
put ' ';
%do i = 1 %to &w;
put hliner;
%end;
put vliner string vliner;
%do i = 1 %to &w;
put hliner;
%end;
put ' ';
end;
%mend putbox;
/* Initialise the fatal error handler by
setting the location counter */
%macro fatalin;
%global __fatcnt;
%let __fatcnt = 0;
%mend fatalin;
%macro fatal(appmsg=);
do;
%let __fatcnt = %eval(&__fatcnt+1);
%putbox("FATAL ERROR&__fatcnt: %left(&appmsg)");
dcl num sysrc=sysrc();
dcl char sysmsg=sysmsg();
put sysrc= sysmsg= ' ' &appmsg;
put ' ';
put _all_;
put ' ';
/* branch to cause quick end of program */
call goto('system.other.fatal.scl');
end;
%mend fatal;
/* Establish resource environment */
DCL sashelp.mb.resenv
rid = _new_ sashelp.mb.resenv();
/* Get ID for instance of metabase class */
DCL sashelp.mb.metabase
mb = getnitemn(envlist('L'),'METABASE');
/* Initialise fatal error handler */
%fatalin;
INIT:
%putbox('EISREG entered',w=2);
/* Declare our subjects */
dcl char mddbLibName = upcase('sashelp');
dcl char fullMddbName = mddbLibName !! upcase('.prdmddb');
dcl char reposName = upcase('EISREG');
dcl num mbrc;
dcl char mbmsg;
/******************************************************************/
%putbox('libname allocation entered');
if libname(reposName,'c:\temp\eisreg_playarea') gt 0 then %fatal;
/******************************************************************/
%putbox('register Mddb entered');
mb._registerMddb(mbrc
,mbmsg
,reposName
,fullMddbName
);
put 'DEBUG: registerMddb: ' mbrc= mbmsg=;
if mbrc ne 0 then call putlist(mbrc,'registerMddb:mbrc',2);
/******************************************************************/
%putbox('deleteRepos entered');
mb._deleteData(mbrc
,mbmsg
,reposName
,fullMddbName
);
put 'DEBUG: deleteData: ' mbrc= mbmsg=;
if mbrc ne 0 then call putlist(mbrc,'deleteData:mbrc',2);
/* Word-around to make sure _delete works */
rid._term();
/* Establish resource environment */
rid = _new_ sashelp.mb.resenv();
mb = getnitemn(envlist('L'),'METABASE');
mb._delete(mbrc
,mbmsg
,reposName
);
put 'DEBUG: deleteRepos: ' mbrc= mbmsg=;
if mbrc ne 0 then call putlist(mbrc,'deleteRepos:mbrc',2);
/******************************************************************/
%putbox('EISREG ended',w=2);
RETURN; /* init */
|