Alan,

The 'count = ""' line just before the test 'if count <> ""' guarantees that the 
else path is the only one that can be taken.  


Regards, 
Richard Schuh 


-----Original Message-----
From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED] On Behalf Of Alan 
Altmark
Sent: Thursday, December 27, 2007 7:46 AM
To: IBMVM@LISTSERV.UARK.EDU
Subject: Re: Checking how invoked

On Thursday, 12/27/2007 at 05:20 EST, "Wakser, David" 
<[EMAIL PROTECTED]> wrote:
> The "submission" EXEC can be invoked from an EXEC, but it can also be 
> invoked on its own. In the submission EXEC, I need to know if I was 
> invoked natively (either from the CMS command line or from FLIST - I 
> don't differentiate), or called from another EXEC. This is necessary 
> in order to decide whether or not to display certain messages.
> 
> Does that explain my need a little better? For now, I am using the 
> following to accomplish this:
> 
> PARSE UPPER SOURCE . . . . . RXNAME .
> 'PIPE STORAGE 740 8 | XLATE 1-* UPPER | VAR X1'
> if X1 /= "SEND2VSE" & substr(X1,1,5) /= "FILEL" then exit

DMSCALLR follows the command chain backwards.  An exec (SVCLOOK) invoked from 
the FLIST (not FILELIST!) command line shows:

CALLEE=RXCSL 
CALLEE=EXEC    SVCLOOK 
CALLEE=FLIST 

>From FILELIST (next to the name of a file):

CALLEE=RXCSL 
CALLEE=EXEC    SVCLOOK 
CALLEE=CMS
CALLEE=XEDIT
CALLEE=DMSRTPRC  °h  °h
CALLEE=EXEC      ku  ?Þ
CALLEE=XEDIT   ALTMARKA
CALLEE=DMSRTPRC 
CALLEE=EXEC    FILELIST
CALLEE=CMS 
CALLEE=EXEC    FL      <-- I have an FL EXEC

>From FILELIST (on the command line):

CALLEE=RXCSL 
CALLEE=EXEC    SVCLOOK 
CALLEE=CMS 
CALLEE=XEDIT   ALTMARKA 
CALLEE=DMSRTPRC 
CALLEE=EXEC    FILELIST 
CALLEE=CMS 
CALLEE=EXEC    FL 

Looking at CMNDLINE in NUCON (0x740) is no good.  It contains the command line 
read from the console, prior to any resolution of synonyms or abbreviations.

> SEND2VSE is the name of the submission EXEC. That is what is returned 
> if the EXEC is accessed natively. If issued from FILELIST, then FILEL 
> is returned. If neither of those is returned, I assume the submission 
> EXEC was called by another EXEC (for example, the compilation exec) 
> and I exit at this point.

If I invoked another exec from FILELIST that called your exec, your exec would 
(incorrectly) believe that it was called from FILELIST.  And as I illustrate 
above, when called from FILELIST, it would be misled if FILELIST wasn't called 
from the Ready prompt or if it had a synonym that didn't start with "FILEL".

Alan Altmark
z/VM Development
IBM Endicott

Here is the source to SVCLOOK.  In its original form it takes a number as an 
argument which says "give me the nth caller".  With no argument it would 
display the entire call stack.  I modified it slightly to provide some 
illustrations.

/* SVCLOOK EXEC - Alan Altmark,  01/26/94 */ parse arg parms say "ARG =" parms 
parse source src say "SRC =" src "CP D T740.8" 
count = "" 
if count <> '' then
  do 
    Call doit count 
    exit cslrc
  end
else
  do i = 0 by 1 until cslrc <> 0 
    Call doit i
  end
exit 0 
 
Doit: 
arg n
Call CSL 'DMSCALLR cslrc callee n' 
if cslrc = 0 then
  say 'CALLEE='callee
return 

Reply via email to