#23 call rexx function from macro

open
nobody
None
5
2010-08-11
2010-08-11
Finn Skovgaard
No

I'm trying to call a user written rexx function ymd2base.rex from a the macro, but it cannot find the rexx program. If I do the same in a .rex, it works. I have my tools directory included in the system environment variables THE_MACRO_PATH, REGINA_MACROS and REXX_MACRO and Path. I use Regina Rexx. Here is a sample:

/* ftest.rex */
say ymd2base(20100202)
call ymd2base '20100202'
say result
'THE -b -p ftest.the'

/* ftest.the */
call ymd2base '20100202'
say result
say ymd2base(20100202)
'qquit'

Either type of call from ftest.the gives Error 43 - Routine not found. They work from ftest.rex. Help!

Discussion

  • LesK
    LesK
    2011-02-26

    Assuming THE/Regina resolves .rex files the same way THE/ooRexx does, then you should:
    1-Put the .rex program in a file that is in a folder pointed to by THE_MACRO_PATH, or
    2-Put it in the regular PATH (assuming Windows) and let the interpreter (ooRexx or Regina) find it BUT you should keep PATH folders and THE_MACRO_PATH folders isolated from each
    other. That is to say that neither path should include a folder that is in the other path.

    The reason for this is that, under Windows and ooRexx, THE invokes external functions as a
    SUBROUTINE if it exists in THE_MACRO_PATH. Thus the code can't programmatically determine if it *must* return an answer... it will never see itself invoked as a FUNCTION.

    If it isn't in THE_MACRO_PATH then the interpreter will find it and all will be well.

    Regina may be slightly different. You might have to experiment to see if its behavior is the same
    as what I saw and that Mark and ooRexx Developers explained to me on the RexxLA.org list.