グローバルおよびタスク関連出口プログラム

アプリケーション プログラムに必要な各ユーザー出口は、その出口が呼び出される前に有効にする必要があります。アプリケーション プログラムがユーザー出口の使用を終了したら、そのユーザー出口を無効にすることができます。ただし、ユーザー出口を無効にする必要性はありません。CICS の起動時には、ユーザー出口は常にデフォルトで無効になります。ユーザー出口プログラムを有効にする場合は CICS コマンド ENABLE PROGRAM を使用し、無効にする場合は CICS コマンド DISABLE PROGRAM を使用します。不正な出口を有効にしようとすると、X'804000' の EIBRCODE が返されます。正当であるが実装されていない出口を有効にしようとすると、X'804010' の EIBRCODE が返されます。また、EXTRACT EXIT コマンドも用意されています。ユーザー出口プログラムの作業領域にアクセスするには、このコマンドを使用します。これらのコマンドに対して提供されるサポートのレベルの詳細は、「System Programmers Commands」トピックを参照してください。

各ユーザー出口プログラムは、プログラムとして (PLT で) 定義する必要があり、その定義は稼働中のシステムで利用できなければなりません。

グローバル ユーザー出口とタスク関連ユーザー出口の詳細については、IBM マニュアルの『CICS/ESA 3.3 Customization Guide』を参照してください。このマニュアルには、正当なユーザー出口ポイントの一覧が記載されています。

ユーザー出口プログラムには、それがグローバル ユーザー出口とタスク関連ユーザー出口のどちらを対象としているかに関わらず、次の 2 つのコピーブックをインクルードする必要があります。

注:
  • ユーザー出口パラメーターは、コピーブック dfhcbuxi.cpy で定義された構造体 uxi-user-exit-interface で出口プログラムに渡されます。この構造体の 2 つのフィールド (uxi-operational-flags-ptruxi-scheduling-flags-ptr) は、別のコピーブック dfhcbuxc.cpy にある 2 つの別の構造体 (それぞれ lk-uxc-operationlk-uxz-schedule-param) を指します。
  • CICS アプリケーションは、タスク関連ユーザー出口を直接呼び出して、タスク領域のアドレスの取得などを行うことができます。通常、CICS アプリケーションはタスク関連ユーザー出口プログラムを DFHRMCAL マクロで呼び出します。このマクロはサポートされていないため、アプリケーションはユーザー出口プログラムを直接呼び出す必要があり、またコピーブック dfhcbuxi.cpy および dfhcbuxc.cpy をインクルードする必要があります。アプリケーション プログラムによってユーザー出口プログラムを呼び出せる場合は、アプリケーション プログラムと MSS のどちらによって呼び出されたかを出口プログラムで判断できるメカニズムを使用する必要があります。下記のサンプル出口プログラムは、1 つの手法を示しています。この手法では、アプリケーションが lk-uxc-schedule に未使用ビットをセットし、ユーザー出口プログラムがそのビットをテストします。

タスク関連ユーザー出口プログラムの骨組みの例を次に示します。

       id division.
       program-id. samptrue.
       environment division.
       configuration section.
       input-output section.
       data division.
       file section.
       working-storage section.
       01 work-scl.
           02 ws-allocate-local.
              03 ws-allocate-local-ptr-x.
                 04 ws-allocate-local-ptr       pointer.
              03 ws-allocate-local-size         pic x(4) comp-5.
              03 ws-allocate-local-return       pic x(4) comp-5.
                 88 ws-allocate-local-ok-88        value 0.
                 88 ws-allocate-local-no-space-88  value 1.
                 88 ws-deallocate-local-invalid-88 value 2.
                 88 ws-deallocate-inv-length-88    value 157.
           02 ws-allocate-local-type            pic x.
           02                                   pic x.
           02 ws-mfpm-register-flag             pic x(2).
              88 ws-mfpm-assign-24-88              value x'0000'.
              88 ws-mfpm-absolute-24-88            value x'0200'.
              88 ws-mfpm-assign-31-88              value x'0001'.
              88 ws-mfpm-absolute-31-88            value x'0201'.
           02 ws-mfpm-allocate-size             pic x(4) comp-x.
           02 ws-mfpm-allocate-ptr-x.
              03 ws-mfpm-allocate-ptr           pointer value null.
       linkage section .
       copy 'dfhcbuxi.cpy'.
       copy 'dfhcbuxc.cpy'.
       01 lk-global-area.
           03 lk-ga-byte pic x occurs 0 to 4096
               depending on uxi-global-area-length.
       01 lk-local-area.
           03 lk-la-byte pic x occurs 0 to 4096
               depending on uxi-local-area-length.
       procedure division using
                           uxi-user-exit-interface.
       module-entry-point.
           move 0                      to return-code
           set address of lk-uxc-operation 
               to uxi-operational-flags-ptr
           set address of lk-uxc-schedule-parm
               to uxi-scheduling-flags-ptr
           move 0                      to lk-uxc-return-code
           *> -- Are we being called by an application?
           *> -- (User application sets unused value in lk-uxc-schedule.) 
           if lk-uxc-schedule = x'02'
               perform called-by-application
               goback
           end-if
           *> -- Register syncpoint interest
           move 78-lk-uxc-TRUE-on-sync to lk-uxc-schedule-byte
           *> -- Register start of task interest
           call "CBL_OR" using 
               78-lk-uxc-TRUE-on-start
               lk-uxc-schedule-byte
               by value 1
           end-call
           *> -- Register any other interest here by OR'ing bits
           *> -- in lk-uxc-schedule-byte as above.
           if lk-uxc-exit-id not = 0 *> -- handle only TRUEs
               goback
           end-if
           evaluate true
           when lk-uxc-initialization-88
           when lk-uxc-shutdown-88
               goback
           when lk-uxc-task-start-88
               perform save-TA-address
           when lk-uxc-task-syncpoint-88
               perform end-task-process
           when lk-uxc-user-syncpoint-88
               set address of lk-global-area 
                   to uxi-global-area-ptr
               set address of lk-local-area 
                   to uxi-local-area-ptr
               evaluate true
               when lk-uxc-syncpoint-prepare-88
                   *> -- We haven't registered an interest for this
                   continue
               when lk-uxc-syncpoint-commit-88
                   perform commit-process
               when lk-uxc-syncpoint-rollback-88
                   perform rollback-process
               end-evaluate
           end-evaluate
           goback
           .
       called-by-application section.
           *> -- Add any code here that you wish to execute when
           *> -- called by an application program.
           *> -- This sample passes back the address of the local 
           *> -- task area.
           set uxi-local-area-ptr      to ws-mfpm-allocate-ptr
           exit
           .
       save-TA-address section.
           *> -- Convert local task area address and save in W/S.
           exit
           .
       end-task-process section.
           *> -- Insert code here that you wish to perform at
           *> -- end of task.
           exit
           .
       commit-process section.
           *> -- Insert code here that you wish to perform at 
           *> -- user syncpoint.
           exit
           .
       rollback-process section.
           *> -- Insert code here that you wish to perform at 
           *> -- user backout.
           exit
           .