Page 1 of 1

Explicitly execute as CLIST from REXX exec

PostPosted: Wed Jan 13, 2016 10:34 pm
by Steve Coalbran
I appologise in advance if this question is 'fuzzy' but I am not sure exactly in which area this falls, TSO or REXX.
I should probably know this by now but I can't remember having to know this before!...

Inside a REXX exec, how do I execute an external function IMplicitly as a CLIST?
ie.
in REXX (DRIVER)
/*REXX*/ TRACE "C"
ADDRESS TSO 
parms = "doe ray me so far lah tea doe" /* 'Sound of music' version! */
parms = TRANSLATE(parms,'_',' ')  /* has to be one string, no blanks */
/* I can do the EXPLICIT execution                                   */
"EX 'N472730.USER.EXEC(WRT)' 'W("parms")' CLIST " 
/* BUT I want to do the IMPLICIT execution, which of course fails    */
"%WRT 'W("parms")' CLIST "
/*                 ¯¯¯¯¯ unavailable on %invocation                  */
/* without the CLIST parm one gets a REXX error, even omitting W()   */
"%WRT"                                                                 
EXIT

and in CLIST (WRT)
PROC 0 W(77) 
CONTROL MAIN LIST MSG 
WRITE &W 
EXIT 

The last two REXX attempts both result in...
IRX0043I Error running WRT, line 1: Routine not found
WRT could be in SYSPROC or SYSEXEC, or worse, both, and different content in each.
I need to know the setting of the SEARCHDD to find out which in order to search the allocations If I need to specify the dataset name explicitly.
I see no way to trap this from HELP.
OR... am I missing something?...
Is there a way that I can IMplicitly call it as a CLIST?
(I tried /*CLIST*/ at the head of WRT! No way, no such luck (would've been nice Mike?)
/Steve

Re: Explicitly execute as CLIST from REXX exec

PostPosted: Wed Jan 13, 2016 11:10 pm
by Steve Coalbran
The title could equally well be...
IMplicitly execute as CLIST from REXX exec

Re: Explicitly execute as CLIST from REXX exec

PostPosted: Thu Jan 14, 2016 1:06 am
by Mickeydusaor
/*REXX*/
TRACE ?R
ADDRESS TSO

PARMS = "DOE RAY ME SO FAR LAH TEA DOE" /* 'SOUND OF MUSIC' VERSION! */
PARMS = TRANSLATE(PARMS,'_',' ') /* HAS TO BE ONE STRING, NO BLANKS */

"%WRT W("PARMS")"

"%WRT"
EXIT

Re: Explicitly execute as CLIST from REXX exec

PostPosted: Thu Jan 14, 2016 2:22 am
by NicC
Why not use the pools as you did with SAYNR/WRINR?
PARSE ARG saynrm                                                               
   saynra = 0                                                                   
   ADDRESS ISPEXEC "VPUT (SAYNRM) SHARED "                                     
   ADDRESS TSO "%WRINR"                                                         
   ADDRESS ISPEXEC "VGET (SAYNRA) SHARED "                                     
RETURN saynra

Re: Explicitly execute as CLIST from REXX exec

PostPosted: Thu Jan 14, 2016 2:26 am
by Pedro
This worked for me with both members in SYSPROC.
/* rexx */   
Address TSO 
"%wrt"       


PROC 0 W(77)         
CONTROL MAIN LIST MSG
WRITE &W             
EXIT                 


We have VB255 sysproc datasets, so I tried the WRT both as numbered starting in column 9 or as unnumbered starting in column 1. Both worked.

Re: Explicitly execute as CLIST from REXX exec

PostPosted: Thu Jan 14, 2016 11:10 am
by Steve Coalbran
Mickeydusaor wrote:"%WRT W("PARMS")"

for me gives..
     4 *-* PARMS = "DOE RAY ME SO FAR LAH TEA DOE" /* 'SOUND OF MUSIC' VERSION!
 */                                                                           
       >>>   "DOE RAY ME SO FAR LAH TEA DOE"                                   
                                                                               
     5 *-* PARMS = TRANSLATE(PARMS,'_',' ') /* HAS TO BE ONE STRING, NO BLANKS
*/                                                                             
       >>>   "DOE_RAY_ME_SO_FAR_LAH_TEA_DOE"                                   
                                                                               
     6 *-* "%WRT W("PARMS")"                                                   
       >>>   "%WRT W(DOE_RAY_ME_SO_FAR_LAH_TEA_DOE)"                           
     1 +++ PROC 0 W(77)                                                       
IRX0043I Error running WRT, line 1: Routine not found                         
       +++ RC(20043) +++

BUT both the driver and WRT are in SYSEXEC - esta el problèma?
I will try moving it
...[PAUSE]...
That works fine! Derrrr!?

Thanks to all!

Re: Explicitly execute as CLIST from REXX exec

PostPosted: Thu Jan 14, 2016 11:15 am
by Steve Coalbran
NicC wrote:Why not use the pools as you did with SAYNR/WRINR?

Hi Nic,
Yes, this is a version of SAYNR+WRINR I am working on.
I could VPUT & VGET (to save the pseudo-space-char translation) but that involves running under ISPF?
This is an attempt at a LITE version.

PS: goood that you took a moment out from the pizzas! Still working on a visit, financial constraints (y'know?!) :cry:

NOTE: I also tried using PUSH/QUEUE and a READ, thinking (naiavely that &READVAL might get the parm in WRT but, clearly different queues? :(

Re: Explicitly execute as CLIST from REXX exec

PostPosted: Thu Jan 14, 2016 11:47 am
by Steve Coalbran
Pedro wrote:This worked for me with both members in SYSPROC

Thanks Pedro - I had both in SYSEXEC and SYSPROC (same library).
I can foresee a problem of usability here though, If this is a generalized function then I cannot predict how people have their libraries organized as they have the facility to tailor their SYSPROC/SYSEXEC allocations.
To EXplicitly invoke WRT I could:
  • Trap the allocations
  • Check each SYSPROC and SYSEXEC library
  • Perform a SYSDSN('library(WRT)') for each
  • Stop at OK
  • Issue: "EX 'library(WRT)' 'W("parms")' CLIST "

Re: Explicitly execute as CLIST from REXX exec

PostPosted: Wed Feb 03, 2016 10:06 pm
by Pedro
I just remembered...

WRT is a CLIST. A CLIST should not reside in SYSEXEC. That is, you cannot call it by Address TSO "%WRT"; the system will go through the normal search order and if it is found in SYSEXEC, it will be explicitly called as an exec.