home *** CD-ROM | disk | FTP | other *** search
/ Sams Cobol 24 Hours / Sams_Cobol_24_Hours.iso / source / ch09 / CHAPT09E.COB < prev    next >
Text File  |  1998-09-14  |  6KB  |  138 lines

  1. 000010 @OPTIONS MAIN
  2. 000020 Identification Division.
  3. 000030 Program-Id.  Chapt09e.
  4. 000031* Complex If Vs Evaluate Example 3
  5. 000040 Environment Division.
  6. 000050 Configuration Section.
  7. 000051 Source-Computer.  IBM-PC.
  8. 000055 Object-Computer.  IBM-PC.
  9. 000056 Data Division.
  10. 000057 Working-Storage Section.
  11. 000058 01  Entry-Fields.
  12. 000059     03  Month-Of-Sale        Pic 99      Value 12.
  13. 000060     03  Category-Of-Sale     Pic X(4)    Value "JEWL".
  14. 000062     03  Sale-Item-Flag       Pic X       Value "Y".
  15. 000063         88  Sale-Item                    Value "Y".
  16. 000064     03  Full-Price           Pic 9(4)v99 Value 120.00.
  17. 000065     03  Sale-Price           Pic 9(4)v99 Value Zeros.
  18. 000066     03  Discount-Percent     Pic 999.
  19. 000072 Procedure Division.
  20. 000159 Chapt09e-Start.
  21. 000160     If Sale-Item
  22. 000161        If Month-Of-Sale = 01 Or 02 Or 03
  23. 000162           If Category-Of-Sale = "ANTI" Or "JEWL" Or "MISC"
  24. 000163              Move 50 To Discount-Percent
  25. 000164              Compute Sale-Price = Full-Price * .5
  26. 000165           Else
  27. 000166              If Category-Of-Sale = "XMAS" Or "CRAF"
  28. 000167                 Move 75 To Discount-Percent
  29. 000168                 Compute Sale-Price = Full-Price * .25
  30. 000169              Else
  31. 000170                 Move 10 To Discount-Percent
  32. 000171                 Compute Sale-Price = Full-Price * .90
  33. 000172              End-If
  34. 000173           End-If
  35. 000174        Else
  36. 000175           If Month-Of-Sale = 04 Or 05 Or 06
  37. 000176              If Category-Of-Sale = "XMAS" Or "CRAF"
  38. 000177                 Move 50 To Discount-Percent
  39. 000178                 Compute Sale-Price = Full-Price * .5
  40. 000179              Else
  41. 000180                 If Category-Of-Sale = "ANTI" Or "JEWL" Or "MISC"
  42. 000181                    Move 25 To Discount-Percent
  43. 000182                    Compute Sale-Price = Full-Price * .75
  44. 000183                 Else
  45. 000184                    Move 10 To Discount-Percent
  46. 000185                    Compute Sale-Price = Full-Price * .90
  47. 000186                 End-If
  48. 000187              End-If
  49. 000188           Else
  50. 000189              If Month-Of-Sale = 07 Or 08 Or 09
  51. 000190                 Move 25 To Discount-Percent
  52. 000191                 Compute Sale-Price = Full-Price *  .75
  53. 000192              Else
  54. 000193                 If Category-Of-Sale = "ANTI"
  55. 000194                    Move 50 To Discount-Percent
  56. 000195                    Compute Sale-Price = Full-Price * .5
  57. 000196                 Else
  58. 000197                    Move 10 To Discount-Percent
  59. 000198                    Compute Sale-Price = Full-Price * .9
  60. 000199                 End-If
  61. 000200              End-If
  62. 000201           End-If
  63. 000202        End-If
  64. 000203     Else
  65. 000204        Move Full-Price To Sale-Price
  66. 000205     End-If
  67. 000206     Display "Full Price " Full-Price
  68. 000207     Display "Sale Price " Sale-Price
  69. 000208     Evaluate Sale-Item Also Month-Of-Sale Also Category-Of-Sale
  70. 000209        When True Also 1 Thru 3 Also "ANTI"
  71. 000210        When True Also 1 Thru 3 Also "JEWL"
  72. 000211        When True Also 1 Thru 3 Also "MISC"
  73. 000212             Move 50 To Discount-Percent
  74. 000213             Compute Sale-Price = Full-Price * .5
  75. 000214        When True Also 1 Thru 3 Also "XMAS"
  76. 000215        When True Also 1 Thru 3 Also "CRAF"
  77. 000216             Move 75 To Discount-Percent
  78. 000217             Compute Sale-Price = Full-Price * .25
  79. 000218        When True Also 1 Thru 3 Also Any
  80. 000219             Move 10 To Discount-Percent
  81. 000220             Compute Sale-Price = Full-Price * .9
  82. 000221        When True Also 4 Thru 6 Also "XMAS"
  83. 000222        When True Also 4 Thru 6 Also "CRAF"
  84. 000223             Move 50 To Discount-Percent
  85. 000224             Compute Sale-Price = Full-Price * .5
  86. 000225        When True Also 4 Thru 6 Also "ANTI"
  87. 000226        When True Also 4 Thru 6 Also "JEWL"
  88. 000227        When True Also 4 Thru 6 Also "MISC"
  89. 000228             Move 25 To Discount-Percent
  90. 000229             Compute Sale-Price = Full-Price * .75
  91. 000230        When True Also 4 Thru 6 Also Any
  92. 000231             Move 10 To Discount-Percent
  93. 000232             Compute Sale-Price = Full-Price * .90
  94. 000233        When True Also 6 Thru 9 Also Any
  95. 000234             Move 25 To Discount-Percent
  96. 000235             Compute Sale-Price = Full-Price * .75
  97. 000236        When True Also 10 Thru 12 Also "ANTI"
  98. 000237             Move 50 To Discount-Percent
  99. 000238             Compute Sale-Price = Full-Price * .5
  100. 000239        When True Also 10 Thru 12 Also Any
  101. 000240             Move 10 To Discount-Percent
  102. 000241             Compute Sale-Price = Full-Price * .9
  103. 000242        When Other
  104. 000243             Move Full-Price To Sale-Price
  105. 000244     End-Evaluate
  106. 000247     Display "Full Price " Full-Price
  107. 000248     Display "Sale Price " Sale-Price
  108. 000249     Evaluate Sale-Item Also Month-Of-Sale Also Category-Of-Sale
  109. 000250        When True Also 1 Thru 3 Also "ANTI"
  110. 000251        When True Also 1 Thru 3 Also "JEWL"
  111. 000252        When True Also 1 Thru 3 Also "MISC"
  112. 000253        When True Also 4 Thru 6 Also "XMAS"
  113. 000254        When True Also 4 Thru 6 Also "CRAF"
  114. 000255        When True Also 10 Thru 12 Also "ANTI"
  115. 000257             Move 50 To Discount-Percent
  116. 000258             Compute Sale-Price = Full-Price * .5
  117. 000259        When True Also 1 Thru 3 Also "XMAS"
  118. 000260        When True Also 1 Thru 3 Also "CRAF"
  119. 000261             Move 75 To Discount-Percent
  120. 000262             Compute Sale-Price = Full-Price * .25
  121. 000269        When True Also 4 Thru 6 Also "ANTI"
  122. 000270        When True Also 4 Thru 6 Also "JEWL"
  123. 000271        When True Also 4 Thru 6 Also "MISC"
  124. 000272        When True Also 6 Thru 9 Also Any
  125. 000274             Move 25 To Discount-Percent
  126. 000275             Compute Sale-Price = Full-Price * .75
  127. 000277        When True Also 1 Thru 3 Also Any
  128. 000278        When True Also 4 Thru 6 Also Any
  129. 000279        When True Also 10 Thru 12 Also Any
  130. 000281             Move 10 To Discount-Percent
  131. 000282             Compute Sale-Price = Full-Price * .9
  132. 000291        When Other
  133. 000292             Move Full-Price To Sale-Price
  134. 000293     End-Evaluate
  135. 000294     Display "Full Price " Full-Price
  136. 000295     Display "Sale Price " Sale-Price
  137. 000297     Stop Run
  138. 000298     .