Calling specific functions in an external Rexx script

I have a Rexx script that works autonomously, and I want to use another Rexx script to call certain functions inside it. I know that I can call both the external Rexx external file and the internal Rexx functions with call , but can I call one function inside the external script? The following example illustrates what I want to do:

 /* REXXA */ say 'hello' run_test: say 'test' 

...

 /* REXXB */ call 'REXXA' /* will say both 'hello' and 'test' */ 

How can I change REXXB to say only β€œtest”?

EDIT: Further research shows that I could look for RxFuncAdd - can anyone confirm if this works with scripts for Rexx mainframes? Most of the links associated with it concerned DLLs ...

EDIT 2: Apparently not ... does anyone have any better ideas? RxFuncAdd routine not found

EDIT 3: I didn’t have to explain my requirements correctly, sorry that according to the comment in NealB's answer, I essentially want something similar to calling the "sin" function inside the "math" class. The code I'm writing is REXXB in the above example, and I want to change REXXA as little as possible.

+4
source share
3 answers

There is directly no way to address internal tags in another program.

My first reaction is that you have to slightly modify REXXA to add a wrapper function with the function code, something like

 /* REXX A */ arg a1 a2 a3 a4 a5 (etc.) select when a1 = 'SIN' call sin a2 a3 .... when a1 = 'COS' call cos a2 a3 .... end exit rc sin: return some equation involving a2 that I last saw about 33 years ago cos: return some equation involving a2 that I last saw about 33 years ago /* REXX B */ call 'REXXA' 'sin 85' 

However, REXX under TSO supports external functions and routines that can be written in many languages, including REXX. TSO / E REXX Reference Manual External functions and routines and function packages, the z / OS V11 flavor describes how to do this.

There is a note in the document about optional REXX compilation. If you don’t have one, you can find someone who has a license for it who could compile it for use with ALTLIB (no license required).

+6
source

cschneid has the right idea ... The following works in both TSO (z / os) and Windows ooRexx:

REXXA:

 /* REXXA */ parse source . as_a . if as_a = 'COMMAND' then say 'hello' run_test: say 'test' return 

REXXB:

 /* REXXB */ call 'REXXA' /* will say 'test' */ return 

At the TSO or Windows Comand: prompt, type REXXA and type both hello and test . REXXB input will print only test .

I have to admit that this requirement is a bit strange ...

+2
source

You may be able to use PARSE SOURCE to determine if you are called a standalone or other Rexx artist. I did not do this, but the documentation seems to indicate that this will work.

As for your later editing: Ah, you want to write the moral equivalent of a DLL in Rexx, several entry points, none of which are the main ones. I do not believe that there is a way to do this simply using Rexx on System z.

The only method that comes to mind is to have a primary entry point with which you pass the name of the actual function you want to execute, along with your arguments. Then the main entry point will call the specified function and return. Kludgy, sorry.

+1
source

Source: https://habr.com/ru/post/1389990/


All Articles