IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Invoking REXX from SAS


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Fri May 14, 2010 3:59 pm
Reply with quote

Hi,

I am trying to invoke REXX program from SAS and I tried with the simple one below.

JCL:

Code:

//STEP1    EXEC SAS                               
//SASREXX  DD DSN=Userid.pds,DISP=SHR 
//SYSPRINT DD SYSOUT=*                           
//SYSOUT   DD SYSOUT=*                           
//SYSTSIN  DD DUMMY                               
//SYSTSPRT DD SYSOUT=*                           
//SYSIN    DD *                                   
OPTIONS REXXMAC REXXLOC=SASREXX;                 
exampl1;                                         
//* 


exampl1 REXX pgm:

Code:

/***   REXX   */
say 'SIMPLE ONE'


and i got the output for the same in SYSTSPRT as 'SIMPLE ONE'

But when I tried to execute a REXX program which has TSO commands, I am getting below error.

JCL:

Code:

//STEP1    EXEC SAS                                       
//SASREXX  DD DSN=userid.pds,DISP=SHR           
//SYSPRINT DD SYSOUT=*                                     
//SYSOUT   DD SYSOUT=*                                     
//SYSTSIN  DD DUMMY                                       
//SYSTSPRT DD SYSOUT=*                                     
//SYSIN    DD *                                           
OPTIONS REXXMAC REXXLOC=SASREXX;                           
EXAMPL2 'USERID.TEST.SEN1';                                 
//*                                                 


Program EXAMPL2:

Code:

/***   REXX   *****/
trace i                               
parse upper arg dsname                 
ADDRESS TSO "DELETE" dsname "NONVSAM"


error log:

