On Saturday, 03/14/2009 at 08:25 EDT, Kris Buelens 
<kris.buel...@gmail.com> wrote:

> /*******************************************************************/
> ERREXIT: /*  exit with retcode & errormsg                          */
> /*******************************************************************/
> address '' 'SUBCOM XEDIT'
> xedit=(rc=0)
> if xedit then address xedit 'COMMAND SET MSGM ON'
> do i=2 to 'ARG'()
> if xedit then address xedit 'COMMAND EMSG' 'ARG'(i)
> else say 'ARG'(i)
> end

Hmmm...  I thought we had stamped out this programming idiom several years 
ago when we introduced DMSCALLR.  Most people expect the above snippet to 
diplay the error in XEDIT if you're in XEDIT when the error occurs.  All 
it really tells you is that XEDIT is active *somewhere* in the command 
sequence.

To see for yourself, go into XEDIT, the into CMS subset mode, then issue a 
failing exec with the above code.  You won't see the messages until you 
RETURN to XEDIT.

Here's the Official Way to find out if your exec is running "in" XEDIT. 
That is to say, such that you will immediately see the output if you use 
COMMAND EMSG.

InXEDIT:
/* EXEC runtime environments */
execenv = "CMS EXEC CMSMIXED DMSRTPRC EAGTPRC VRX$EXEC PRX$EXEC"

/* Run the caller chain.  Skip level 0 and 1 because they */
/* are always RXCSL and EXEC.  */
do level = 2 by 1 until csl_rc <> 0
  Call CSL "DMSCALLR csl_rc callee level"
  callee = strip( left(callee, 8) )
  If csl_rc = 0 & wordpos(callee, execenv)= 0 then
    do 
      if callee = "XEDIT" then return 1
                          else return 0
    end
end 
return 0

I asked Chuckie if he cared to comment, and he opened one eye and stared 
at me.  (Creepy, I have to tell you - turns out he was asleep!)  Upon 
wakening, later, he provided this Unofficial Solution based on the 
undocumented DMSINXED found in various product execs.

InXEDIT:
  call CSL "DMSINXED csl_rc csl_reason in_xedit"
  if csl_rc = 0 & in_xedit = 0 then return 1
  return 0

Alan Altmark
z/VM Development
IBM Endicott

Reply via email to