Freeware Page
//GILBERTJ JOB (ACCT#),PLI2TSO,
// NOTIFY=&SYSUID,
// CLASS=A,MSGCLASS=X,COND=(4,LT)
//PLI EXEC PGM=IBMZPLI,PARM=(OPTIONS,SOURCE),REGION=64M
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD UNIT=VIO
//SYSLIN   DD UNIT=VIO,DISP=(,PASS)
//SYSIN    DD *
  /******************************************************************/
  /*                                                                */
  /*  MODULE NAME = PLI2TSO                                         */
  /*                                                                */
  /*  DESCRIPTIVE NAME = Sample PL/I program to issue a TSO command */
  /*                                                                */
  /*  FUNCTION = This sample program demonstrates how to invoke     */
  /*             TSO commands from a PL/I program using             */
  /*             standard TSO services as documented in the         */
  /*             TSO/E Programming Services manual.                 */
  /*                                                                */
  /*             Most TSO commands, including CLISTs and REXX       */
  /*             execs can be executed using this technique.        */
  /*             TSO commands which require authorization           */
  /*             (such as OUTPUT, SEND, TRANSMIT and RECEIVE)       */
  /*             will not work.                                     */
  /*                                                                */
  /*             http://gsf-soft.com/Freeware/                      */
  /*                                                                */
  /******************************************************************/
     PLI2TSO: Procedure Options(MAIN);

       DCL ws_dummy        Fixed Bin(31,0),
           ws_return_code  Fixed Bin(31,0),
           ws_reason_code  Fixed Bin(31,0),
           ws_info_code    Fixed Bin(31,0),
           ws_cppl_address Fixed Bin(31,0),
           IKJTSOEV        Entry Options(ASM);

  /*----------------------------------------------------------------*/
  /*          Call IKJTSOEV to create the TSO/E environment         */
  /*----------------------------------------------------------------*/
        Fetch IKJTSOEV;
         CALL IKJTSOEV(ws_dummy,
                       ws_return_code,
                       ws_reason_code,
                       ws_info_code,
                       ws_cppl_address);
         IF ws_return_code > 0 Then Do;
           DISPLAY ( 'IKJTSOEV Failed, Return_code=' || ws_return_code
                                  || ' Reason_code=' || ws_reason_code
                                  || ' Info_code='   || ws_info_code);
           Call PLIRETC(ws_return_code);
           Return;
           END;
  /*----------------------------------------------------------------*/
  /*          Build the TSO/E command in ws-buffer                  */
  /*----------------------------------------------------------------*/
       DCL ws_buffer       Char(256),
           ws_length       Fixed Bin(31,0) Init(Length(ws_buffer)),
           IKJEFTSR        Entry Options(ASM);

         ws_buffer='ALLOCATE DD(MSGDD) SYSOUT HOLD BLKSIZE(80)';

  /*----------------------------------------------------------------*/
  /*   Call the TSO/E Service Routine to execute the TSO/E command  */
  /*----------------------------------------------------------------*/
      Fetch IKJEFTSR;
       CALL IKJEFTSR('00010001'X,ws_buffer,ws_length,
                     ws_return_code,ws_reason_code,ws_dummy);
       IF ws_return_code > 0 Then Do;
         DISPLAY ('IKJEFTSR Failed, Return_code=' ||
                ws_return_code || ' Reason_code=' || ws_reason_code);
         Call PLIRETC(ws_return_code);
         Return;
         END;
  /*----------------------------------------------------------------*/
  /*          Print that the ALLOCATE command worked                */
  /*----------------------------------------------------------------*/
       PUT FILE(MSGDD) SKIP EDIT('Command ALLOCATE Worked ! ') (A);
     END PLI2TSO;
/*
//GO    EXEC PGM=LOADER,PARM=PRINT
//SYSLIN DD DSN=*.PLI.SYSLIN,DISP=(OLD,PASS)
//SYSLIB DD DSN=CEE.SCEELKED,DISP=SHR
//SYSLOUT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=* 
//CEEDUMP DD SYSOUT=*