You need to unquote the command. Here's an example that should work.
/*REXX*/                                    
cmd.1='d a,l'                               
cmd.2='d t'                                 
cmd.3='d d,t'                               
"CONSOLE ACTIVATE"                          
do x=1 to 3                                 
"CONSOLE SYSCMD("cmd.x")"                   
MCODE=GETMSG('RESMSG1.','SOL',,,60)         
IF RESMSG1.0 = 0 THEN DO                    
  SAY 'NO MESSAGE RETURNED'                 
  RETURN                                    
END                                         
ELSE                                        
  DO I=1 TO RESMSG1.0                       
    SAY RESMSG1.I                           
  END                                       
  resmsg1.0=0                               
end                                         
"CONSOLE DEACTIVATE"                        
exit                                        

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On Behalf Of 
Victor Zhang
Sent: Monday, October 18, 2010 8:31 AM
To: IBM-MAIN@bama.ua.edu
Subject: Rexx command to execute MVS console commands

Hi,
I want to write a rexx program to execute several mvs commands serially.
I have tested following:
/*REXX*/                                             
"CONSOLE ACTIVATE"                                   
"CONSOLE SYSCMD(D U,,,A20,1) CART('DA01')"           
MCODE=GETMSG('RESMSG1.','SOL','DA01',,120)           
IF RESMSG1.0 = 0 THEN DO                             
  SAY 'NO MESSAGE RETURNED'                          
  RETURN                                             
END                                                  
ELSE                                                 
  DO I=1 TO RESMSG1.0                                
    SAY RESMSG1.I                                    
  END                                                

It worked, but the problem is CONSOLE SYSCMD(mvscmd) must be code with exact 
mvs command, ie. mvscmd must be any specific mvs command, it can't be 
substituted by a string variable.
What I want to do is:
read an input file which contains several mvs cmd.
then run CONSOLE SYSCMD(syscmd) where syscmd is the cmd I read from input file 
then display cmd output.

Anyone has the experience?

Regards
Victor

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at 
http://bama.ua.edu/archives/ibm-main.html
This e-mail may contain confidential or privileged information. If
you think you have received this e-mail in error, please advise the
sender by reply e-mail and then delete this e-mail immediately.
Thank you. Aetna   

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to