Rational Developer for System z
Enterprise COBOL for z/OS バージョン 4.1 プログラミング・ガイド


例: INEXIT ユーザー出口

次の例は、COBOL で書かれた INEXIT ユーザー出口モジュールを示しています。

***********************************************************
*                                                         *
* Name:  SKELINX                                          *
*                                                         *
* Function:  Example of an INEXIT user exit written       *
*            in the COBOL language.                       *
*                                                         *
***********************************************************

 Identification Division.
    Program-ID.  Skelinx.

 Environment Division.

 Data Division.

   WORKING-STORAGE Section.

*   *******************************************************
*   *                                                     *
*   *  Local variables.                                   *
*   *                                                     *
*   *******************************************************

    01  Record-Variable    Pic X(80).

*   *******************************************************
*   *                                                     *
*   *  Definition of the User-Exit Parameter List, which  *
*   *  is passed from the COBOL compiler to the user exit *
*   *  module.                                            *
*   *                                                     *
*   *******************************************************

   Linkage Section.
    01  Exit-Type         Pic 9(4)   Binary.
    01  Exit-Operation    Pic 9(4)   Binary.
    01  Exit-ReturnCode   Pic 9(9)   Binary.
    01  Exit-WorkArea.
        05  INEXIT-Slot   Pic 9(9)   Binary.
        05  LIBEXIT-Slot  Pic 9(9)   Binary.
        05  PRTEXIT-Slot  Pic 9(9)   Binary.
        05  Reserved-Slot Pic 9(9)   Binary.
    01  Exit-DataLength   Pic 9(9)   Binary.
    01  Exit-DataArea     Pointer.
    01  Exit-Open-Parm    Redefines  Exit-DataArea.
        05  String-Len    Pic 9(4)   Binary.
        05  Open-String   Pic X(64).
    01  Exit-Print-Line   Redefines  Exit-DataArea  Pic X(133).
    01  Exit-LIBEXIT      Pic X(8).
    01  Exit-Systext      Pic X(8).
    01  Exit-CBLLibrary   Pic X(30).
    01  Exit-CBLText      Pic X(30).

***********************************************************
*                                                         *
*  Begin PROCEDURE DIVISION                               *
*                                                         *
*  Invoke the section to handle the exit.                 *
*                                                         *
***********************************************************

 Procedure Division Using Exit-Type       Exit-Operation
                          Exit-ReturnCode Exit-WorkArea
                          Exit-DataLength Exit-DataArea
                          Exit-LIBEXIT    Exit-Systext
                          Exit-CBLLibrary Exit-CBLText.

     Evaluate Exit-type              
       When (1) Perform Handle-INEXIT
       When (2) Perform Handle-LIBEXIT
       When (3) Perform Handle-PRTEXIT
     End-Evaluate
     Move 16 To Exit-ReturnCode
     Goback.

*************************************************
*    I N E X I T   E X I T   P R O C E S S O R  *
*************************************************
 Handle-INEXIT.

     Evaluate Exit-Operation         
       When (0) Perform INEXIT-Open
       When (1) Perform INEXIT-Close
       When (2) Perform INEXIT-Get
     End-Evaluate

     Move 16 To Exit-ReturnCode
     Goback.

 INEXIT-Open.
*    ------------------------------------------------------
*    Prepare for reading source
*    ------------------------------------------------------
     Goback.

 INEXIT-Close.
*    ------------------------------------------------------
*    Release resources
*    ------------------------------------------------------
     Goback.

 INEXIT-Get.
*    ------------------------------------------------------
*    Retrieve next source record
*    ------------------------------------------------------

*    ------------------------------------------------------
*    Return the address of the record to the compiler.     
*    ------------------------------------------------------
     Set Exit-DataArea to Address of Record-Variable

*    ------------------------------------------------------
*    Set length of record in User-Exit Parameter List
*    ------------------------------------------------------
     Move 80 To Exit-DataLength

     Goback.

***************************************************
*    L I B E X I T   P R O C E S S O R            *
***************************************************
 Handle-LIBEXIT.
     Display "**** This module for INEXIT only"
     Move 16 To Exit-ReturnCode
     Goback.

*******************************************************
*    P R I N T  E X I T   P R O C E S S O R           *
*******************************************************
 Handle-PRTEXIT.
     Display "**** This module for INEXIT only"
     Move 16 To Exit-ReturnCode
     Goback.
*******************************************************

 End Program Skelinx.

ご利用条件 | フィードバック

このインフォメーション・センターでは Eclipse テクノロジーが採用されています。(http://www.eclipse.org)