home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / viscobv6.zip / vac22os2 / ibmcobol / samples / winestr / bottle.cbl next >
Text File  |  1997-01-06  |  3KB  |  106 lines

  1.       * --------------------------------------------- *
  2.       *  BOTTLE.CBL
  3.       *     Bottle class for the Wine store sample.
  4.       *     Version 2
  5.       * --------------------------------------------- *
  6.  
  7.        IDENTIFICATION DIVISION.
  8.        CLASS-ID. "Bottle" inherits SOMObject.
  9.  
  10.        ENVIRONMENT DIVISION.
  11.        Configuration Section.
  12.        Repository.
  13.             CLASS SOMObject is "SOMObject"
  14.             CLASS Bottle is "Bottle".
  15.  
  16.        DATA DIVISION.
  17.        Working-Storage Section.
  18.        01   Wine-Type                  PIC X(20).
  19.        01   Wine-Cost                  PIC 9(3)V99.
  20.  
  21.        PROCEDURE DIVISION.
  22.  
  23.       * ========================================
  24.       * ========================================
  25.        Identification Division.
  26.        Method-Id. "GetType".
  27.        ENVIRONMENT DIVISION.
  28.        DATA DIVISION.
  29.        Linkage Section.
  30.        01  LS-Type                     PIC X(20).
  31.  
  32.        PROCEDURE DIVISION
  33.                    Returning LS-TYPE.
  34.            Move Wine-Type to LS-Type.
  35.            Exit Method.
  36.        End Method "GetType".
  37.  
  38.       * ========================================
  39.       * ========================================
  40.        Identification Division.
  41.        Method-Id. "SetType".
  42.        ENVIRONMENT DIVISION.
  43.        DATA DIVISION.
  44.        Linkage Section.
  45.        01  LS-Type                     PIC X(20).
  46.  
  47.        PROCEDURE DIVISION
  48.                    Using LS-TYPE.
  49.            Move LS-Type to Wine-Type.
  50.            Exit Method.
  51.        End Method "SetType".
  52.  
  53.       * ========================================
  54.       * ========================================
  55.        Identification Division.
  56.        Method-Id. "GetCost".
  57.        ENVIRONMENT DIVISION.
  58.        DATA DIVISION.
  59.        Linkage Section.
  60.        01  LS-Cost                     PIC 9(3)V99.
  61.  
  62.        PROCEDURE DIVISION
  63.                    Returning LS-Cost.
  64.            Move Wine-Cost to LS-Cost.
  65.            Exit Method.
  66.        End Method "GetCost".
  67.  
  68.       * ========================================
  69.       * ========================================
  70.        Identification Division.
  71.        Method-Id. "SetCost".
  72.        ENVIRONMENT DIVISION.
  73.        DATA DIVISION.
  74.        Linkage Section.
  75.        01  LS-Cost                     PIC 9(3)V99.
  76.  
  77.        PROCEDURE DIVISION
  78.                    Using LS-Cost.
  79.            Move LS-Cost to Wine-Cost.
  80.            Exit Method.
  81.        End Method "SetCost".
  82.  
  83.       * ========================================
  84.       * ========================================
  85.        IDENTIFICATION DIVISION.
  86.        Method-Id. "IsEqual".
  87.        DATA DIVISION.
  88.        Linkage Section.
  89.        01 ItemType                     PIC X(20).
  90.        01 ItemCost                     PIC 9(3)V99.
  91.        01 theEqualFlag                 PIC X.
  92.  
  93.        PROCEDURE DIVISION
  94.                    Using ItemType ItemCost
  95.                    Returning theEqualFlag.
  96.            Move Low-Value to theEqualFlag.
  97.             If (Wine-Type = ItemType) and (Wine-Cost = ItemCost)
  98.                Then Move High-Value to theEqualFlag.
  99.            Exit Method.
  100.        End Method "IsEqual".
  101.  
  102.       *---------------------------------
  103.        END CLASS "Bottle".
  104.  
  105.  
  106.