Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.13 KB | None | 0 0
  1. identification division.
  2. program-id. Lab6.
  3.  
  4. environment division.
  5. *
  6. input-output section.
  7. file-control.
  8. *
  9. select input-file
  10. assign to "../../data/lab6.dat"
  11. organization is line sequential.
  12. *
  13. select output-file
  14. assign to "../../data/lab6.out"
  15. organization is line sequential.
  16. data division.
  17. file section.
  18. *
  19. * Input and Output files
  20. *
  21. fd input-file
  22. data record is input-line
  23. record contains 28 characters.
  24. *
  25. 01 input-line.
  26. 05 il-employee-num pic 999.
  27. 05 il-employee-name pic x(15).
  28. 05 il-education-code pic x(1).
  29. 05 il-years-service pic 99.
  30. 05 il-salary pic 9(5)V99.
  31. *
  32. fd output-file
  33. data record is output-line
  34. record contains 79 characters.
  35. *
  36. 01 output-line pic x(79).
  37. *
  38. working-storage section.
  39. *
  40. 01 ws-eof-flag pic x value 'N'.
  41. *
  42. * Calculation Variables and Constants
  43. *
  44. 77 ws-lines-per-page pic 99 value 10.
  45. 77 ws-page-count pic 99 value 0.
  46. 77 ws-line-count pic 99 value 0.
  47. 77 ws-years-service-calc pic 99 value 0.
  48. 77 ws-increase-perc-calc pic 99v9 value 0.
  49. 77 ws-analyst-label pic x(7) value "ANALYST".
  50. 77 ws-analyst-threshold pic 99 value 15.
  51. 77 ws-analyst-perc pic 99v9 value 12.8.
  52. 77 ws-sen-prog-label pic x(8) value "SEN PROG".
  53. 77 ws-sen-prog-threshold pic 99v9 value 7.
  54. 77 ws-sen-prog-perc pic 99v9 value 9.3.
  55. 77 ws-prog-label pic x(4) value "PROG".
  56. 77 ws-prog-threshold pic 99 value 7.
  57. 77 ws-prog-perc pic 99v9 value 6.7.
  58. 77 ws-unclassified-perc pic 99v9 value 0.
  59. 77 ws-nong-prog-threshold pic 99v9 value 10.
  60. 77 ws-jr-prog-label pic x(7) value "JR PROG".
  61. 77 ws-nong-jr-prog-threshold pic 99 value 4.
  62. 77 ws-jr-prog-perc pic 99v9 value 3.2.
  63.  
  64.  
  65.  
  66. *
  67. * Record Definitions
  68. *
  69. 01 ws-heading-line1.
  70. 05 filler pic x(1) value spaces.
  71. 05 ws-sys-date pic 9(6).
  72. 05 filler pic x(1) value spaces.
  73. 05 ws-sys-time pic 9(8).
  74. 05 filler pic x(1) value spaces.
  75. 05 filler pic x(22) value "Bobby Montminy, LAB 6".
  76. *
  77. 01 ws-heading-line2.
  78. 05 filler pic x(30).
  79. 05 filler pic x(22) value "EMPLOYEE SALARY REPORT".
  80. 05 filler pic x(14).
  81. 05 filler pic x(4) value "PAGE".
  82. 05 filler pic x(2).
  83. 05 ws-page-number pic 99.
  84. *
  85. 01 ws-heading-line3.
  86. 05 filler pic x(3) value "EMP".
  87. 05 filler pic x(2) value spaces.
  88. 05 filler pic x(3) value "EMP".
  89. 05 filler pic x(28) value spaces.
  90. 05 filler pic x(7) value "PRESENT".
  91. 05 filler pic x(2) value spaces.
  92. 05 filler pic x(8) value "INCREASE".
  93. 05 filler pic x(5) value spaces.
  94. 05 filler pic x(3) value "PAY".
  95. 05 filler pic x(11) value spaces.
  96. 05 filler pic x(3) value "NEW".
  97. *
  98. 01 ws-heading-line4.
  99. 05 filler pic x(3) value "NUM".
  100. 05 filler pic x(2) value spaces.
  101. 05 filler pic x(4) value "NAME".
  102. 05 filler pic x(10) value spaces.
  103. 05 filler pic x(5) value "YEARS".
  104. 05 filler pic x(1) value spaces.
  105. 05 filler pic x(8) value "POSITION".
  106. 05 filler pic x(4) value spaces.
  107. 05 filler pic x(6) value "SALARY".
  108. 05 filler pic x(5) value spaces.
  109. 05 filler pic x(1) value "%".
  110. 05 filler pic x(5) value spaces.
  111. 05 filler pic x(8) value "INCREASE".
  112. 05 filler pic x(7) value spaces.
  113. 05 filler pic x(6) value "SALARY".
  114. *
  115. 01 ws-detail-line.
  116. 05 ws-employee-num pic 999.
  117. 05 filler pic x(1) value spaces.
  118. 05 ws-employee-name pic x(15).
  119. 05 filler pic x(3) value spaces.
  120. 05 ws-years-service pic z9.
  121. 05 filler pic x(2) value spaces.
  122. 05 ws-position pic x(8).
  123. 05 filler pic x(2) value spaces.
  124. 05 ws-salary pic zz,zz9.99.
  125. 05 filler pic x(2) value spaces.
  126. 05 ws-increase-perc pic z9.9.
  127. 05 ws-perc-sign pic x(1) value "%".
  128. 05 filler pic x(4) value spaces.
  129. 05 ws-increase-amnt pic $$,$$9.99+.
  130. 05 filler pic x(2).
  131. 05 ws-new-salary pic $zzzzz,zz9.99.
  132. *
  133. 01 ws-total-line1.
  134. 05 filler pic x(15) value "EMPLOYEE CLASS:".
  135. 05 filler pic x(8) value spaces.
  136. 05 filler pic x(7) value "Analyst".
  137. 05 filler pic x(4) value spaces.
  138. 05 filler pic x(8) value "Sen Prog".
  139. 05 filler pic x(4) value spaces.
  140. 05 filler pic x(4) value "Prog".
  141. 05 filler pic x(4) value spaces.
  142. 05 filler pic x(7) value "Jr Prog".
  143. 05 filler pic x(2) value spaces.
  144. 05 filler pic x(12) value "Unclassified".
  145. *
  146. 01 ws-total-line2.
  147. 05 filler pic x(15) value "# ON THIS PAGE:".
  148. 05 filler pic x(14) value spaces.
  149. 05 ws-analyst-total pic 9 value 0.
  150. 05 filler pic x(11) value spaces.
  151. 05 ws-sen-prog-total pic 9 value 0.
  152. 05 filler pic x(7) value spaces.
  153. 05 ws-prog-total pic 9 value 0.
  154. 05 filler pic x(10) value spaces.
  155. 05 ws-jr-prog-total pic 9 value 0.
  156. 05 filler pic x(15) value spaces.
  157. 05 ws-unclassified-total pic 9 value 0.
  158.  
  159. procedure division.
  160. 000-Main.
  161. *
  162. * Open files
  163. *
  164. open input input-file,
  165. output output-file.
  166. *
  167. accept ws-sys-date from date.
  168. accept ws-sys-time from time.
  169. *
  170. * Initial read of input file
  171. *
  172. read input-file
  173. at end
  174. move 'Y' to ws-eof-flag.
  175.  
  176. write output-line from ws-heading-line1.
  177. *
  178. * Process each input record and read in next record
  179. *
  180. perform 100-process-pages
  181. until ws-eof-flag equals "y".
  182. *
  183. * Processed all records in perform loop
  184. * Handle output of totals and program completion
  185. *
  186. * Move totals to total line and write to output file
  187. * with blank line after total line
  188. *
  189.  
  190. *
  191. * Close files and end program
  192. *
  193. close input-file,
  194. output-file.
  195.  
  196.  
  197. stop run.
  198.  
  199. 100-process-pages.
  200.  
  201. add 1 to ws-page-count.
  202. move spaces to output-line.
  203. *
  204. * Write the report heading with a blank line before heading
  205. * and blank line after heading
  206. *
  207. if (ws-page-count > 1) then
  208. write output-line
  209. after advancing page
  210. write output-line
  211. write output-line from ws-heading-line2
  212. write output-line from ws-heading-line3
  213. write output-line from ws-heading-line4
  214. move spaces to output-line
  215. write output-line
  216. else
  217. write output-line
  218. write output-line from ws-heading-line2
  219. write output-line from ws-heading-line3
  220. write output-line from ws-heading-line4
  221. move spaces to output-line
  222. write output-line
  223. end-if.
  224. *
  225. * process input and output results until
  226. * current page has been filled
  227. * OR EOF has been encountered
  228. *
  229. perform 200-process-records
  230. varying ws-line-count from 1 by 1
  231. until (ws-line-count > ws-lines-per-page
  232. OR ws-eof-flag = "y").
  233.  
  234. perform 300-process-records.
  235.  
  236. 200-process-records.
  237. *
  238. move il-employee-num to ws-employee-num.
  239. move il-employee-name to ws-employee-name.
  240. move il-years-service to ws-years-service.
  241. move il-salary to ws-salary.
  242. move ws-years-service to ws-years-service-calc.
  243.  
  244.  
  245.  
  246. write output-line from ws-detail-line.
  247. *
  248. * Read next input record for the next iteration of perform loop
  249. *
  250. read input-file
  251. at end
  252. move 'y' to ws-eof-flag.
  253.  
  254. 300-process-records.
  255.  
  256. if il-education-code = "G" then
  257. if ws-years-service-calc > ws-analyst-threshold then
  258. move ws-analyst-label to ws-position
  259. move ws-analyst-perc to ws-increase-perc-calc
  260. end-if
  261. if ws-years-service-calc <= ws-analyst-threshold and
  262. ws-years-service-calc > ws-sen-prog-threshold then
  263. move ws-sen-prog-label to ws-position
  264. move ws-sen-prog-perc to ws-increase-perc-calc
  265. end-if
  266. if ws-years-service-calc <= ws-sen-prog-threshold and
  267. ws-years-service-calc > ws-prog-threshold then
  268. move ws-prog-label to ws-position
  269. move ws-prog-perc to ws-increase-perc-calc
  270. end-if
  271. if ws-years-service-calc <= ws-prog-threshold then
  272. move spaces to ws-position
  273. move ws-unclassified-perc to ws-increase-perc
  274. end-if
  275. else
  276. if ws-years-service-calc > ws-nong-prog-threshold then
  277. move ws-prog-label to ws-position
  278. move ws-prog-perc to ws-increase-perc-calc
  279. end-if
  280. if ws-years-service-calc <= ws-nong-prog-threshold and
  281. ws-years-service-calc > ws-nong-jr-prog-threshold then
  282. move ws-jr-prog-label to ws-position
  283. move ws-jr-prog-perc to ws-increase-perc-calc
  284. end-if
  285. if ws-years-service-calc < ws-nong-jr-prog-threshold then
  286. move spaces to ws-position
  287. move ws-unclassified-perc to ws-increase-perc-calc
  288. end-if
  289. end-if.
  290.  
  291. end program Lab6.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement