Page 2 of 2

Re: Calling REXX external function from Cobol

PostPosted: Sun Feb 12, 2012 4:52 pm
by ManfredU
BillyBoyo wrote:Cobol can build the parameter block like that. On the Call, the RETURNING phrase could be used to receive the function value into a data-item defined in the Cobol programl.

This sounds promising.

BillyBoyo wrote:Without the assembler snippet I can't test it :-)

See http://homerow.net/asm/md5/ :-)

Re: Calling REXX external function from Cobol

PostPosted: Sun Feb 12, 2012 7:55 pm
by enrico-sorichetti
I think we are going round in circles and digging ourselves in deeper, somehow.

You are, not US, refusing any attempt to understand the REXX interface logic

Cobol can build the parameter block like that. On the Call, the RETURNING phrase could be used to receive the function value into a data-item defined in the Cobol programl.

show how please, note that the <even> token is not the length address but the length itself

This sounds promising.


no it does not...
REXX external functions
interact with the calling environment ( REXX on behalf of the calling script )
using the <structures>
000367          IRXEFPL                      REXX External Function           
 000368          IRXEVALB                     REXX Evaluation Block             
 000369          IRXSHVB                      REXX Shared Variable Block       


IRXEFPL for the mapping of the input parameter list
( the addresses of the variables are on a second <jump> )
IRXEVALB to return the result
IRXSHVB to <read> and <write> the variable content
( the external function is supposed to know if a parameter is <data> or the name of a variable
and in this case You are out of luck
given also the note in the source
*|            "Ctx"
*|                This is the name (NOT value) of a variable where the
*|                MD5 context is maintained.


so .... nooooo way

trying to interface a third party tool by tweaking the calling conventions of any HLL language is the safest road to unmantainable code

Re: Calling REXX external function from Cobol

PostPosted: Sun Feb 12, 2012 9:03 pm
by BillyBoyo
Maybe moot given the IRXSHVB:

01  parameter-block.
    05  variable-1-pointer usage pointer.
    05  variable-1-length comp pic 9(9).
    05  variable-2-pointer usage pointer.
    05  variable-2-length comp pic 9(9).
    05  variable-3-pointer usage pointer.
    05  variable-3-length comp pic 9(9).
    05  end-of-parameter-block pic x(8) value high-values.

set variable-1-pointer to address of variable-1
move length of variable-1 to variable-1-length
set variable-2-pointer to address of variable-2
move length of variable-2 to variable-2-length
set variable-3-pointer to address of variable-3
move length of variable-3 to variable-3-length

call some-module-name using parameter-block
                      RETURNING some-place-for-a-returned-value


The parameter-block will look exactly like that provided in the original link. For "C" convention the RETURNING can receive a value. OK, no need for REXX to be the same as the C convention for returning a value anyway.

If the assembler is not using IRXSHVB its abscence would not matter.

I'm not saying any of this is a good idea, or not. Having started by looking at the link to the parameter block, Cobol can do exactly how it is specified in the link. Then call with the parameter block. The called program could interrogate/amend the storage in the Cobol program, hopefully respecting the lengths.