Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Function to include source into a rexx

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Dec 23, 2010 12:08 am    Post subject: Function to include source into a rexx
Reply with quote

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
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Dec 23, 2010 12:14 am    Post subject: Reply to: include function
Reply with quote

nobody wrote it because TSO/E REXX does not support it!
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Dec 23, 2010 12:18 am    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Dec 23, 2010 12:42 am    Post subject: Reply to: include function
Reply with quote

Quote:
Surely it is possible

since You are so sure post the reference
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Dec 23, 2010 12:49 am    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Dec 23, 2010 12:54 am    Post subject: Reply to: include function
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Dec 23, 2010 1:10 am    Post subject: Reply to: include function
Reply with quote

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
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Thu Dec 23, 2010 1:16 am    Post subject:
Reply with quote

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
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Dec 23, 2010 1:20 am    Post subject:
Reply with quote

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
View user's profile Send private message
Josh Keller

New User


Joined: 08 Oct 2007
Posts: 36
Location: Columbia, SC

PostPosted: Thu Dec 23, 2010 2:22 am    Post subject:
Reply with quote

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
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Dec 23, 2010 2:30 am    Post subject:
Reply with quote

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
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Dec 23, 2010 2:32 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Dec 23, 2010 3:54 am    Post subject:
Reply with quote

Hello,

Quote:
I meant to type Interpreter.
Yup, and i'm sure what almost all of us read icon_smile.gif

There probably is, but i suspect it would be IBM proprietary information. . .
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Dec 23, 2010 4:15 am    Post subject: Reply to: include function
Reply with quote

if You want to have an idea of how a rexx interpreter works You can have a look at the sources starting from here

http://sourceforge.net/projects/oorexx/

http://sourceforge.net/projects/regina-rexx/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us