Code:

 13 *-* parse upper arg dsname                             
    >>>   "'USERID.TEST.SEN1'"                               
 14 *-* ADDRESS TSO "DELETE" dsname "NONVSAM"               
    >L>   "DELETE"                                         
    >V>   "'USERID.TEST.SEN1'"                               
    >O>   "DELETE 'USERID.TEST.SEN1'"                         
    >L>   "NONVSAM"                                         
    >O>   "DELETE 'USERID.TEST.SEN1' NONVSAM"                 
    +++ RC(-3) +++                                         
 15 *-* /*   



To me, it looks like the TSO command is not recognized. I refered some manuals and tried to establish the TSO environment by 'ADDRESS TSO' command. I guess I am missing something here. Can someone guide me here.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri May 14, 2010 4:06 pm
Reply with quote

You can only execute TSO commands in REXX when REXX is invoked under TSO, end of discussion!
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Fri May 14, 2010 4:21 pm
Reply with quote

Hi Prino,
Thanks, Does this mean I cannot achieve what i am trying to do.

The purpose of this query is:
As of now, the REXX programs which has TSO command was executed in QMF. Now the plan is to migrate from QMF to SAS. So I am trying to use those same 'REXX programs with TSO commands' to invoke them from SAS environment.

Could you please provide your suggestion on this.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 14, 2010 4:22 pm
Reply with quote

Address <some environment>
means that before calling the rexx interpreter somebody has established the proper <environment>

Address TSO is valid under tso because TSO before calling rexx ha setup things properly
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri May 14, 2010 5:10 pm
Reply with quote

I'll have to confirm that this would work, but ...

I'd invoke SAS from TSO. Then, invoke the REXX.

Follow-up:

Yeah, that worked for me...
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri May 14, 2010 6:59 pm
Reply with quote

superk wrote:
I'll have to confirm that this would work, but ...
I'd invoke SAS from TSO. Then, invoke the REXX.
Follow-up:
Yeah, that worked for me...

Yep, that's the only way to do it.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri May 14, 2010 10:43 pm
Reply with quote

The following might enlighten you in using SAS and TSO :

SAS® 9.2 Companion for z/OS®
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Wed May 19, 2010 11:47 am
Reply with quote

Thanks Expat, Superk and Peter.

Unfortunately I don't know SAS (trying to help SAS guys in my team here on how to invoke the REXX program which has TSO commands, in a SAS environment).

I went through the SAS manual suggested by Peter. Sorry that I am not able to find more info with respect to my query. Could you please provide me more info in

Quote:

I'd invoke SAS from TSO. Then, invoke the REXX.
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Fri May 21, 2010 2:46 pm
Reply with quote

From one of Robert's post,
Quote:

SAS provides a CLIST library as part of their installation process, and that CLIST library contains code to invoke SAS from TSO. The SAS 9.1 and 9.2 libraries have procedure CLSTW0 to invoke SAS and set up the appropriate environment first. If you really want to invoke SAS from TSO, talk to your site support group about how to access CLSTW0 -- they may move the SAS library into your site's standard TSO library concatenation, or just move the member to a library. For testing, you could issue 'exec sas.hlq.CLIST(CLISTW0)' from ISPF option 6 or a TSO READY prompt


Could someone guide me whether this is the only way to accompolish my task.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri May 21, 2010 4:39 pm
Reply with quote

SAS tech note TS-738 talks about calling external routines from within SAS. There is also the CALL MODULE SAS command. You can research both of these at SAS Support
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Tue May 25, 2010 10:16 am
Reply with quote

Hi,

Thanks all for your info.

I referred this link
I guess this is what Superk and Expat mentioned. This is working fine for me when i tried to execute a REXX program which has TSO commands.

But when I tried to execute a REXX program which invokes an ISPF edit macro, it is giving me RC-3. Below are the info:

JCL:

Code:

//STEP1    EXEC PGM=IKJEFT01,DYNAMNBR=50 
//SYSPROC  DD DISP=SHR,DSN=XXX.ISPF.CLIST
//SYSTSPRT DD SYSOUT=*                   
//SASREXX  DD DISP=SHR,DSN=myrexx.EXEC   
//SYSTSIN  DD *                           
  SAS O('REXXMAC')                       
/*                                       
//SYSIN    DD *                           
  rexxpgm1 hlq.ps;                     
/*                                       
//SYSOUT   DD SYSOUT=*                   


pgm:
rexxpgm1:
Code:

ADDRESS ISPEXEC                                 
ARG FN                                           
"ISPEXEC EDIT DATASET("!!FN!!") MACRO(macronam)"


SYSTSPRT msg:
Code:

READY                                                     
  SAS O('REXXMAC')                                         
    17 *-* "ISPEXEC EDIT DATASET("!!FN!!") MACRO(macronam)"
       +++ RC(-3) +++                                     
READY                                                     
END                                                       


Could some one guide me whether I can also use the same method which is described in the link to call a REXX program with ISPF edit macro or REXX program with SKELS?

I am also trying to look out for infos from Robert's post on TS-738 though.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Tue May 25, 2010 6:53 pm
Reply with quote

You can only issue ISPF edit macros from within the ISPF editor. You can only start the ISPF editor from within ISPF.

Add the DD statements that ISPF needs to your JCL. In the SYSTSIN, issue:
Code:
ISPSTART CMD(your cmd)
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed May 26, 2010 12:20 am
Reply with quote

senjay, just for the record, SAS fully supports the use of ISPF Services directly, AFAIK it has for quite a long time. I'm not familiar enough with SAS to know with certainty if you can write an ISPF Edit Macro in it (like you can with other high-level languages).
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Thu May 27, 2010 3:42 pm
Reply with quote

Hi Pedro,

I think I don't understand your reply. Assume this case. In SYSIN, i would be executing the below in the same order for the JCL which i mentioned in my above post (invoking SAS from TSO and then executing REXX)
a) execute a SAS program
b) then execute a REXX program which invokes ISPF editor macro
c) then execute a REXX program which has TSO commands
d) then execute a SAS program

If I am giving the ISPSTART CMD(my cmd), i think you ask me to give like ISPSTART CMD(rexxpgm1 hlq.ps macronam)

where
rexxpgm1 - is the REXX program which invokes ISPF edit macro macronam and hlq.ps is the PS file which is the input to the program.

If i am coding like this i would code a, c, d, steps in SYSIN and b in SYSTSIN. I am sure I got your reply wrong. can you please clarify me.

Hi Superk,

Quote:

I'm not familiar enough with SAS to know with certainty if you can write an ISPF Edit Macro in it


I am trying to explore the opportunities to see whether the already existing ISPF edit macros which were used in QMF, can be used in SAS now with little/no modifications. As I do not know about SAS, I prefer not to look whether the ISPF edit macros can be written in SAS, atleast as of now icon_sad.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu May 27, 2010 5:41 pm
Reply with quote

the whole thread just shows a lack of the basic understandings of ISPF...

the proper approach would be ...
start ISPF first so the proper environment will be set up
from there ( seen it done it ) You can invoke any application You want because the main ISPF environment has been setup

... invoke SAS , which will hopefully setup it' s environment ( Address SAS )
... invoke the ISPF EDITOR ( Address ISREDIT )
... invoke anything else You want
... DB2, SMPE, QMF, add as many as You want as long as they are REXX scriptable

that' all, simple and crystal clear icon_cool.gif

P.S. ( almost )
Quote:
I'm not familiar enough with SAS to know with certainty if you can write an ISPF Edit Macro in it (like you can with other high-level languages).


Your familiarity with SAS has nothing to do with the possibility...
You just need to be familiar with the manuals and read about the interfaces supported
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top