How can we call REXX from SAS?

Time Sharing Option, Interactive System Productivity Facility and REstructured eXtended eXecutor

Moderator: mickeydusaor

Previous topicNext topic

Topic Author
Ranveer Singh
New Member
Posts: 5
Joined: Thu Oct 09, 2014 9:51 am

How can we call REXX from SAS?

Post by Ranveer Singh » Fri Feb 05, 2016 4:52 pm

Hi,

Can we call REXX routine from SAS, does anyone can share some example of doing it?

Please consider the following snippets:

Code: Select all

/* REXX */ 
  Arg userprm
  Say 'Parameter passed is' userprm
  Return 0 

JCL for SAS:

Code: Select all

//SAS      EXEC SAS 
//SYSTSPRT DD SYSOUT=* 
//SASREXX  DD  DISP=SHR, 
//             DSN=AB1234.EXEC  
//FILES    DD  * 
AB1234.COBOL                        PQ 
AB1234.EXEC                         ST 
//SYSIN    DD * 
OPTIONS REXXMAC; 
DATA FILES; 
   INFILE FILES; 
   INPUT @2  FILENAME $12. 
         @23 SYSNAME  $4. 
; 
DATA _NULL_; 
SET FILES; 
DO; 
  PUTLOG FILENAME; 
  SASHELLO FILENAME, SYSNAME; 
END; 
PROC PRINT DATA = FILES; 

I expected two messages like this:

Code: Select all

Parameter passed is AB1234.COBOL, PQ 
Parameter passed is AB1234.EXEC,  ST 

But what I get is:

Code: Select all

Parameter passed is FILENAME, SYSNAME 
Please guide.



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1338
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: How can we call REXX from SAS?

Post by Robert Sample » Fri Feb 05, 2016 6:30 pm

If you are using the interpreted REXX, then I don't see any way you could call REXX from SAS since there's nothing to call. If your site has the optional REXX compiler (which costs money), you can compile your REXX code and then call the compiled code just like SAS calls a COBOL program or any other compiled load module.




enrico-sorichetti
Global Moderator
Global Moderator
Posts: 881
Joined: Wed Sep 11, 2013 3:57 pm

Re: How can we call REXX from SAS?

Post by enrico-sorichetti » Fri Feb 05, 2016 7:17 pm

unless I am completely wrong the REXX gets called,

what is wrong is just the way of passing the parameters


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 8-)


Topic Author
Ranveer Singh
New Member
Posts: 5
Joined: Thu Oct 09, 2014 9:51 am

Re: How can we call REXX from SAS?

Post by Ranveer Singh » Mon Feb 08, 2016 1:50 pm

I had been looking for examples for this. If I find one will post here.



User avatar

vasanthz
Registered Member
Posts: 21
Joined: Tue Dec 06, 2016 1:06 am

Re: How can we call REXX from SAS?

Post by vasanthz » Thu Dec 15, 2016 3:33 am

Hello,

I can see the topic is pretty old, but I don't see straight forward technique on how to do this.
Here is a method as a proof of concept of calling REXX from SAS and passing parameters.
We can call REXX from SAS then do some REXX functions like check the existence of dataset or issue console commands and then pass the control back to SAS.

Code: Select all

//STEP1    EXEC SAS                             
//SASREXX  DD DISP=SHR,DSN=WELLS.REXX.PDS      
//SYSTSPRT DD SYSOUT=*                          
//SYSTSIN  DD DUMMY                             
//SYSIN    DD   *                               
 OPTIONS REXXMAC;                               
 %LET LOLZ_PARMZ = WELLS.LOLZ.PARAMETER;                 
 REXXLOLZ;                                      
/*             
Contents of WELLS.REXX.PDS(REXXLOLZ)

Code: Select all

/*REXX*/                                                    
ADDRESS SAS "DATA _NULL_; "                                 
"LOLZ_PARMZ = SYMGET('LOLZ_PARMZ');"                            
"CALL PUTEXEC('LOLZ_PARMZ',LOLZ_PARMZ);"                        
"RUN;"                                                                   
SAY 'THE PARAMETER BEING PASSED IS ' LOLZ_PARMZ;     
EXIT 
Output:

Code: Select all

THE PARAMETER BEING PASSED IS  WELLS.LOLZ.PARAMETER 
Hope it helps someone in the future.


Regards,
Vasanth.S


Topic Author
Ranveer Singh
New Member
Posts: 5
Joined: Thu Oct 09, 2014 9:51 am

Re: How can we call REXX from SAS?

Post by Ranveer Singh » Sat Dec 24, 2016 1:50 pm

vasanthz wrote:I can see the topic is pretty old, but I don't see straight forward technique on how to do this.
Here is a method as a proof of concept of calling REXX from SAS and passing parameters.
We can call REXX from SAS then do some REXX functions like check the existence of dataset or issue console commands and then pass the control back to SAS.
Thanks for the example vasanthz. This is helpful.



Previous topicNext topic

Return to “TSO, ISPF & REXX (Do you still do CLIST?!).”