Rational Developer for System z
Enterprise PL/I for z/OS, Version 4.1, Programming Guide

Invoking MAIN under TSO/E

If you compile your MAIN program with the SYSTEM(MVS) option, you can invoke the program using the TSO CALL command or as a TSO command processor. Both the run-time options and parameters can be passed the same way as under MVS batch.

For example, if the MAIN program TSOARG1 was link-edited as a member of a data set named userid.TEST.load, it can be invoked by:

    CALL TEST(TSOARG1) 'RPTSTG(ON),TRAP(ON)/THIS IS MY ARGUMENT'
  or
    CALL TEST(TSOARG1) '/THIS IS MY ARGMENT'
  or
    TSOARG1 TRAP(ON)/THIS IS MY ARGUMENT
  or
    TSOARG1 /THIS IS MY ARGUMENT

NOTE: The data set containing TSOARG1 (userid.TEST.load) must be in the standard TSO program search list to run the program without using the CALL statement. This can be accomplished by issuing the TSO command

    TSOLIB ACTIVATE DSN('userid.TEST.load')

However, if you compile your MAIN program with the SYSTEM(TSO) option, the program will be passed a pointer to the Command Processor Parameter List (CPPL). In this case, NOEXECOPS is in effect. Your program can be invoked as a TSO command, but it cannot be invoked by a TSO CALL statement. For example:

    TSOARG2 This is my argument

The program in Figure 17 uses the SYSTEM(TSO) interface to address and display the program arguments from the CPPL.

Figure 17. Sample program to display program arguments from the CPPL under TSO when using SYSTEM(STD) option
 *process system(tso);
  tsoarg2: proc (cppl_ptr) options(main);
    dcl cppl_ptr pointer;
    dcl 1 cppl based(cppl_ptr),
      2 cpplcbuf   pointer,
      2 cpplupt    pointer,
      2 cpplpscb   pointer,
      2 cpplect    pointer;
    dcl 1 cpplbuf based(cpplcbuf),
      2 len    fixed bin(15),
      2 offset fixed bin(15),
      2 argstr char(1000);
    dcl my_argument char(1000) varying;
    dcl my_argument_len fixed bin(31);
    dcl length builtin;

    my_argument_len = len - offset - 4;
    if my_argument_len = 0 then
      my_argument = '';
    else
      my_argument =  substr(argstr,offset + 1, my_argument_len);
    display('Program args: ' || my_argument);
  end tsoarg2;

Whether your MAIN program is invoked as a command or via CALL, you can always specify run-time options via the PLIXOPT string.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)