On 5 May 2015 at 19:59, Charles Mills <[email protected]> wrote:

> Hmmm. I'm actually wishing to do this from within a command I will write. Is 
> there any reason I
> cannot use normal MVS functions such as LOAD to find a particular FOO and 
> then pass my own
> "constructed" CPPL:
>
> CPPLCBUF: Pointer to a buffer in my program containing H'21',H'4',C'FOO SOME 
> OPERANDS'
> CPPLUPT: Copied from my entry CPPL.
> CPPLPSCB: Copied from my entry CPPL.
> CPPLECT: Copied from my entry CPPL.

In many cases that works fine, with a few caveats.

> Will that work (assuming no screw-ups) or is there some "magic" that TSO 
> performs for a CP that
> will be missing if I do a LOAD and BASSM or BALR? I was thinking there was 
> (some TSO magic
> necessary) but perhaps there is not?

No great magic. Perhaps some bit twiddling.

> Note: all unauthorized. No APF considerations here.

I'm glad you said that. :-)

There are several models you can follow here. But first, is FOO *your*
command, or one of a number of commands you know a lot about, or is it
more general than that, i.e. can the user select commands somehow?
Even without APF considerations, there is room for things to go wrong.

The first model is the TMP itself. IBM used to document this in a book
called Guide to Writing a Terminal Monitor Program or a Command
Processor, but that book was discontinued after MVS/XA, I believe. You
can find an old copy on bitsavers or the like, and it is still mostly
valid and remains quite useful. At the time IBM discontinued that
book, they added OCO elements to the TMP:Command interface, and these
have been further added to over time, so things like integrated REXX
support and authorized commands are not fully documented. In other
words it is no longer possible to write your own full-function TMP
using supported interfaces.

Second, that book, and its replacements TSO/E Programming Guide and
TSO/E Programming Services also describe the subcommand interface.
This is/was used by TSO commands like EDIT, which have subcommands
that are distinct load modules. As luck(?) would have it, the
subcommand interface is essentially identical to the command
interface, and is well documented.

Both these interfaces involve ATTACHing the [sub]command, and there
are some rules for that, including careful use of storage subpools
(e.g. do NOT share SP 0, and DO share SP 78). If your FOO is a single
load module that implements more than one command (say module ABCFOO
has aliases FOO and BAR), then you should copy the command name (not
the load module name) into the ECTPCMD field of the ECT. Some IBM
commands, notably the AMS ones like  DEFINE, DELETE, PRINT etc. depend
on this. Of course if it's your FOO, then this isn't needed.

The third approach is to just LINK (or BALR etc) to the command
module, which I think is what you are suggesting. It will probably
work fine; considerations are abend handling and storage use. If you
are invoking FOO many times, it has no obligation to release subpool 0
storage, and you may run out.

And finally, there are the official approaches, which are the somewhat
overlapping TSO/E services IKJTSOEV and IKJEFTSR. Higher overhead,
lots of features, and supported. Read all about them in the books
above.

Good luck.

Tony H.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to