On Friday, 07/08/2016 at 04:28 GMT, "Stanislawski, Shawn (National VM 
Capability)" <shaw...@hpe.com> wrote:

> Looking into Bruce Hayden's suggestion of DMSCALLR CSL routine was spot 
on!
> New and much better solution:
> "d
> /* Who called me? */
> Farback = 4
> CALL CSL 'DMSCALLR' Retcode1 CallerN Farback
> 'PIPE VAR CallerN | SPECS W2 1 | VAR CallerN'
> "
> When command FILEL then CallerN = FILELIST

Almost.  :-)  DMSCALLR sat on my A-disk long before I got my colleagues to 
integrate it into CMS years ago, and I suggest using a loop to insulate 
your program against variations that show up in the calling sequence. 

/* Find name of inner-most recognizable EXEC */
do i = 2 by 1 until cslrc <> 0 
   Call CSL "DMSCALLR cslrc caller i"
   parse var caller what +8 which . 
   if what = "EXEC" & right(which,4) = "LIST" then leave
   which = "*UNKNOWN*"
end 
say "CALLED BY" which

This programming idiom not only avoids issues with compiled v. interpreted 
EXECs and changes in the structure of the calling program, it also helps 
you writes EXECs that can operate differently in XEDIT vs. from the 
command line, but without false positives.

For example, if you go into XEDIT, then into CMS subset mode, you do not 
want the output of an issued command to go to XEDIT.  You want to see it 
in CMS.  But when you return to XEDIT and issue the command again, you 
would like to see the output as an XEDIT EMSG/MSG.  And of course, if you 
issue the command in a PIPE, you definitely want the output to go to the 
console.

Alan Altmark

Senior Managing z/VM and Linux Consultant
Lab Services System z Delivery Practice
IBM Systems & Technology Group
ibm.com/systems/services/labservices
office: 607.429.3323
mobile; 607.321.7556
alan_altm...@us.ibm.com
IBM Endicott

Reply via email to