home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / zbasic / pia / config.bas < prev    next >
BASIC Source File  |  1987-10-30  |  13KB  |  272 lines

  1. 100 DEFINT A,G,I,K,M,N,P,S,T,U,W: DEFDBL B,C,D,L,O
  2. 101 DEFSNG E,F,H,J,Q,R,V,X,Y,Z
  3. 105 REM $INCLUDE: 'COMMON.BAS'
  4. 110 REM $INCLUDE: 'GETSTRN.BAS'
  5. 500 REM Read historical amounts from OLDAWBI.DAT
  6. 505 OPEN "I",1,"OLDAWBI.DAT"
  7. 510 PRINT "   Reading historical amounts from OLDAWBI.DAT"
  8. 515 INPUT #1,N4: CLOSE #1
  9. 600 REM Read titles of assumptions from TITLES.DAT
  10. 605 OPEN "I",1,"TITLES.DAT"
  11. 610 PRINT "   Reading titles of assumptions from TITLES.DAT"
  12. 615 FOR I1=1 TO 4: INPUT #1,E$(I1): W$(I1)=E$(I1): NEXT I1
  13. 620 CLOSE #1
  14. 700 REM Set titles of built-in assumptions
  15. 702 E$(5)="No increase beyond"+STR$(1949+N4)+" average wage"
  16. 703 E$(6)="Current POMS calculation (4-percent nominal wage increases)"
  17. 705 E$(7)="Proposed POMS calculation (1-percent real wage increases)"
  18. 710 E$(8)="Other assumptions (input from keyboard)"
  19. 715 W$(5)="No increase beginning with"+STR$(1951+N4)+" benefit increase"
  20. 716 W$(6)="Current POMS calculation (no future benefit increases)"
  21. 720 W$(7)="Proposed POMS calculation (no future benefit increases)"
  22. 725 W$(8)=E$(8)
  23. 1000 REM Read configuration
  24. 1005 GOSUB 5000
  25. 1018 REM Print configuration menu
  26. 1020 GOSUB 2600: PRINT "   ";: GOSUB 9870
  27. 1025 PRINT STRING$(22," ");"Review or update configuration";
  28. 1030 PRINT STRING$(23," "): GOSUB 2700
  29. 1040 GOSUB 9860
  30. 1050 PRINT "   Enter choice for review or update of configuration"
  31. 1051 PRINT "     0 to skip review of configuration"
  32. 1052 PRINT "     1 to review configuration"
  33. 1053 PRINT "     2 to update configuration"
  34. 1055 PRINT "   > ";: K8=VAL(FNGETSTRN$(1))
  35. 1060 IF K8<0 OR K8>2 THEN BEEP: GOTO 1040
  36. 1065 GOSUB 9850: ON K8+1 GOTO 2400,1100,1068
  37. 1068 REM print warning
  38. 1070 GOSUB 2600: PRINT "   ";: GOSUB 9870
  39. 1071 PRINT STRING$(33," ");"Warning!";STRING$(34," "): GOSUB 2700
  40. 1073 GOSUB 9850: PRINT "   You are about to change the ";
  41. 1074 PRINT "configuration data file for this program."
  42. 1075 PRINT "   This means that you will permanently alter the ";
  43. 1076 PRINT "prompts that will"
  44. 1077 PRINT "   appear on the screen when you run the program (until";
  45. 1078 PRINT " you change the"
  46. 1080 PRINT "   configuration again).": PRINT
  47. 1081 PRINT "   There are eight program variables to be configured.  If";
  48. 1082 PRINT " you enter a"
  49. 1083 PRINT "   0 for a configuration, that variable will appear with a";
  50. 1084 PRINT " menu choice"
  51. 1085 PRINT "   when you run the PIA program.  If you enter a positive ";
  52. 1086 PRINT "value, that": PRINT "   variable will automatically be ";
  53. 1087 PRINT " given that value, without any menu"
  54. 1088 PRINT "   choice offered": PRINT
  55. 1089 PRINT "   There are also two hardware configurations to be set: ";
  56. 1090 PRINT " one for your"
  57. 1091 PRINT "   printer and one for your monitor.": PRINT
  58. 1092 GOSUB 9860: PRINT "   Do you want to continue? (y or n) > ";
  59. 1093 C$=FNGETSTRN$(1): GOSUB 9850
  60. 1094 IF LEN(C$)<=0 THEN BEEP: GOTO 1092
  61. 1095 GOSUB 2800: IF C$<>"Y" AND C$<>"N" THEN BEEP: GOTO 1092
  62. 1096 IF C$<>"Y" THEN 2200
  63. 1100 REM Display sex of worker
  64. 1105 GOSUB 2600: PRINT "   ";: GOSUB 9870
  65. 1110 PRINT STRING$(24," ");"Sex-of-worker configuration";
  66. 1115 PRINT STRING$(24," "): GOSUB 2700: GOSUB 9850
  67. 1125 PRINT "   Current sex-of-worker configuration:"
  68. 1130 IF A6=0 THEN PRINT "   0 (menu choice offered)": GOTO 1140
  69. 1135 PRINT "  ";A6;"for ";A$(A6);" worker"
  70. 1140 IF K8=1 THEN GOSUB 3000: GOTO 1200
  71. 1145 GOSUB 9860
  72. 1150 PRINT "   Enter choice for sex-of-worker configuration:"
  73. 1155 PRINT "     0 to request prompt for sex of worker"
  74. 1160 FOR K2=1 TO 2: PRINT "    ";K2;"for ";A$(K2);" worker": NEXT K2
  75. 1165 PRINT "   > ";: A6=VAL(FNGETSTRN$(1)): GOSUB 9850
  76. 1170 IF A6<0 OR A6>2 THEN BEEP: GOTO 1145
  77. 1200 REM Display type of benefit
  78. 1205 GOSUB 2600: PRINT "   ";: GOSUB 9870
  79. 1210 PRINT STRING$(23," ");"Type-of-benefit configuration";
  80. 1215 PRINT STRING$(23," "): GOSUB 2700: GOSUB 9850
  81. 1225 PRINT "   Current type-of-benefit configuration:"
  82. 1230 IF A5=0 THEN PRINT "   0 (menu choice offered)": GOTO 1240
  83. 1235 PRINT "  ";A5;"for ";P$(A5);" benefit"
  84. 1240 IF K8=1 THEN GOSUB 3000: GOTO 1300
  85. 1245 GOSUB 9860
  86. 1250 PRINT "   Enter choice for type-of-benefit configuration:"
  87. 1255 PRINT "     0 to request prompt for type of benefit"
  88. 1260 FOR K2=1 TO 3: PRINT "    ";K2;"for ";P$(K2);" benefit": NEXT K2
  89. 1265 PRINT "   > ";: A5=VAL(FNGETSTRN$(1)): GOSUB 9850
  90. 1270 IF A5<0 OR A5>3 THEN BEEP: GOTO 1245
  91. 1300 REM Display type of earnings
  92. 1305 GOSUB 2600: PRINT "   ";: GOSUB 9870
  93. 1310 PRINT STRING$(22," ");"Type-of-earnings configuration";
  94. 1315 PRINT STRING$(23," "): GOSUB 2700: GOSUB 9850
  95. 1325 PRINT "   Current type-of-earnings configuration:"
  96. 1330 IF A3=0 THEN PRINT "   0 (menu choice offered)": GOTO 1340
  97. 1335 PRINT "  ";A3;"for ";Q$(A3)
  98. 1340 IF K8=1 THEN GOSUB 3000: GOTO 1400
  99. 1345 GOSUB 9860
  100. 1350 PRINT "   Enter choice for type-of-earnings configuration:"
  101. 1355 PRINT "     0 to request prompt for type of earnings"
  102. 1360 FOR K2=1 TO 4: PRINT "    ";K2;"for ";Q$(K2): NEXT K2
  103. 1365 PRINT "   > ";: A3=VAL(FNGETSTRN$(1)): GOSUB 9850
  104. 1370 IF A3<0 OR A3>4 THEN BEEP: GOTO 1345
  105. 1400 REM Display type of survivor
  106. 1405 GOSUB 2600: PRINT "   ";: GOSUB 9870
  107. 1410 PRINT STRING$(22," ");"Type-of-survivor configuration";
  108. 1415 PRINT STRING$(23," "): GOSUB 2700: GOSUB 9850
  109. 1425 PRINT "   Current type-of-survivor configuration:"
  110. 1430 IF A4=0 THEN PRINT "   0 (menu choice offered)": GOTO 1440
  111. 1435 PRINT "  ";A4;"for ";N$(A4)
  112. 1440 IF K8=1 THEN GOSUB 3000: GOTO 1500
  113. 1445 GOSUB 9860
  114. 1450 PRINT "   Enter choice for type-of-survivor configuration:"
  115. 1455 PRINT "     0 to request prompt for type of survivor"
  116. 1460 FOR K2=1 TO 3: PRINT "    ";K2;"for ";N$(K2): NEXT K2
  117. 1465 PRINT "   > ";: A4=VAL(FNGETSTRN$(1)): GOSUB 9850
  118. 1470 IF A4<0 OR A4>3 THEN BEEP: GOTO 1445
  119. 1500 REM Display disability code
  120. 1505 GOSUB 2600: PRINT "   ";: GOSUB 9870
  121. 1510 PRINT STRING$(25," ");"Disability configuration";
  122. 1515 PRINT STRING$(26," "): GOSUB 2700: GOSUB 9850
  123. 1525 PRINT "   Current disability configuration:"
  124. 1530 IF T9=0 THEN PRINT "   0 (menu choice offered)": GOTO 1540
  125. 1535 PRINT "  ";T9;"for ";X$(T9)
  126. 1540 IF K8=1 THEN GOSUB 3000: GOTO 1600
  127. 1545 GOSUB 9860
  128. 1550 PRINT "   Enter choice for disability configuration:"
  129. 1555 PRINT "     0 to request prompt for disability code"
  130. 1560 FOR K2=1 TO 2: PRINT "    ";K2;"for ";X$(K2): NEXT K2
  131. 1565 PRINT "   > ";: T9=VAL(FNGETSTRN$(1)): GOSUB 9850
  132. 1570 IF T9<0 OR T9>2 THEN BEEP: GOTO 1545
  133. 1600 REM Display benefit increase assumptions
  134. 1605 GOSUB 2600: PRINT "   ";: GOSUB 9870
  135. 1610 PRINT STRING$(22," ");"Benefit-increase configuration";
  136. 1615 PRINT STRING$(23," "): GOSUB 2700: GOSUB 9850
  137. 1625 PRINT "   Current benefit-increase-assumption configuration:"
  138. 1630 IF A1=0 THEN PRINT "   0 (menu choice offered)": GOTO 1640
  139. 1635 PRINT "  ";A1;"for ";W$(A1)
  140. 1640 IF K8=1 THEN GOSUB 3000: GOTO 1700
  141. 1645 GOSUB 9860
  142. 1650 PRINT "   Enter choice for benefit-increase configuration:"
  143. 1655 PRINT "     0 to request prompt for benefit increase assumptions"
  144. 1660 FOR K2=1 TO W3: PRINT "    ";K2;"for ";W$(K2): NEXT K2
  145. 1665 PRINT "   > ";: A1=VAL(FNGETSTRN$(1)): GOSUB 9850
  146. 1670 IF A1<0 OR A1>W3 THEN BEEP: GOTO 1645
  147. 1700 REM Display average wage increase assumptions
  148. 1705 GOSUB 2600: PRINT "   ";: GOSUB 9870
  149. 1710 PRINT STRING$(20," ");"Average-wage-increase configuration";
  150. 1715 PRINT STRING$(20," "): GOSUB 2700: GOSUB 9850
  151. 1725 PRINT "   Current average-wage-increase-assumption configuration:"
  152. 1730 IF T3=0 THEN PRINT "   0 (menu choice offered)": GOTO 1740
  153. 1735 PRINT "  ";T3;"for ";E$(T3)
  154. 1740 IF K8=1 THEN GOSUB 3000: GOTO 1800
  155. 1745 GOSUB 9860
  156. 1750 PRINT "   Enter choice for average-wage-increase configuration:"
  157. 1755 PRINT "     0 to request prompt for average wage assumptions"
  158. 1760 FOR K2=1 TO W3: PRINT "    ";K2;"for ";E$(K2): NEXT K2
  159. 1765 PRINT "   > ";: T3=VAL(FNGETSTRN$(1)): GOSUB 9850
  160. 1770 IF T3<0 OR T3>W3 THEN BEEP: GOTO 1745
  161. 1800 REM Display projected wage base trigger
  162. 1805 GOSUB 2600: PRINT "   ";: GOSUB 9870
  163. 1810 PRINT STRING$(21," ");"Projected-wage-base configuration";
  164. 1815 PRINT STRING$(21," "): GOSUB 2700: GOSUB 9850
  165. 1825 PRINT "   Current projected-wage-base-assumption configuration:"
  166. 1830 IF A2=0 THEN PRINT "   0 (menu choice offered)": GOTO 1840
  167. 1835 PRINT "  ";A2;"for ";R$(A2)
  168. 1840 IF K8=1 THEN GOSUB 3000: GOTO 1900
  169. 1845 GOSUB 9860
  170. 1850 PRINT "   Enter choice for projected-wage-base configuration:"
  171. 1855 PRINT "     0 to request prompt for projected wage bases"
  172. 1860 FOR K2=1 TO 2: PRINT "    ";K2;"for ";R$(K2): NEXT K2
  173. 1865 PRINT "   > ";: A2=VAL(FNGETSTRN$(1)): GOSUB 9850
  174. 1870 IF A2<0 OR A2>2 THEN BEEP: GOTO 1845
  175. 1900 REM Display printer configuration
  176. 1905 GOSUB 2600: PRINT "   ";: GOSUB 9870
  177. 1910 PRINT STRING$(27," ");"Printer configuration";
  178. 1915 PRINT STRING$(27," "): GOSUB 2700: GOSUB 9850
  179. 1925 PRINT "   Current printer configuration:"
  180. 1930 IF G8>0 THEN 1935
  181. 1931 PRINT "   0 for printing on continuous paper": GOTO 1940
  182. 1935 PRINT "   1 for printing on cut sheets (stops at each page)"
  183. 1940 IF K8=1 THEN GOSUB 3000: GOTO 2000
  184. 1945 GOSUB 9860
  185. 1950 PRINT "   Enter choice for printer configuration:"
  186. 1955 PRINT "     0 for printing on continuous paper"
  187. 1960 PRINT "     1 for printing on cut sheets (stops at each page)"
  188. 1965 PRINT "   > ";: G8=VAL(FNGETSTRN$(1)): GOSUB 9850
  189. 1970 IF G8<0 OR G8>1 THEN BEEP: GOTO 1945
  190. 2000 REM Display color configuration
  191. 2005 GOSUB 2600: PRINT "   ";: GOSUB 9870
  192. 2010 PRINT STRING$(28," ");"Color configuration";
  193. 2015 PRINT STRING$(28," "): GOSUB 2700: GOSUB 9850
  194. 2025 PRINT "   Current color configuration:"
  195. 2030 IF K5>0 THEN 2035
  196. 2031 PRINT "   0 for monochrome monitor": GOTO 2040
  197. 2035 PRINT "   1 for color monitor"
  198. 2040 IF K8=1 THEN GOSUB 3000: GOTO 2075
  199. 2045 GOSUB 9860
  200. 2050 PRINT "   Enter choice for color configuration:"
  201. 2055 PRINT "     0 for monochrome monitor"
  202. 2060 PRINT "     1 for color monitor"
  203. 2065 PRINT "   > ";: K5=VAL(FNGETSTRN$(1)): GOSUB 9850
  204. 2070 IF K5<0 OR K5>1 THEN BEEP: GOTO 2045
  205. 2075 ON K8 GOTO 2200,2100
  206. 2100 REM Save to disk
  207. 2105 GOSUB 2600: PRINT "   ";: GOSUB 9870
  208. 2110 PRINT STRING$(31," ");"Save to disk";STRING$(32," ")
  209. 2115 GOSUB 2700
  210. 2120 GOSUB 9860: PRINT "   Do you want to save the updated values";
  211. 2125 PRINT " to disk? (y or n) > ";: C$=FNGETSTRN$(1): GOSUB 9850
  212. 2126 IF LEN(C$)<=0 THEN BEEP: GOTO 2120
  213. 2130 GOSUB 2800: IF C$<>"Y" AND C$<>"N" THEN BEEP: GOTO 2120
  214. 2135 IF C$<>"Y" THEN 2200
  215. 2140 OPEN "O",1,"CONFIG.DAT"
  216. 2145 PRINT "   Writing configuration to CONFIG.DAT"
  217. 2150 PRINT #1,A6: PRINT #1,A5: PRINT #1,A3: PRINT #1,A4: PRINT #1,T9
  218. 2155 PRINT #1,A1: PRINT #1,T3: PRINT #1,A2: PRINT #1,G8: PRINT #1,K5
  219. 2160 CLOSE #1
  220. 2165 REM Initialize colors
  221. 2170 GOSUB 5100
  222. 2200 REM Print exit menu
  223. 2205 GOSUB 2600: PRINT "   ";: GOSUB 9870
  224. 2210 PRINT STRING$(29," ");"Program selection";STRING$(29," ")
  225. 2215 GOSUB 2700
  226. 2220 GOSUB 9860: PRINT "   Enter desired program:"
  227. 2225 PRINT "     0 to calculate a PIA"
  228. 2230 PRINT "     1 to review or update historical values"
  229. 2235 PRINT "     2 to store social security office address"
  230. 2240 PRINT "   > ";: K8=VAL(FNGETSTRN$(1))
  231. 2245 IF K8<0 OR K8>2 THEN BEEP: GOTO 2220
  232. 2250 CLS: GOSUB 9850: ON K8+1 GOTO 2400,2265,2255
  233. 2255 PRINT "   Loading address program; please wait..."
  234. 2260 CHAIN "ADDRESS"
  235. 2265 PRINT "   Loading data-update program; please wait..."
  236. 2270 CHAIN "OLDAWBI"
  237. 2400 PRINT "   Loading PIA data-input program; please wait..."
  238. 2405 CHAIN "PIAIN"
  239. 2600 REM Subroutine to clear screen and draw 75 hyphens
  240. 2605 CLS: GOSUB 9860: PRINT "   ";STRING$(75,"-"): RETURN
  241. 2700 REM Subroutine to draw 75 hyphens and skip two lines
  242. 2705 GOSUB 9860: PRINT "   ";STRING$(75,"-"): PRINT: PRINT: RETURN
  243. 2800 REM Subroutine to convert response to one-letter uppercase
  244. 2805 I4=ASC(C$): IF I4>96 THEN C$=CHR$(I4-32) ELSE C$=CHR$(I4)
  245. 2810 RETURN
  246. 3000 REM Subroutine to get a RETURN
  247. 3005 GOSUB 9860: PRINT: PRINT "   Press RETURN to continue"
  248. 3010 C$=INKEY$: IF LEN(C$)<1 THEN 3010
  249. 3015 IF ASC(C$)<>13 THEN BEEP: GOTO 3010
  250. 3020 RETURN
  251. 5000 REM Subroutine to get configuration
  252. 5004 ON ERROR GOTO 5030
  253. 5005 OPEN "I",1,"CONFIG.DAT": GOSUB 9850
  254. 5006 ON ERROR GOTO 0
  255. 5010 PRINT "   Reading configuration from CONFIG.DAT"
  256. 5015 INPUT #1,A6: INPUT #1,A5: INPUT #1,A3: INPUT #1,A4: INPUT #1,T9
  257. 5020 INPUT #1,A1: INPUT #1,T3: INPUT #1,A2: INPUT #1,G8: INPUT #1,K5
  258. 5025 CLOSE #1: RETURN
  259. 5030 REM Handle file error
  260. 5035 BEEP: GOSUB 9840: K6=66
  261. 5040 PRINT "   Configuration file does not exist."
  262. 5045 END
  263. 5100 REM Subroutine to initialize colors
  264. 5105 FOR I1=0 TO 8
  265. 5110 IF K5>0 THEN K(I1,2)=K(I1,0) ELSE K(I1,2)=7
  266. 5115 NEXT I1: RETURN
  267. 9800 REM 1-line subroutines
  268. 9813 REM For Macintosh, $INCLUDE "COLOR.MAC"
  269. 9814 REM $INCLUDE: 'COLOR.BAS'
  270. 9900 GOSUB 9860: CLS: END
  271. 9999 REM CONFIG.BAS - 10/30/87 - 03:45 PM
  272.