There is too much misleading information. This isn't a simple question about 
passing data between REXX and Cobol.

Passing between languages is never consistent. I can't remember about Cobol but 
Micro Focus Cobol was written in C which makes me suspect it passes / receives 
by value (a copy of) to discourage you from passing data back to the caller 
using this method. Length, type and other factors come into play so great care 
must always be taken when using this method to return data. My guess is that 
calling MF Cobol will always force by value as the first call.

You said LINKMVS is not available but I'm wondering why if this is TSO REXX. 
Does ADDRESS LINKMVS fail because environment not available?

The TSO stack is not a preferred solution because other commands and programs 
can pull from it at the same time. You've thrown Micro Focus into the mix which 
I can't say how it interacts with the TSO stack.

>From REXX, outtrap is much more reliable because it captures messages. It's 
>been too many years, but I vaguely recall that Cobol programs running under 
>TSO translate display upon console to TSO terminal. You can test this. Adding 
>MF Cobol may change everything.

TSO ALLOC DDN(MYDD) DSN(*) uses the TSO terminal. Simply code MYDD in the cobol 
FD instead of relying on SYSPUNCH> Output goes to the TSO terminal but I'm 
vaguely recalling that OUTTRAP might not capture it. You'll need to test it.

If you're running under ISPF, then use ISPEXEC VPUT / VGET. I personally would 
use IRXEXCOM and go directly to REXX but you'll need to feel comfortable doing 
this.

TSO ALLOC DDN(MYDD) UNIT(VIO) is also a possibility if you want to memory. 


  
    On Tuesday, August 15, 2023 at 02:26:53 PM PDT, Schmitt, Michael 
<michael.schm...@dxc.com> wrote:  
 
 The exec can't access SDSF, and I'm not sure it is possible for it to access 
the spool equivalent. It basically restricted to what's available in address 
TSO.

-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of Bob 
Bridges
Sent: Tuesday, August 15, 2023 4:20 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: How can a REXX data stack pass information from a program?

I'm coming late to this thread, and this solution (if it even works) is
really going around your elbow to get to your thumb, but:

1) You said the REXX exec is running in batch, right?
2) Call the COBOL program
3) The COBOL program displays the value to any DD
4) The exec invokes the SDSF interface, looks up the job it's running under,
and watches that DD until the value appears.

Not sure that'd work; I haven't thought through the details.  But if it
doesn't, maybe you could call the COBOL program in a previous step and THEN
your exec could look up the value in SDSF.

(I probably should have sent this to you off-line, to avoid embarrassing
myself.)

---
Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313

/* ...this is a certain truth, that nothing ever did, or can have the least
desire or tendency to ascend to heaven, but that which came down from
heaven; and therefore nothing in the heart can pray, aspire, and long after
God, but the Spirit of God moving and stirring in it.  -William Law
(1686-1761), _The Spirit of Prayer_ */

-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of
Schmitt, Michael
Sent: Tuesday, August 15, 2023 13:49

The z/OS TSO REXX User's Guide says
(https://www.ibm.com/docs/en/zos/2.4.0?topic=stack-using-data):

The data stack [...] can pass information between REXX execs and other types
of programs in a TSO/E or non-TSO/E address space.

Because of the data stack's unique characteristics, you can use the data
stack specifically to [...] Share information between an exec and any
program running in MVS(tm).

My question is how can the data stack be used to share information between
an exec and a program? I don't see this in either the User's Guide or
Reference.

What I'm trying to do is pass an 8 character field from a COBOL program to a
calling exec. The constraints are:

  *  Exec is running in the TSO/E address space in a batch job
  *  ISPF may not be used
  *  COBOL program is called via TSO CALL
  *  No assembler
  *  No REXX programming services (e.g. IRXEXCOM)
  *  Any calls to other programs would also be under the same constraints.

So the calling path is PGM=IKJEFT01 > REXX exec > TSO CALL *(program) >
COBOL program

Please don't say, run using ISPF, it's easy! Or, call program with LINKMVS,
it's easy! Or, use the IRXECOM variable access routine, it is easy! I know
it is, but it can't be used in this case. It has to be the way I describe.
Hence my problem.

Trying a cheat like "call some other program to gain the address of a REXX
variable" won't work because it would hit the same constraint; it can't be
called by LINK or ATTACH, so the parm is one-way, and would have no way to
pass back the address. Nor will it work to try to pass back an address from
the COBOL program in a return code; it will get truncated.

(I suppose one option is to call the COBOL program multiple times, passing
back the data as a return code one or two bytes a time, but if it came to
that I have a better last-resort work-around.)

The User's Guide is hinting that the data stack can be used to pass data to
or from another program. So how can a COBOL program put data on the data
stack?

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
  

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to