Date: Tue, 8 Jan 2002 11:43:00 -0500
Reply-To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Organization: MindSpring Enterprises
Subject: Re: Generating SCL-Entries with a string as content
Stephan:
There are quite a few ways.
Since it sounds like you what to create dynamic classes at the source level
at run-time, your users (if any) must have SAS/AF licensed.
If you are looking to simplify the generation of one or more static CLASS
scl sources, you might look into using macro.
Here is a sample to get you going.
Notes:
GenDoc guidelines suggest this naming convention
<classname>.class SCL source should be located in
<classname>class.SCL.
SAS/AF can not fwrite to a .SCL entry, hence the hack using source entry and
call build.
init:
newClass = 'work.dynamic.foobar.class';
newClassSourceEntry = tranwrd (newClass, '.class', 'class.source');
newClassSclEntry = tranwrd (newClass, '.class', 'class.scl');
lf = byte (10);
newClassSource =
'class ' || newClass || ' '
||lf|| 'extends sashelp.fsp.object;'
||lf|| 'declare num foo;'
||lf|| 'declare num bar;'
||lf|| 'endclass;'
;
* write the class SCL source to a SOURCE entry (because you can not fwrite
to a SCL entry);
fileref = 'DynClass';
rc = filename (fileref, newClassSourceEntry, 'CATALOG');
fid = fopen (fileref, 'O');
if fid then do;
i = 1;
do while (scan (newClassSource,i,lf) ne '');
line = scan (newClassSource,i,lf);
rc = fput (fid, line);
rc = fwrite (fid);
i ++ 1;
end;
rc = fclose (fid);
end;
* when build opens the SCL entry,
* copy the class SCL source from the SOURCE entry and compile it into the
CLASS entry using SAVECLASS;
call execcmd ('CLEAR TEXT; INCLUDE '||fileref||';SAVECLASS;END');
call build (newClassSclEntry);
rc = filename (fileref, ' ');
return;
rc=rc;
Richard DeVenezia
http://www.devenezia.com/downloads/sas/af/index.php
"Stephan" <skrause@dvd-systempartner.de> wrote in message
news:d447d7d1.0201080113.2aa12173@posting.google.com...
> Hello,
>
> does anybody of you know if there's a way to generate a new SCL-entry
> in SAS/AF, fill it with the content of a string and compile this or
> save it as class?
>
> Any hints are welcome.
>
> Have a nice day
>
> Stephan