|
View previous topic :: View next topic
|
| Author |
Message |
coveyb
New User
Joined: 26 Jan 2022 Posts: 1 Location: UK
|
|
|
|
I’m executing a simple rexx to issue an MVS command and receive the resulting messages into a stem variable using GETMSG.
The rexx looks like this;
| Code: |
/* rexx */
/* TRACE(R) */
Parse Arg command parm1 parm2
if parm2 = '' then input = command||','||parm1
else input = command||','||parm1||','||parm2
Address TSO 'CONSPROF SOLDISPLAY(NO) UNSOLDISPLAY(NO)'
Address TSO 'CONSOLE ACTIVATE'
/* Address TSO 'CONSOLE ACTIVATE(OPERPARM(ROUTCODE(1,2))' */
Address CONSOLE input
waittime = 120
getrc = Getmsg('msg.','SOL',,,waittime)
if getrc > 0 then do
Say 'COMMAND' input 'failed'
Address TSO 'CONSOLE DEACTIVATE'
return getrc
end
else Say 'COMMAND' input 'issued successfully'
waittime = 1;
Do While Getmsg('msg.','SOL',,,waittime) = 0
Do i = 1 to msg.0
Say msg.i
End
End
Address TSO 'CONSOLE DEACTIVATE'
Return
|
Depending on the command issued, GETMSG completes with RC=0 or RC=4.
If I issue command ‘£DU,LNES’, the output in SYSLOG is;
| Code: |
£DU,LNES
£HASP880 LINE4 UNIT=SNA,STATUS=ACTIVE/SYSK,DISCON=NO
£HASP603 L4.JR1 UNIT=SNA,STATUS=INACTIVE
£HASP603 L4.JT1 UNIT=SNA,STATUS=INACTIVE
£HASP603 L4.SR1 UNIT=SNA,STATUS=INACTIVE
£HASP603 L4.SR2 UNIT=SNA,STATUS=INACTIVE
£HASP603 L4.ST1 UNIT=SNA,STATUS=INACTIVE
£HASP603 L4.ST2 UNIT=SNA,STATUS=INACTIVE
£HASP880 LINE6 UNIT=SNA,STATUS=ACTIVE/SKEMAB,DISCON=NO
£HASP603 L6.JR1 UNIT=SNA,STATUS=INACTIVE
£HASP603 L6.JT1 UNIT=SNA,STATUS=INACTIVE
£HASP603 L6.SR1 UNIT=SNA,STATUS=INACTIVE
£HASP603 L6.SR2 UNIT=SNA,STATUS=INACTIVE
£HASP603 L6.ST1 UNIT=SNA,STATUS=INACTIVE
£HASP603 L6.ST2 UNIT=SNA,STATUS=INACTIVE
£HASP880 LINE7 UNIT=SNA,STATUS=ACTIVE,DISCON=NO
£HASP880 LINE8 UNIT=SNA,STATUS=ACTIVE,DISCON=NO
£HASP880 LINE9 UNIT=SNA,STATUS=ACTIVE,DISCON=NO
|
…and GETMSG completes with RC=0 and each £HASP603 message is retrieved.
If I issue command ‘£DU,LNES,ACT’, the output in SYSLOG is;
| Code: |
£DU,LNES,ACT
£HASP880 LINE4 UNIT=SNA,STATUS=ACTIVE/SYSK,DISCON=NO
£HASP880 LINE6 UNIT=SNA,STATUS=ACTIVE/SKEMAB,DISCON=NO
£HASP880 LINE7 UNIT=SNA,STATUS=ACTIVE,DISCON=NO
£HASP880 LINE8 UNIT=SNA,STATUS=ACTIVE,DISCON=NO
£HASP880 LINE9 UNIT=SNA,STATUS=ACTIVE,DISCON=NO
|
…and GETMSG completes with RC=4 and no messages are retrieved.
Typically, the messages I want to examine are the £HASP880 messages that describe whether lines are open to other LPARs, but they apparently cannot be retrieved by GETMSG.
Looking at the messages routing/descriptor codes, they are #/- and 1,2/4 for £HASP603 and £HASP880 respectively.
Thinking that routing codes 1 and 2 may route to the system console only, I’ve also tried 'CONSOLE ACTIVATE(OPERPARM(ROUTCODE(1,2))' with the same results.
Do you have any ideas or suggestions for what else to try?
The point of the rexx is to establish that jobs can be routed for execution on other LPARs, before actually submitting them.
Many thanks for your time. |
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2624 Location: Silicon Valley
|
|
|
|
From the GETMSG section of the REXX manual:
| Quote: |
Environment Customization Considerations:
...
Responses to commands sent through the network to another system might be affected as follows:
The responses might not be returned as solicited even if a CART was specified and preserved; UNSOLDISPLAY(YES) may be required.
If the receiving system does not preserve the extended console identifier, ROUTCODE(ALL) and UNSOLDISPLAY(YES) might be required to receive the responses. |
So, specify UNSOL or EITHER and perhaps wait for several seconds longer. Also, your CONSPROF statement might need to be specify for unsolicited messages. |
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 774 Location: Denmark
|
|
|
|
You might also have to introduce some retry mechanism like in ths sample:
| Code: |
/* rexx test os concole */
trace off
cc=ConsCmd('$d i','q')
say 'rc:' cc
say 'qn:' queued()
do queued()
parse pull r
say '->' r
end
exit 0
ConsCmd:
retry=20
wait =2
consname='@'Userid()
Call XTSO "Console deactivate"
Call XTSO "CONSPROF SOLDISP(NO) SOLNUM(400) UNSOLDISP(NO) UNSOLNUM(400)"
/* get response from command */
cc=XTSO("CONSOLE SYSCMD("arg(1)") CART('"consname"') name("consname")")
if cc<>0 then Return Quit(3,'Console failed rc' cc)
Do cn=1 to retry
oscmdr.0=0
cc = GETMSG('OSCMDR.','SOL',consname,,wait)
if cc>4 then Return Quit(4,'GETMSG error retrieving message, rc' cc)
if oscmdr.0=0 then Return Quit(3) /* no reponse */
do cmsgi=1 to oscmdr.0
queue oscmdr.cmsgi
end
End
Return Quit(0)
Quit:
Call XTSO "Console deactivate"
if arg(2)<>'' then say arg(2)
Return word(arg(1) 0,1)
XTSO: trace off; zz=outtrap(word(arg(2) '$.',1))
address tso arg(1);zz=outtrap('off');return rc |
However, I strongly recommend that you look at the REXX SDSF API, described in the SDSF User Guide (if I remember correctly) |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|