Skip to content

Instantly share code, notes, and snippets.

@mainframed
Created November 30, 2026 21:56
Show Gist options
  • Select an option

  • Save mainframed/a09a662cdc3a2af72e2d66e8528308fe to your computer and use it in GitHub Desktop.

Select an option

Save mainframed/a09a662cdc3a2af72e2d66e8528308fe to your computer and use it in GitHub Desktop.
ssue an MVS or JES operator command through SDSF and print the response
/* rexx - issue an MVS or JES operator command through SDSF */
/* and print the response */
/* */
/* usage: opcmd D A,L */
/* opcmd *I J=12345 (JES3 inquiry) */
/* opcmd '$D J12345' (JES2 - quote it for the shell)*/
parse arg cmd
cmd = strip(cmd)
if cmd = '' then do
say 'usage: opcmd <operator command>'
exit 8
end
rc = isfcalls('ON')
isfdelay = 5 /* seconds to wait for the response */
isfcons = left(userid(), 6)'CN' /* EMCS console name (optional) */
/* double any quotes so the command survives the ISFEXEC string */
q = "'"
safe = ''
do while cmd <> ''
parse var cmd piece (q) cmd
safe = safe || piece
if cmd <> '' | right(arg(1), 1) = q then safe = safe || q || q
end
address SDSF "ISFEXEC '/"safe"' (WAIT"
xrc = rc
if xrc <> 0 then do
say 'ISFEXEC failed, rc='xrc
if symbol('isfmsg') = 'VAR' then say isfmsg
if symbol('isfmsg2.0') = 'VAR' then
do m = 1 to isfmsg2.0; say isfmsg2.m; end
end
if symbol('isfulog.0') = 'VAR' then
do i = 1 to isfulog.0
say isfulog.i
end
else
say '(no response captured - try a longer isfdelay)'
rc = isfcalls('OFF')
exit xrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment