/**********************************************************************/
edit test.program
source
/**********************************************************************/
file tempfile
end
end
/**********************************************************************/
edit test.scl
include tempfile
/**********************************************************************/
compile
end
/**********************************************************************/
/* Define the macro and the parameter */
%macro pgmtoscl(pgm=);
/* Edit the PROGRAM entry. */
edit &pgm..program;
/* Open the SOURCE window. */
source;
/* File source code to external file. */
file tempfile;
/* Exit the SOURCE window. */
end;
/* Exit the PROGRAM entry. */
end;
/* Create the SCL entry. */
edit &pgm..scl;
/* Include source code from external file. */
include tempfile;
/* Compile the SCL entry. */
compile;
/* Exit the SCL entry. */
end;
/* End the macro definition. */
%mend pgmtoscl;
/**********************************************************************/
%pgmtoscl(pgm=test)
/**********************************************************************/
data _null_;
infile datalines eof=lastrec;
input pgmname $;
call symput('PGMÕ||left(put(_n_,5.)),pgmname);
return;
lastrec:
call symput('N',left(put(_n_-1,5.)));
datalines;
program1
program2
program3
more data lines
;
/**********************************************************************/
%macro convert;
%do i=1 %to &n;
%pgmtoscl(pgm=&&pgm&i);
%end;
%mend convert;
/**********************************************************************/
file tempfile;
/**********************************************************************/
file tempfile replace;
/**********************************************************************/