View previous topic :: View next topic
|
Author |
Message |
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
Has anyone written an external function that will dynamically include source into a rexx program at execution time? Something like the #include function in C.
I scanned through the CBT files, and searched this forum and google and could not find anything. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
nobody wrote it because TSO/E REXX does not support it! |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
Surely it is possible. Just like TSO/E Rexx does not support VSAM, but there are external functions that make it possible. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
Surely it is possible |
since You are so sure post the reference |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Has anyone written an external function that will dynamically include source into a rexx program at execution time? |
What you could do is create the complete rexx "on the fly" and execute it . . .
Why would you believe that whoever wrote the rexx internals used everything from some other language(s) compiler(s)? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
if the rexx application is so convoluted then the best approach is to use the rexx compiler
which indeed provides the include function
as far as the possibility to include on the fly something at the source level,
I strongly confirm that external/internal/tangent noo way to do it
but if on the other side You are looking for some kind of preprocessor along the lines of the C preprocessor
#include
#define
#if / #ifdef
#else
#endif
there are a few around... PREPROCESSORS i said! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
follow on ...
the only standards compliant REXX which provides something similar to the include directive
is ooRexx ( Object Oriented Rexx ) available on the major PC platforms zLinux and zOS/USS
using in an OO structured rexx script the ::requires directive as per
Quote: |
The ::REQUIRES Directive
You use the ::REQUIRES directive when a program needs access to the classes and objects of another program. This directive has the following form:
::REQUIRES program_name
::REQUIRES directives are processed before other directives and the order of the ::REQUIRES directives determines the search order for the classes and routines defined in the named programs.
|
|
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
Perhaps you could include an EXECIO to retrieve the external source into a variable, then use the INTERPRET statement to "dynamically" invoke the contents of that variable?
"INTERPRET processes instructions that have been built dynamically by evaluating expression. The expression is evaluated and is then processed (interpreted) just as though the resulting string were a line inserted into the program (and bracketed by a DO; and an END;). Any instructions (including INTERPRET instructions) are allowed, but note that constructions such as DO...END and SELECT...END must be complete. For example, a string of instructions being interpreted cannot contain a LEAVE or ITERATE instruction (valid only within a repetitive DO loop) unless it also contains the whole repetitive DO...END construct. A semicolon is implied at the end of the expression during execution, if one was not supplied." |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
I tried looking for a manual on how the Rexx Interpret works, but I could not find anything.
I was assuming that the interpreter creates an internal table with each routine that it accesses. I was thinking that you could append the included routine to the table. That would give the exec 'addressibility' to the routine. Then when you reference the routine, it would find your included routine in the table.
But I am just taking a wild shot in the dark... |
|
Back to top |
|
|
Josh Keller
New User
Joined: 08 Oct 2007 Posts: 36 Location: Columbia, SC
|
|
|
|
You can call an external routine located in your SYSPROC libs.
As Enrico said, you'd need to have a preprocessor to expand your code into a new rexx which would become your exec.
I imagine a CM tool like Endevor could be setup with a REXX processor group that ran a custom preprocessor looking for #INCLUDE statements and expanding that code from common libraries before adding it to the SYSPROC libs.
From the manual:
INTERPRET processes instructions that have been built dynamically by
evaluating expression.
The expression is evaluated and is then processed (interpreted) just as
though the resulting string were a line inserted into the program (and
bracketed by a DO; and an END;).
Any instructions (including INTERPRET instructions) are allowed, but note
that constructions such as DO...END and SELECT...END must be complete.
For example, a string of instructions being interpreted cannot contain a
LEAVE or ITERATE instruction (valid only within a repetitive DO loop)
unless it also contains the whole repetitive DO...END construct.
A semicolon is implied at the end of the expression during execution, if
one was not supplied.
Example:
data='FRED'
interpret data '= 4'
/* Builds the string "FRED = 4" and */
/* Processes: FRED = 4; */
/* Thus the variable FRED is set to "4" */
Example:
data='do 3; say "Hello there!"; end'
interpret data /* Displays: */
/* Hello there! */
/* Hello there! */
/* Hello there! */ |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
Josh Keller wrote: |
You can call an external routine located in your SYSPROC libs.
As Enrico said, you'd need to have a preprocessor to expand your code into a new rexx which would become your exec.
I imagine a CM tool like Endevor could be setup with a REXX processor group that ran a custom preprocessor looking for #INCLUDE statements and expanding that code from common libraries before adding it to the SYSPROC libs.
From the manual:
INTERPRET processes instructions that have been built dynamically by
evaluating expression.
The expression is evaluated and is then processed (interpreted) just as
though the resulting string were a line inserted into the program (and
bracketed by a DO; and an END;).
Any instructions (including INTERPRET instructions) are allowed, but note
that constructions such as DO...END and SELECT...END must be complete.
For example, a string of instructions being interpreted cannot contain a
LEAVE or ITERATE instruction (valid only within a repetitive DO loop)
unless it also contains the whole repetitive DO...END construct.
A semicolon is implied at the end of the expression during execution, if
one was not supplied.
Example:
data='FRED'
interpret data '= 4'
/* Builds the string "FRED = 4" and */
/* Processes: FRED = 4; */
/* Thus the variable FRED is set to "4" */
Example:
data='do 3; say "Hello there!"; end'
interpret data /* Displays: */
/* Hello there! */
/* Hello there! */
/* Hello there! */ |
This is how I currently 'include' source code into my exec's but it would me nice if there were an external function to include the source at execution. |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
valyk wrote: |
I tried looking for a manual on how the Rexx Interpret works, but I could not find anything. |
I meant to type Interpreter. Is there a manual explaining the inner workings of the Rexx Interpreter? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I meant to type Interpreter. |
Yup, and i'm sure what almost all of us read
There probably is, but i suspect it would be IBM proprietary information. . . |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
Back to top |
|
|
|