How can we call REXX from SAS?

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

Moderator: mickeydusaor

Post Reply
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 »

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: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: How can we call REXX from SAS?

Post by Robert Sample »

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: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: How can we call REXX from SAS?

Post by enrico-sorichetti »

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

I had been looking for examples for this. If I find one will post here.
User avatar
vasanthz
Registered Member
Posts: 32
Joined: Tue Dec 06, 2016 1:06 am

Re: How can we call REXX from SAS?

Post by vasanthz »

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
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 »

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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

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