JCL サブシステム出口の使用

概要

JCL は、JCL サブシステム出口 (SUBSYS) と呼ばれる機能を提供します。この機能により、インストレーションでは、イベントの監視とシステムによって実行された結果アクションの制御を行って、サブシステムに必要な動作をカスタマイズすることができます。

DD 文および SVC 99 テキスト ユニットを使用した SUBSYS

SUBSYS は、DD 文のキーワードとして、および SVC 99 のテキスト ユニット (Text Unit; TU) として指定できます。 どの場合でも、構文は次のようになります。

SUBSYS=(subsystem-name[,subsystem-subparameter]...)

補足説明:

DD 文での例:

//someddn DD SUBSYS=(OODA,A,DKP39CPM,’PPP3’,STD,,USER),
    //           DSN=MFIDSA.SUBSYS1B.NEW.OODA.NOTUSED,
    //           OUTPUT=(*.OUTSJ,*.OUTHORSE)

SUBSYS 処理

DD 文に SUBSYS キーワードがあり、subsystem-subparameter 文字列のどこかに DDNAME=x が含まれている場合、その SUBSYS は、DDNAME=x が DD 文上でコード化されたかのように処理されます。これは、subsystem-name にかかわらず、JCL DD 文だけに適用されます。SVC99 テキスト ユニット (TU) には適用されません。

SUBSYS を使用した DD ごとに、リソース割り当ての直前に出口に制御が一度与えられます。OPEN、CLOSE、WRITE などの他のイベントに対する実行中には、制御は与えられません。

サブシステム出口の呼び出し、ルール、およびガイドライン

ユーザー出口 (MFJYssss という名前を付ける必要があり、ssss は subsystem-name) はオプションであり、次のように呼び出されます。

CALL ‘MFJYssss’ USING SXIT

ここで、SXIT はユーザー出口インターフェイス ブロック (mfjdxit.cpy) です。SXIT には、次のものが含まれます。

mfjdsxit.cpy では、すべてのイベント コード、アクション コード、および各イベントに関連付けられたデータが詳細に記述されます。mfjdsxit.cpy を調べる場合は、次のことに注意してください。

サブシステム出口は、イベントが発生すると呼び出されます。

何らかの理由でユーザー出口が失敗した場合は、後続のすべてのイベントに対する失敗プロセスでそのユーザー出口が無効になります。

注:

イベントとアクション

このセクションでは、イベントごとに、重要な (ただし、すべてではない) 入力および出力とそのイベント用に要求できるアクションについて説明します。次のアクションは、すべてのイベントに適用されます。

下記のイベント名は、イベント コードに割り当てられたレベル 78 の名前に部分的に対応しています。同様に、下記のアクション コード名は、アクション コードに割り当てられたレベル 78 の名前に部分的に対応しています。mfjdsxit.cpymfjyooda.cbl、および subsys1b.jcl ファイルを参照すると、ここで説明する機能の理解に役立ちます

このイベントは、DD のソースの割り当てが行われようとしていることを示します。このイベントの目的は、処理中の DD の確認や変更をサブシステム出口で実行できるようにすることです。

このイベントと Event-before-PGM-call は、子プロセスで発生します。その他のイベントは、すべて親プロセスで発生します。親プロセスで発生したイベントを出口で記憶することはできません。

イベント固有のデータ:

このイベントに使用できるデータは次のとおりです。

出口では、情報を表示または変更し、変更された情報をシステムで使用するように要求することができます。変更できる情報は次のとおりです。

アクション:

要求できるアクション:

Enterprise Server プリンター出口との相互作用

出口が DD を SYSOUT に変更した場合、プリンター出口は、OUTPUT 文などの通常の sysout 関連情報のほかに subsystem-subparameter 文字列情報にもアクセスすることができます。これにより、生成された sysout 出力をさらにカスタマイズすることが可能になります。

サブシステム出口インターフェイス ブロック (mfjdsxit.cpy)

このセクションでは、SXIT によって使用される mfjdsxit.cpy コピーブックのリストを示します。

