I just coded this, except I had to hard-code the DD name. The REXX code looks like:
get_job_step: procedure address TSO /* Call JCLEXECI to get JCL exec step info in dd JCLEXECI */ "ALLOC DD(JCLEXECI) RECFM(F) LRECL(80) NEW DELETE" "CALL *(JCLEXECI)" "EXECIO * DISKR JCLEXECI (STEM jclexeci. FINIS" "FREE DD(JCLEXECI)" parse var jclexeci.1 job_step_name +8 proc_step_name +8 if proc_step_name \= '' then step_name = proc_step_name else step_name = job_step_name return step_name Now I know that people seeing this are going to say, why can't I use STORAGE to get the step name from the control blocks? That works on the mainframe, and in Micro Focus COBOL, but not in REXX under Micro Focus. My theory is that when you access the PSA at address 0 in a MF COBOL program it isn't *really* accessing memory at page 0, it is mapping it to the emulated PSA somewhere else in memory. But that memory redirection doesn't work in REXX, because it isn't operating in the mode that does that kind of thing. For cases like this Micro Focus provides an API to get the actual PSA address... ...which you can't call, because of the original problem. The only way to call something is TSO CALL, which is one-way. -----Original Message----- From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of Steve Thompson Sent: Tuesday, August 15, 2023 3:45 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: How can a REXX data stack pass information from a program? Then how about the calling program passing the communications file name [DSN or whatever] and then have the COBOL program allocate, and open that for output, then CLOSE and "free" it. The caller, upon return of the COBOL program should now have access to the string. I recall doing things like this with W/NT 40 and Fujitsu COBOL. I had three different COBOL compilers back then, and the one that seemed to be the best implemented was FJ COBOL. Steve Thompson On 8/15/2023 4:21 PM, Schmitt, Michael wrote: > I can do dynamic DD names in z/OS COBOL using a trick*, but that trick > doesn't work in MF COBOL. There's no documented way to do a dynamic DD > name**. Dynamic *file names* yes, but not DD names. > > But dynamic file names are native files (e.g. C:\Data\Catalog\File.DAT) not > catalogged MVS data set names. And a REXX exec can determine allocated MVS > data set names, but not the associated native file name! > > > (I think the real question is why doesn't the COBOL language allow for > logical files names (what you ASSIGN to) that aren't known at compile time?) > > > * passing the FD name to a nested program that zaps the DD name in the DCB > > ** A MF COBOL program can get access to its version of a DCB but that > structure doesn't include the DD name > > > ---------------------------------------------------------------------- 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