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

REXX/CMS How to place command console output to variable?


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

New User


Joined: 07 Mar 2024
Posts: 2
Location: Russia

PostPosted: Wed Oct 23, 2024 9:05 pm
Reply with quote

Hello!
I try place the console output of a CMS command to variable. I need get a response of a TRANSFER command and extract a spoolid.
My sample:
Code:
/* */
'PIPE CMS TRANSFER userid RDR spoolid TO userid PRT ! VAR RESP.'
SAY SUBWORD(RESP.1,3,1)
EXIT

Please explain me, how to get the console output to a stack or to variable.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2146
Location: USA

PostPosted: Wed Oct 23, 2024 10:36 pm
Reply with quote

Why not to RTFM, or to google?

Code:
x = OUTTRAP('var.') /* trap output */
"LISTC" /* or any other command */
SAY 'The number of lines trapped is' var.0
x = OUTTRAP('OFF') /* stop trapping */
Do I = 1 To var.0
    Say var.I
End I
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Wed Oct 23, 2024 11:34 pm
Reply with quote

unfortunately the TS is working in a CMS environment running on z/VM
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 736
Location: Denmark

PostPosted: Thu Oct 24, 2024 12:13 am
Reply with quote

I haven't worked with CMS pipes, but I assume that you can write the response to a file, and the EXECIO that file to a stem?
Back to top
View user's profile Send private message
Naturalist

New User


Joined: 07 Mar 2024
Posts: 2
Location: Russia

PostPosted: Thu Oct 24, 2024 11:19 pm
Reply with quote

Thanks to everyone for the answers. I solved my problem a little differently:

Code:
'PIPE CP Q RDR ! STEM RESP.'
LAST = RESP.0
SAY RESP.LAST


The strange thing is that there is no obvious way to redirect a standard output.
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 Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts Help needed in automation cics transa... CLIST & REXX 1
Search our Forums:

Back to Top