home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / viscobv6.zip / vac22os2 / ibmcobol / samples / pli / faaexp15.pli < prev   
Text File  |  1998-02-23  |  4KB  |  78 lines

  1. *process langlvl(saa2) limits(extname(31));
  2.  /*********************************************************************/
  3.  /*                                                                   */
  4.  /* MODULE NAME        FAAEXP15.PLI                                   */
  5.  /*                                                                   */
  6.  /* DESCRIPTIVE NAME   User exit - 15. Task Attach / Detach Exit      */
  7.  /*                    sample for Remote DL/I running on CICS OS/2.   */
  8.  /*                                                                   */
  9.  /* Statement:         Licensed Materials - Property of IBM           */
  10.  /*                                                                   */
  11.  /*                    33H2061                                        */
  12.  /*                    (c) Copyright IBM Corp. 1988, 1995.            */
  13.  /*                                                                   */
  14.  /*                    See Copyright Instructions.                    */
  15.  /*                                                                   */
  16.  /*                    All rights reserved.                           */
  17.  /*                                                                   */
  18.  /*                    U.S. Government Users Restricted Rights - use, */
  19.  /*                    duplication or disclosure restricted by GSA    */
  20.  /*                    ADP Schedule Contract with IBM Corp.           */
  21.  /*                                                                   */
  22.  /* Status:            Version 3 Release 0                            */
  23.  /*                                                                   */
  24.  /*  NOTES :-                                                         */
  25.  /*    DEPENDENCIES = None                                            */
  26.  /*                   None                                            */
  27.  /*    RESTRICTIONS = None                                            */
  28.  /*    MODULE TYPE  = Program                                         */
  29.  /*    PROCESSOR    = PS/2 and PC                                     */
  30.  /*                                                                   */
  31.  /*********************************************************************/
  32.  /*                                                                   */
  33.  /*  FUNCTION:                                                        */
  34.  /*       The Remote DL/I calls in this program ensure that at the    */
  35.  /*       end of a transaction:                                       */
  36.  /*         - If a PSB is still scheduled, it is terminated.          */
  37.  /*         - If a remote DL/I connection exists, the connection      */
  38.  /*           is ended.                                               */
  39.  /*                                                                   */
  40.  /*********************************************************************/
  41.  FAAEXP15: proc(pExit15Input)
  42.            options(fromalien nodescriptor byvalue linkage(System))
  43.            returns(fixed bin(15));
  44.  
  45.  %include faaexi15;
  46.  
  47.  dcl DLIDisconnect entry
  48.           returns( byvalue optional unsigned fixed bin(31))
  49.            options( nodescriptor linkage(optlink))
  50.            external('DLIDisconnect');
  51.  dcl DLITermPSB    entry
  52.           returns( byvalue optional unsigned fixed bin(31))
  53.            options( nodescriptor linkage(optlink))
  54.            external('DLITermPSB');
  55.  dcl DLI_rc         unsigned fixed bin(31);
  56.  dcl pExit15Input   pointer,
  57.      Exit15         type S_EXIT_15_IN based(pExit15Input);
  58.  
  59.     if Exit15.ExitNumber = EXIT_15_TASK_ATTACH then;
  60.     else
  61.       /* We get here for task detach.  Only do the remote DL/I calls */
  62.       /* for transactions that may use remote DL/I (omit CICS        */
  63.       /* supplied transactions).                                     */
  64.       do;
  65.         if substr(Exit15.Exit15Transid,1,1) ^= 'C' then
  66.           do;
  67.             /* Terminate any outstanding scheduled PSBs              */
  68.             DLI_rc = DLITermPSB();
  69.             /* Disconnect if there is a connection                   */
  70.             if DLI_rc ^= 120 then
  71.                DLI_rc = DLIDisconnect();
  72.           end;
  73.       end;
  74.  
  75.     return(0);
  76.  
  77.  end FAAEXP15;
  78.