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

ZOS Console commands through USS REXX?


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

New User


Joined: 24 Jun 2021
Posts: 2
Location: USA

PostPosted: Wed Nov 17, 2021 12:31 am
Reply with quote

Hello,
I'm trying to run a console commands like $DSPL through USS.
I thought that this should be possible either through built in USS shell through "tsocmd" or via REXX in USS. The following runs but I get no output? Any advice. ( I'm very new to the mainframe :] )

Code:
/* REXX */

CALL outtrap out.
    ADDRESS TSO
        "CONSOLE ACTIVATE,NAME("NEWCON")"
        "$DSPL"
do i=1 to out.0
    say out.i
end
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Nov 17, 2021 11:18 am
Reply with quote

The CONSOLE command does not use the mechanisms that outtrap relies on. There is no command response available to trap.

Use the GETMSG function to retrieve the command response. See www.ibm.com/docs/en/zos/2.1.0?topic=tef-getmsg#getmsg Search this forum for GETMSG examples.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 734
Location: Denmark

PostPosted: Wed Nov 17, 2021 1:41 pm
Reply with quote

Also, you must terminate the trapping by zz=OUTTRAP('OFF') before you can show the stem.
Back to top
View user's profile Send private message
jecsanb

New User


Joined: 24 Jun 2021
Posts: 2
Location: USA

PostPosted: Wed Nov 17, 2021 11:34 pm
Reply with quote

So I tried something like this

Code:
/* REXX */
ADDRESS TSO
    "CONSOLE ACTIVATE,NAME("NEWCON")"
    "$DSPL"
msg = GETMSG('out.','SOL')
do i=1 to out.0
    say out.i
end


And got this, so I'm not sure what is the proper way to call it. I also tried using the CART but I get the same result.

Code:
IRX0250E System abend code 0C4, reason code 00000017.
IRX0253E Abend in external function GETMSG.
     5 +++ msg = GETMSG('out.','SOL')
IRX0040I Error running ./test1.rexx, line 5: Incorrect call to routine






Pedro wrote:
The CONSOLE command does not use the mechanisms that outtrap relies on. There is no command response available to trap.

Use the GETMSG function to retrieve the command response. See www.ibm.com/docs/en/zos/2.1.0?topic=tef-getmsg#getmsg Search this forum for GETMSG examples.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Nov 18, 2021 9:18 am
Reply with quote

From www.ibm.com/docs/en/zos/2.1.0?topic=tef-getmsg#getmsg
Quote:
"You can use the GETMSG function only in REXX execs that run in the TSO/E address space."


Try running the same from TSO instead of USS.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Nov 18, 2021 10:44 pm
Reply with quote

Quote:
Try running the same from TSO instead of USS.

That is, try running it to make sure it works, to eliminate the possibility of some programming error instead of an environment problem.
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 REXX/CMS How to place command console... CLIST & REXX 4
Search our Forums:

Back to Top