最新の情報については、$COBDIR/include にあるこのコピーブックのソースを参照してください。

 *>==============================================================
      *> Copyright ©) 1997-2008 Micro Focus (IP) Ltd.
      *>   All rights reserved.
      *>
      *> This sample source code is provided for use by users of
      *> Micro Focus products (the "Software") and may be used,
      *> modified and distributed as part of your application provided
      *> that you properly acknowledge the copyright of Micro Focus in
      *> this material.
      *>
      *> All conditions, warranties and undertakings, express or implied,
      *> statutory or otherwise, on the part of Micro Focus are excluded,
      *> including without limitation those of merchantability or fitness
      *> for purpose. This shall not, however, purport to exclude or
      *> restrict the liability of Micro Focus to any extent not
      *> permitted by law.
      *>
      *> IN NO EVENT WILL MICRO FOCUS BE LIABLE FOR ANY INDIRECT,
      *> INCIDENTAL, SPECIAL, CONSEQUENTIAL OR OTHER DAMAGES ARISING OUT
      *> OF THE USE OF THE DEMONSTRATION PROGRAM DISTRIBUTED WITH THE
      *> SOFTWARE, WHETHER OR NOT INFORMED OF THE POSSIBILITIES OF
      *> DAMAGES IN ADVANCE.  THESE LIMITATIONS APPLY TO ALL CAUSES OF
      *> ACTION, INCLUDING BREACH OF CONTRACT, BREACH OF WARRANTY, STRICT
      *> LIABILITY, AND ANY ACTIONS IN TORTS.
      *>==============================================================

      *>==============================================================
      *> mfjdsxit - Micro Focus Subsystem user exit parameter block
      *>   Contains interface information and is passed as a parameter
      *>   to the subsystem exit which is ivoked as:
      *>      call  subsys-exit using sxit
      *>
      *> Notes:
      *>   1. It should be included as follows (e.g.)
      *>        copy mfjdsxit replacing ==()== by ==sxit==.
      *>   2. Fields beginning with sxit-I- ( ()-I- ) are Input
      *>      to the subsystem exit and must not be modified
      *>      e.g. sxit-I-size
      *>   3. Fields beginning with sxit-U- ( ()-U- ) are Input and
      *>      Output. On entry to the subsystem exit, they are set as
      *>      appropriate and may be changed by the subsystem exit to
      *>      an acceptable value upon return.
      *>      e.g. ()-U-ds-type
      *>   4. All data is ASCII(ANSI). Null values are those appropriate
      *>      for the data type. i.e. blanks for character data,
      *>      zeros for numeric and binary data
      *>==============================================================
         1 ().
           3 ()-header.
             5 ()-I-size           pic x(2) comp-x. *>Size of this blk
             5 ()-I-event          pic x(2) comp-x. *> event code
                  *> this event occurs before DD is allocated
               78 ()-I-event-dd-alloc-pre        value  1.
             5 ()-U-action         pic x(2) comp-x. *>action requested
               *> The system should continue as if the exit were
               *> never invoked. Do not modify any data.
               78 ()-U-action-continue            value 0.
               *> The system should use updated data and continue.
               78 ()-U-action-use-updated-data    value 4.
               *> Others - TBD
             5                     pic x(2) comp-x.
           3 ()-data.
             5 ()-I-jseb-ptr       pointer.
             5 ()-U-ds-name-ptr    pointer.
             5 ()-U-ds-type        pic x(1).
               78 ()-U-ds-type-perm     value x'00'.
               78 ()-U-ds-type-temp     value x'80'.
               78 ()-U-ds-type-dummy    value x'40'.
               78 ()-U-ds-type-sysout   value x'20'.
               78 ()-U-ds-type-terminal value x'10'.
               78 ()-U-ds-type-pc       value x'08'.
             5                     pic x(3).
               *>  DD statement SUBSYS= value length
             5 ()-U-subsys-len     pic x(4) comp-x.
               *> if SUBSYS= value length (previous field) is non-zero,
               *> a ptr to entire (including subsystem name, the 1st
               *> subparameter) DD SUBSYS= string
             5 ()-U-subsys-ptr     pointer.
             5                     pic x(20).
      *>==============================================================

OODA サブシステム (mfjyooda.cbl) のサブシステム出口

この出口 (event-dd-alloc-pre 用) は、action-use-updated-data を使用して下記の項目および要求を変更します。変更された情報は DD の割り当てに使用されるため、DD は SYSOUT として割り当てられます。

また、この出口は、予期された subsystem-subparameter 文字列を受信したかどうかも確認します。

最新の情報については、$COBDIR/include にあるこのコピーブックのソースを参照してください。

