We help IT Professionals succeed at work.

Macro's

sonmic
sonmic asked
on
Hi,

When i execute the code below, and the file &best3 does not exist, the checkFile goes in Abort.
When i execute the program during the year, i have to set a parameter "&Int"  to "No" because the file &Best3 does not exist.
How can i use that parameter in the code below.
The program should continue when the file does not exist.

Tx
%MACRO checkFile (file = ) ;
    %IF %SYSFUNC(fileexist(&file)) = 0 %THEN %DO ;
	%PUT "* File " "&file" " not found. *" ;
	%ABORT ;
	%END ;
%MEND checkFile ;
%checkFile(file = &best1) ;
%checkFile(file = &best2) ;
%checkFile(file = &best3) ;
%checkFile(file = &best4) ;
%checkFile(file = &best5) ;

Open in new window

Comment
Watch Question

%MACRO checkFile (file = ) ;
    %IF %SYSFUNC(fileexist(&file)) = 0 OR "&Int" = "No" %THEN %DO ;
      %PUT "* File " "&file" " not found. *" ;
      %ABORT ;
      %END ;
%MEND checkFile ;
%checkFile(file = &best1) ;
%checkFile(file = &best2) ;
%checkFile(file = &best3) ;
%checkFile(file = &best4) ;
%checkFile(file = &best5) ;

Explore More ContentExplore courses, solutions, and other research materials related to this topic.