Calling REXX external function from Cobol



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: Calling REXX external function from Cobol

Postby ManfredU » Sun Feb 12, 2012 4:52 pm

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/ :-)
ManfredU
 
Posts: 4
Joined: Fri Feb 10, 2012 11:25 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling REXX external function from Cobol

Postby enrico-sorichetti » Sun Feb 12, 2012 7:55 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Calling REXX external function from Cobol

Postby BillyBoyo » Sun Feb 12, 2012 9:03 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Previous

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post