*>==============================================================
*> Use directives at least: /CHARSET"ASCII"
      *>                          /DIALECT"MF" /DEFAULTBYTE"00"
      *>==============================================================
     *> Copyright ©) 1997-2008 Micro Focus (IP) Ltd.
      *>   All rights reserved.
      *>
      *> This sample source code is provided for use by users of
      *> Micro Focus products (the "Software") and may be used,
      *> modified and distributed as part of your application provided
      *> that you properly acknowledge the copyright of Micro Focus in
      *> this material.
      *>
      *> All conditions, warranties and undertakings, express or implied,
      *> statutory or otherwise, on the part of Micro Focus are excluded,
      *> including without limitation those of merchantability or fitness
      *> for purpose. This shall not, however, purport to exclude or
      *> restrict the liability of Micro Focus to any extent not
      *> permitted by law.
      *>
      *> IN NO EVENT WILL MICRO FOCUS BE LIABLE FOR ANY INDIRECT,
      *> INCIDENTAL, SPECIAL, CONSEQUENTIAL OR OTHER DAMAGES ARISING OUT
      *> OF THE USE OF THE DEMONSTRATION PROGRAM DISTRIBUTED WITH THE
      *> SOFTWARE, WHETHER OR NOT INFORMED OF THE POSSIBILITIES OF
      *> DAMAGES IN ADVANCE.  THESE LIMITATIONS APPLY TO ALL CAUSES OF
      *> ACTION, INCLUDING BREACH OF CONTRACT, BREACH OF WARRANTY, STRICT
      *> LIABILITY, AND ANY ACTIONS IN TORTS.
      *>==============================================================

      *>==============================================================
      *> Note that subsystem exit is ways named as MFJYssss, where
      *> ssss is the subssystem name (1st sub-parameter of SUBSYS=)
      *>==============================================================

      *>==============================================================
      *> SUBSYS Subsystem exit for OODA subsystem
      *>==============================================================
       identification division.
       program-id.    MFJYOODA.
       environment division.
       file-control.
       data division.
       *>=============================================================
       working-storage section.

       77 subsys-val-expected             pic x(30) value
                                  'OODA,A,DKP39CPM,PPP3,STD,,USER'.
       77 msg-dest-both               pic 9(8) comp value 0.
       77 msg-len                     pic 9(8) comp value 80.
       77 msg-txt                     pic x(80).
       77 w-len                       pic 99999.
       linkage section.
       copy "mfjdsxit.cpy" replacing ==()== by ==sxit==.
       01 subsys-val                      pic x(32000).

       *>=============================================================
       procedure division using by reference sxit.

      * Dsa temp  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
      *    call  'CBL_DEBUGBREAK'
      * Dsa temp  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         evaluate sxit-I-event
           when sxit-I-event-dd-alloc-pre
             *>=======================================================
             *> DD is about to be allocated. Change to SYSOUT=*
             *>=======================================================
             move sxit-U-ds-type-sysout to sxit-U-ds-type
             set sxit-U-ds-name-ptr to null
             move sxit-U-action-use-updated-data to sxit-U-action
             *>=======================================================
             *> The code below is informational only. Note that
             *>   - sxit-U-subsys-ptr points to the the entire
             *>     SUBSYS string with syntactic quotes removed.
             *>   - sxit-U-subsys-len is the length of the string
             set address of subsys-val to sxit-U-subsys-ptr
             if sxit-U-subsys-len <> length subsys-val-expected
               move sxit-U-subsys-len to w-len
               move ' ' to msg-txt
               string 'MFJYOODA - Length should be 30 but is '
                                                   delimited by size
                        w-len                      delimited by size
                 into msg-txt
               call 'MFJZLOG' using msg-dest-both msg-len msg-txt
             end-if
             if subsys-val(1:length subsys-val-expected) <>
                subsys-val-expected
               move ' ' to msg-txt
               string 'MFJYOODA - Value incorrect. It is '
                                                   delimited by size
                        subsys-val(1:length subsys-val-expected)
                                                   delimited by size
                 into msg-txt
               call 'MFJZLOG' using msg-dest-both msg-len msg-txt
             end-if
             *>    move subsys-val(1:sxit-U-subsys-len) to ...
             *>=======================================================
             goback
           when other
             *>=======================================================
             *> Ignore all other events
             *>=======================================================
             continue
         end-evaluate
         goback.
         *>===========================================================

JCL (subsys1b.jcl)

最新の情報については、$COBDIR/include にあるソースを参照してください。

 //MFIDSA1B JOB 'SUBSYS TESTS - VIA JCL',CLASS=A,MSGCLASS=A
     //OUTSJ    OUTPUT CLASS=X,DEST=SANJOSE.DAVINDER,DEFAULT=YES
     //OUTNWB   OUTPUT CLASS=Y,DEST=GARDEN.CLIVE,DEFAULT=YES
     //OUTHORSE OUTPUT CLASS=M,DEST=HORSES.THAIUSER,DEFAULT=NO
     //*-------------------------------------------------------------------
     //STEP1    EXEC PGM=IDCAMS
     //SYSPRINT  DD SYSOUT=*
     //SYSUTX    DD *
     REC1
     REC2
     //SYSIN     DD *
     REPRO IFILE(SYSUTX) OFILE(OODA  )
     REPRO IFILE(SYSUTX) OFILE(NONE  )
     //OODA      DD SUBSYS=(OODA,A,DKP39CPM,PPP3,STD,,USER),
    //             DSN=MFIDSA.SUBSYS1B.NEW.OODA.NOTUSED,
    //             OUTPUT=(*.OUTSJ,*.OUTHORSE)
    //NONE      DD SUBSYS=(NONE,A,DKP39CPM,PPP3,STD,,USER),
    //             DSN=MFIDSA.SUBSYS1B.NEW.NONE.DELETED,
    //             OUTPUT=(*.OUTSJ,*.OUTHORSE)
   //