Include a file: Difference between revisions
Content added Content deleted
(Added Modula-3) |
|||
Line 737: | Line 737: | ||
The REXX Compiler for CMS and TSO supports a directive to include program text before compiling the program |
The REXX Compiler for CMS and TSO supports a directive to include program text before compiling the program |
||
<lang rexx>/*%INCLUDE member */</lang> |
<lang rexx>/*%INCLUDE member */</lang> |
||
===Including a file at time of execution=== |
|||
On the other hand, since REXX is a dynamic language, you can (mis)use some file IO and the INTERPRET statement to include another source file: |
|||
<lang rexx> |
|||
/* Include a file and INTERPRET it; this code uses ARexx file IO BIFs */ |
|||
say 'This is a program running.' |
|||
if Open(other,'SYS:Rexxc/otherprogram.rexx','READ') THEN DO |
|||
say 'Now we opened a file with another chunk of code. Let's read it into a variable.' |
|||
do until EOF(other) |
|||
othercode=ReadLn(other) || ';' |
|||
end |
|||
call Close(other) |
|||
say 'Now we run it as part of our program.' |
|||
interpret othercode |
|||
end |
|||
say 'The usual program resumes here.' |
|||
exit 0 |
|||
</lang> |
|||
=={{header|RPG}}== |
=={{header|RPG}}== |