88 888888 88SIISISISISISISISISIS IS IS IS ISISISI+S IS IS ISISISSIISISISISISISISISIS IS IS IS ISISISI+S IS IS ISISISSIISISISISISISISISIS IS IS IS ISISISI+S IS IS ISISISSIISISISISISISISISIS IS IS IS ISISISI+S IS IS ISISISSIISISISISISISISISIS IS IS IS ISISISI+S IS IS ISISISSIISISISISISISISISIS IS IS IS ISISISI+S IS IS ISISISSIISISISISISISISISIS IS IS IS ISISISI+S IS IS ISISISKKKKKKKKKKKKKKKKKKKKK CBC0BBC<BЈC|BȈCCCCCCCC4CCtC,CCCBCBK # s ʣ@] Ƨ  >CˆCĈCƈCȈCʈC̈CΈCЈC҈CԈCֈC؈CڈC܈CވCCCC     %    '  r6    %+    & #p P + \ /' #   / $ *' 0 6-w <+ B  ' H-#'  N T s6s*sG ] ʣ@]A>} ʣ*sk Э < Y  ,s, ЭA  Y ʣ@@,  % Q   'jn @Ez "ra㉣9% '' %'% '" rO '% %'')% )% # '  #  %   )' /#  / #   / $ *' 0 6-w <+ B  ' H-#'  N TB + %'  #) %+  5  +?sbQ" Y c As> Y s yD} Y@9s yS 鄻 A pQ \ %sP ƻ {ByA} %s# ʣ@A@4s  +@M %'')%|  '%O  ''A @+ 1 )'  ' ;7C9 rF) ' %'AMG;7C9C' 99~)  +  /~ 3+w '  GB B0B@@BPAB}  '  ;VqVY % x* p # N d#    R $  * #Q79; $ 3 v '# # j# B  ^ H KCC C$B`BpC CCCCC(CChCC8CClCCpCxCCCCCKCCCCCCCCC@CDCHCLCPCTCXC\C`CdBBBCCBBKknkn rXㄣa-')%  # |=  %+ '      p p lr p       '#qV    r  ''6  'x ; 'F #%  Z `#   f#r l #  r '# # x= ~ ' 33 33'~  # '1  '' '# %    ;  '  ;   Y s yD} Y@s 4&p Q S ܣ@c &Hs} ƻB} Ay B{B  y ~ H!r @ ~ !p sY ] ʣ@] Ƨ  #Lread  B  ~ C-1 - ~ )%  v6  - ~ #^ 'r& /   )'  '    ' + X #% 0 L-#' 6 F  ' $  :-   /  nopqrs .'  '1 '#  " /  #   /#  )'    %  #  # ' KCBCCBCCCB؈CBCCCCCCCCCCCCCCAd +*  zzpop` )   zzfn )!>   zzrpt|}   zzshape u(p     }X  zzrank   zzname[  6zzc)02+ 2     zzn )0 ) 26u/$ ^$+<a+52 )<[zzshapeRzzx *p/2  zzendx }X ug/$ ^$ )X )!> )p  zzi z6n zzmassage  zztypeK "&v ( & , 2 > D J PKzzx"  Nzzsh   2o22qQ 8v6~^nr&N>~"~~~~~~~l~n~^~N}~>~.}~~}}w~}}}.}v2/ ,)0 '"'IA+%&~#/$ )< +5 )0@+E )5% fzze V/EFvM/ I"erase zzpop zzmassage zzget zzcreate zzcommand zzhelp<*<E~ B "Yzzx x}/% )/   `zzfilev   Zzzwsidq V , t z            „ Ȅ ΄ Ԅ ڄ       "(.4:@FLRXzzȃzz`zyȃz؅HINy/ Fdisplaying the workspace. it is now ready to save.@* IFFy/ D2" the computer will respond by changing the wsid and=*F?Fy/ 1" tyZ`flrx~Ƅ̄҄؄ބ &, Prs㉣=' )' #-%) rs(v)/ &)0 '"'IA@)+ vV/*zs  jyy(vww(wPxЃxwx w x w n v|v txwhx/$ t^ upzzr &upzzup ,upzznl 2upzzc v 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzzzfile bzzzzew hzzzzcreate nzzloop tzzquit zzi >runq \pf t΃wt> w v q> l ` /'C Os5 ʣ@A 5q儣B'  ] ]% -#'' 5Cst ҳ Э]DDkS ] ]  `)~(uC/$ )0 )  zzget  zzxack! zzunpack- zzw|2 zzunpack zzx zzwyx zzhelp zzws zzn zzi .Hzzb zzran Bzzd+[I?F { |@u{h ts`5?  xquit+D  zzyup,0Rz $zzr   rloopX  &/$ )0($($@G@+ u^/$ )0@}~}}nr} }^vw33wnw}w^w>|wNw~||v/v&vFr6w. "vV  >v}N}> 2 D J h b ppV n]z  lzzcreate~/$ ^$ )0 )8 *( /  endif )! vh/ "fns * 2v/($A}+2!$ u/$ ^+  vq/*-6'   zzchar)<   zznum*!>  &u/$ )Zcnf*!> )< )< )^djpv|ĄʄЄք܄ $*06<BHNT1pe in > zzcreate Kname of wsfile createdK6*CA?y/ how to use>*r^ y/*  y/*   zzhelp y  *zzup #  <zzcommand  0zznl  v_/* zzco = # 1-''   ' + #'   F # P8rj㉣X;'1  +  '  .  8 r  r|-' p 6 T +% +p \ %c9] ħ A]+l R p($@c+xG/$'02 )/x>/$'02 )*< /xb/$ '02 )t'02rx? V   b  zzws1+ x/$($'v;/ I"wsid *< )age z vz/*uPs  vD/*-3' HN  ЭA ] A.r ʣ@A  nuFrƃqtrtvuqs u tN u~ sփu qvtw E?r'  # ] ] AC*sQ S ܣ@c; *p ģ @p mN m~ Z  ~vvvnoރop.sp'Z.s zztype zzget zzname u  zzmassage zzrank zzshape} zzpop zzrpt zzend zzchar zznum zzfn zzy up upendif 9. 02 chemistry pic 9. 02 english pic 9. procedure division. perform read-index. if index-exists = 'yes' !perform display-student-records. &stop run. display-student-records. open input student^ 6 :s`:m: 3+wsxOYPuR; yxz yx}p}0 u} ~}~~}@||~~Pup|`~`{{(@ v{}} pic x. 01 student-id pic x. 01 index-exists pic x. 01 number-of-keys pic 99. 01 i pic 9. 01 student-index. 02 index-key pic x' occurs 18 times. 01 student-data. 02 student-no pi R X ^ d j p v |            Ą ʄ Є ք ܄      $*06<BH x-file assign to 'indfile'. select student-inquiry assign to 'dirfile,rel' organization is relative access is random Wrelative key is student-key. data division. file section. fd student-inquiryPV\bhntz„Ȅ΄Ԅڄ "(.4 3 $keys move 'yes' to index-exists. +close index-file. store-and-read-index. add 1 to i. move student-id to index-key(i) 1perform read-index-record. read-index-record. read index-file into student-id at end mov#$ )5 )um> ])'.uy/% )<+5 )0 )I@T+ )0 )'up/% )0 )<2 ) uL/$ )02 )zzshapeu:/$ )0@ +E )x$-u1/$ )0 )"'uU/$ )08-+'~,/$ ^$ )0 )J'!F )Rz. move 'no' to student-found. perform find-key varying i from 1 by 1 @until i > number-of-keys or student-found = 'yes'. find-key. if student-id =index-key(i) move i to student-key move 'yes' to studv/keyboard*$($A+ :}wȃ{Hy8yh{w{8|p | yX v uu|($P v/ "vars *re#&xt/$ n^$ +D5 )0 )!> t) -inquiry. perform get-student-id. perform process-student-records until student-id = 'stop'. 3close student-inquiry. process-student-records. perform find-student-key. if student-found = 'yes' read student-inq2}zz| |{w|0~p~@     z       „ Ȅ ΄ Ԅ ڄ            " ( . 4 : @ F Lc x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x. 02 school pic x. 02 algebra pic 9. 02 geometry pic 9. 02 physics pic NTZ`flrx~Ƅ̄҄؄ބ &,28>DJ 0label records are standard. 01 direct-record. '02 filler pic x(60). fd index-file /label records are standard. 01 index-record. 02 filler pic x0. working-storage section. 01 student-key pic 9. 01 student-found# $:I U  D ~5/$ )0 )E ))zx 345 8>u/$ ^$+<1+52 )<[zzshapeRzzx,K,0K*[zznUz846u/$+<1+5 '0 )< )< 7 )< )!< )q4).u/$ ^$+<+5(8e high-values to student-id. open input index-file. move 'no' to index-exists. move 0 to i. perform read-index-record. perform store-and-read-index until student-id = high-values. if i > 0 move i to number-of-& ~/$ '] )!> )X tttxtȃ~ }Pt` t0 | | s } s t 66v/ ($ B +5 &)!< A+5 ,)!!$($A +6ent-found. read-index. open input index-file. move 'no' to index-exists. move 0 to i. perform read-index-record. perform store-and-read-index until student-id = high-values. if i > 0 move i to number-of- ;#x/% n)u'.x/$ :t"disk/1. *< V)!$($@J+rXrX'!&x,/$wsid> K*< )0 )!02 school-data pic x(10) occurs 3 times. 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x. 02  = high-values. perform display-averages varying i from 1 by 1 until i > 3. close student-file screen. #stop run. process-student-data. perform process-student-marks. perform read-student-record.  02 filler 'pic x(30) value is 'Algebra Averages'. 02 filler /pic x(30) value is spaces. 01 school-line. 02 filler $pic x(13) value is ' Average for '. 02 out-school pic x(10). 02 filler pic x(4) value isess-student-marks. move school to i. 'add 1 to counts(i). display-totals. move i to out-school. move counts(i) to out-count. 'write display-record from school-line. $add 1 to i. read-student-record. read student-file process-student-marks. move school to i. add algebra to total(i). )add 1 to counts(i). display-averages. #move school-data(i) to out-school. 1divide total(i) by counts(i) giving out-average. write display-record from school ision. open input student-file. open output screen. *write display-record from report-heading. &write display-record from blank-line. perform read-student-record. move zeros to count-table. perform process-student-data  02 english pic 9. 01 report-heading. 02 filler pic x(20) value is spaces. 02 filler )pic x(30) value is 'Enrollment Numbers'. 02 filler /pic x(30) value is spaces. 01 school-line. 02 filler pic x(8) ank-line. "move 'Central' to school-data(1). "move 'Western' to school-data(2). #move 'Southern' to school-data(3). perform read-student-record. move zeros to totals-table. perform process-student-data until student-no$re standard. 01 display-record. 902 filler pic x(80). working-storage section. 01 i pic 9. 01 count-table. 802 counts pic 9(5) occurs 3 times. 01 student-data. 02 student-no pic x. 02 name pic x(20). ** Simple Arithmetic (With Decimal Places and Negative Numbers).* identification division. program-id. EXAMPLE-27. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-stora ** Compute Verb.* identification division. program-id. EXAMPLE-28. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 a pic s99v99 value is -12.34. = 4 ** 3. display 'a ' a. display 'b ' b. display ' '. display 'c ' c. display 'd ' d. display 'e ' e. display 'f ' f. _stop run.331. data division. working-storage section. 01 a pic s99v99 value is -12.34.** Displaying the Decimal Point.* identification division. program-id. EXAMPLE-29. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 a pic 99V99 vdivide a into b giving f. display 'a ' a. display 'b ' b. display ' '. display 'c ' c. display 'd ' d. display 'e ' e. display 'f ' f. Ostop run.331. data division. working-storage section. 01 a pic 99V99 vade else if algebra < '066' move 'C' to grade else if algebra < '075' move 'B' to grade else move 'A' to grade. #move student-no to out-student-no. move name to out-name. move algebra to out-algebra** Suppress Leading Zeroes.* identification division. program-id. EXAMPLE-30. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 a pic 99V99 value  open output screen. *write display-record from report-heading. &write display-record from blank-line. perform read-student-record. perform process-student-data until student-no = high-values. close student-file e a into b giving f. display 'a ' a. display 'b ' b. display ' '. display 'c ' c. display 'd ' d. display 'e ' e. display 'f ' f. Tstop run.331. data division. working-storage section. 01 a pic 99V99 value ** Printing Dollar Signs, Commas, and CR.* identification division. program-id. EXAMPLE-31. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 a pi?ge section. 01 a pic s99v99 value is -12.34. 01 b pic s9v9& value is 123.456. 01 c pic s9(4)v9(. 01 d pic s9(4)v99. 01 e pic s9(6)v9. 01 f pic s9(3)v9. procedure division. add a b giving c. subtract a from b giving  01 b pic s9v9! value is 123.456. 01 c pic s9v9U. 01 d pic s9(6)v9(6). 01 e pic s99v99. 01 f pic s9(3). procedure division. compute c = a + b. compute d = a + b * c + 425.2. compute e = b / a * (b - a). compute f  d. multiply a by b giving e. divide a into b giving f. display 'a ' a. display 'b ' b. display ' '. display 'c ' c. display 'd ' d. display 'e ' e. display 'f ' f. 'stop run.-storage section. 01 a pialue is 12.34. 01 b pic 9V99 value is 123.456. 01 c pic 9(5).99. 01 d pic 9(5).9. 01 e pic 9(7).9. 01 f pic 9(3).9. procedure division. add a b giving c. subtract a from b giving d. multiply a by b giving e. ** Combining Edit Symbols.* identification division. program-id. EXAMPLE-32. environment division. configuration sectiont. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 a pic s9v99 valu. >write display-record from first-line. read-student-record. $read student-file into student-data 8at end move high-values to student-no. algebra < '050' move 'F' to grade else if algebra < '060' move 'D' to gris 12.34. 01 b pic 9V9M value is 123.456. 01 c pic z(5).99. 01 d pic z(5).99. 01 e pic z(7).9. 01 f pic z(3)9.9. procedure division. add a b giving c. subtract a from b giving d. multiply a by b giving e. divid screen. #stop run. process-student-data. perform display-student-data. 6perform read-student-record. display-student-data. if algebra < '050' move 'F' to grade else if algebra < '060' move 'D' to gre is -123.40. 01 b pic s9=v99 value is 12345.60. 01 c pic $z(6).99. 01 d pic $zz,z,z.99CR. 01 e pic $zz,z,zz9.99CR. 01 f pic $zz,z",zz9.99CR. procedure division. add a b giving c. subtract a from b giving d. multi c s9"V99 value is -123.40. 01 b pic s98V99 value is 12345.60. 01 c pic $(7).99. 01 d pic $,$,$.99CR. 01 e pic $,$,$.99CR. 01 f pic $,$,$.99CR. procedure division. add a b giving c. subtract a from b givingd. multiply a by b giving e. divide a into b giving f. display 'a ' a. display 'b ' b. display ' '. display 'c ' c. display 'd ' d. display 'e ' e. display 'f ' f. (stop run.ata division. working-stora ** And and Or.* identification division. program-id. EXAMPLE-23. environment division. configuration section. source-coVmputer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file assign t ** Multiple Choice.* identification division. program-id. EXAMPLE-22. environment division. configuration section. sour[ce-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file ass display-record. F02 filler pic x(80). working-storage section. 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x.  tudent-data. 6perform read-student-record. display-student-data. if algebra > '049' "move student-no to out-student-no move name to out-name move algebra to out-algebra &write display-record from display-line > '074' and class = '2' perform display-student-data. 6perform read-student-record. display-student-data. #move student-no to out-student-no. move name to out-name. move algebra to out-algebra. write display-record from  filler pic x(5) value is spaces. 02 out-algebra pic x. 01 blank-line 2pic x(80) value is spaces. procedure division. open input student-file. open output screen. *write display-record from report-heading.  02 filler pic x(5) value is spaces. 02 out-algebra pic x. 01 blank-line 2pic x(80) value is spaces. procedure division. open input student-file. open output screen. 'write display-record from report-headin c x. 02 school pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english pic x. 01 report-heading. 02 filler pic x(20) value is hool pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english pic x. 01 report-heading. 02 filler pic x(20) value is spaces. 0  02 filler ,pic x(25) value is 'Letter - Grade Report'. 02 filler .pic x(35) value is spaces. 01 first-line. 02 out-student-no pic x(4). 02 filler pic x(10) value is spaces. 02 out-name pic x(20). 02 fill o 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen &label records are standard. 01 displ ign to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen !label records are standard. 01 02 school pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english pic x. 01 report-heading. 02 filler pic x(20) value is spaces. t. read-student-record. $read student-file into student-data Iat end move high-values to student-no. until student-no = high-values. close student-file screen. #stop run. process-student-data. perform display-s' first-line. read-student-record. $read student-file into student-data Dat end move high-values to student-no.il student-no = high-values. close student-file screen. #stop run. process-student-data. if algebra *  write display-record from blank-line. perform read-student-record. perform process-student-data until student-no = high-values. close student-file screen. #stop run. process-student-data. perform display-s g. &write display-record from blank-line. perform read-student-record. perform process-student-data until student-no = high-values. close student-file screen. #stop run. process-student-data. if algebra  spaces. 02 filler %pic x(25) value is 'Algebra Report'. 02 filler 0pic x(40) value is spaces. 01 display-line. 02 out-student-no pic x(4). 02 filler pic x(10) value is spaces. 02 out-name pic x(20). 02 2 filler pic x(30) %value is 'Class 2 - Algebra Report'. 02 filler .pic x(40) value is spaces. 01 first-line. 02 out-student-no pic x(4). 02 filler pic x(10) value is spaces. 02 out-name pic x(20). er pic x(5) value is spaces. 02 out-algebra pic x. 02 filler pic x(5) value is spaces. 02 grade pic x. 01 blank-line 2pic x(80) value is spaces. procedure division. open input student-file. ay-record. F02 filler pic x(80). working-storage section. 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x. 02 scGile into student-data :at end move high-values to student-no.to out-student-no. move initials to out-initials. move surname to out-surname. &write display-record from first-line. move algebra to out-algebra. move geometry3 rm read-student-record. display-student-data. #move student-no to out-student-no. move initials to out-initials. move surname to out-surname. &write display-record from first-line. move algebra to out-algebra. move geometry ** If Sentence.* identification division. program-id. EXAMPLE-19. environment division. configuration section. source-cWomputer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file assign  ) value is ' eng'. 02 out-english pic x. 01 blank-line 2pic x(80) value is spaces. procedure division. open input student-file. open output screen. *write display-record from report-heading. write display-record  lay-record. F02 filler pic x(80). working-storage section. 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x. 02 s (10) value is spaces. 02 out-initials pic x. 02 filler pic x value is spaces. 02 out-surname pic x(17). 01 second-line. 02 filler pic x(5) value is ' alg'. 02 out-algebra pic x. 02 filler 02 filler %pic x(25) value is 'Algebra Report'. 02 filler 0pic x(40) value is spaces. 01 display-line. 02 out-student-no pic x(4). 02 filler pic x(10) value is spaces. 02 out-name pic x(20). 02 filler  x. 02 sex pic x. 02 class pic x. 02 school pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english pic x.  y-record from blank-line. perform read-student-record. perform process-student-data until student-no = high-values. close student-file screen. #stop run. process-student-data. if algebra > '049' per]d. $read student-file into student-data )at end move high-values to student-no.a until student-no = high-values. close student-file screen. #stop run. process-student-data. if algebra > '049' per ** If Sentence (Another way).* identification division. program-id. EXAMPLE-20. environment division. configuration secteion. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file  to out-geometry. move physics to out-physics. !move chemistry to out-chemistry. move english to out-english. 'write display-record from second-line. >write display-record from blank-line. read-student-record. read student-f to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen %label records are standard. 01 disp from blank-line. perform read-student-record. perform process-student-data until student-no = high-values. close student-file screen. #stop run. process-student-data. perform display-student-data. perfo chool pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english pic x. 01 report-heading. 02 filler pic x(20) value is spaces.   pic x(5) value is ' gmt'. 02 out-geometry pic x. 02 filler pic x(5) value is ' phy'. 02 out-physics pic x. 02 filler pic x(5) value is ' chm'. 02 out-chemistry pic x. 02 filler pic x(5  pic x(5) value is spaces. 02 out-algebra pic x. 01 blank-line 2pic x(80) value is spaces. procedure division. open input student-file. open output screen. *write display-record from report-heading. write displa  01 report-heading. 02 filler pic x(20) value is spaces. 02 filler &pic x(20) value is 'Student Reports'. 02 filler .pic x(40) value is spaces. 01 first-line. 02 out-student-no pic x(4). 02 filler pic x form display-student-data. 6perform read-student-record. display-student-data. #move student-no to out-student-no. move name to out-name. move algebra to out-algebra. =write display-record from display-line. read-student-recor ard. 01 display-record. F02 filler pic x(80). working-storage section. 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pi  assign to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen label records are stand ** At End Clause.* identification division. program-id. EXAMPLE-13. environment division. configuration section. sourceY-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file assig ** At End and High-Values.* identification division. program-id. EXAMPLE-14. environment division. configuration section.` source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file  pic x. 02 age pic xx. 02 sex pic x. procedure division. open input student-file. perform read-student-record. perform process-student-data until student-no = high-values. c display 'Enter sex (M or F)'. (accept sex. edit-and-display-record. #move student-no to out-student-no. move name to out-name. move age to out-age. move sex to out-sex. 3display display-record.display 'Enter student numb ** Introduce the Student File.* identification division. program-id. EXAMPLE-15. environment division. configuration secftion. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file ent-data until student-no = '9'. #stop run. process-student-data. perform get-name. perform get-age. perform get-sex. !perform edit-and-display-record. perform get-id. get-id. display 'Enter student numb name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x. 02 school pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x.  ata. 02 student-no pic x. 02 name pic x. 02 age pic xx. 02 sex pic x. 01 display-record. 02 out-student-no pic x. 02 filler pic x value is spaces. 02 outile. #stop run. process-student-data. display student-data. 5perform read-student-record. read-student-record. $read student-file into student-data at end move '9' to student-no.-no pic x. 02 name & stop run. process-student-data. display student-data. 5perform read-student-record. read-student-record. $read student-file into student-data *at end move high-values to student-no.ic x. 02 physics pic x. H n to 'students'. data division. file section. fd student-file 1label records are standard. 01 student-record. F02 filler pic x(60). working-storage section. 01 student-data. 02 student-no pic x. 02 name   Kassign to 'students'. data division. file section. fd student-file 1label records are standard. 01 student-record. F02 filler pic x(60). working-storage section. 01 student-data. 02 student-no pic x. 02 namelose student-file. #stop run. process-student-data. display student-data. 5perform read-student-record. read-student-record. $read student-file into student-data *at end move high-values to student-no.ic x. 02 name ** Print a Report Using the Student File.* identification division. program-id. EXAMPLE-16. environment division. configquration section. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select stu  Kassign to 'textfile'. data division. file section. fd student-file 1label records are standard. 01 student-record. F02 filler pic x(60). working-storage section. 01 student-data. 02 student-no pic x. 02  er (9 to stop)'. move spaces to student-no. accept student-no. get-name. display 'Enter name'. move spaces to name. accept name. get-age. display 'Enter age'. move spaces to age. accept age. get-sex.  02 chemistry pic x. 02 english pic x. procedure division. open input student-file. perform read-student-record. perform process-student-data until student-no = high-values. close student-file.  -name pic x. 02 filler pic x value is spaces. 02 out-age pic xx. 02 filler pic x value is spaces. 02 out-sex pic x. procedure division. perform get-id. perform process-stud dent-file assign to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen label recor( ds are standard. 01 display-record. F02 filler pic x(80). working-storage section. 01 student-data. 02 student-no pic x. 02 name. 03 surname pic x(17). 03 initials pic x. 02 age pic x  pic x. 02 age pic xx. 02 sex pic x. procedure division. open input student-file. perform read-student-record. perform process-student-data until student-no = '9'. close student-f ,upzznl 2upzzc 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzzzfile bzzzze hzzzzcreate nzzloop tzzquit zzguess x8 zz mastermindzP z zzn  zzget  zzxack! zzunpack- zzw2 zzunpack zzx zzw zzhelp be bezzws bezzn bezzi$ bezztype bezzget ** Read a Number of Fields from the Terminal.* identification division. program-id. EXAMPLE-6. environment division. confi~guration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01   fzze V/  `zzfilev   Zzzwsidz  lzzcreate  endif )!   zzchar)<   zznum*!>   zzendx }X  zzi z8n zzmassage  zztypeK   Nzzsh   Hzzb  s-student-data. perform get-name. perform get-age. perform get-sex. !display student-no name age sex. perform get-id. get-id. display 'Enter student number (9 to stop)'. move spaces to student-no. accept studeV  mastermind8?/n/% ^$ )0 )EFn/% )0abcdefgh*"A+GB+ %the secret !word!&0E badFguess xZ/% ^/ >>nm/%congratulations, you won in *< 7$ )!< guess:es" *>*.u/% co ** Read a Number of Fields from the Terminal.* identification division. program-id. EXAMPLE-7. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01  display message.&U#zi/execute !mastermind!.*v/% )BFu/%2 quit*UZ-AY+F )!>]*%potential deep exit&+FB rptmkxX^u/%'0 )ZB0 +!> '"AA@A@+%cursor to top if 9'. #stop run. process-student-data. perform get-name. perform get-age. perform get-sex. display student-data. perform get-id. get-id. display 'Enter student number (9 to stop)'. move spaces to student-n9'. #stop run. process-student-data. perform get-name. perform get-age. perform get-sex. display student-data. perform get-id. get-id. display 'Enter student number (9 to stop)'. move spaces to student-n zdescribe zznewgameo zzrulesm zzplayFoneFgame zzreturn u zz getFguess zzcount zzrptuh zzoin zzend t8 zz badFguess y ytarget x xblacks  bezzname be zzmassage bezzrank bezzshape bezzpop bezzrpt bezzend bezzchar bezznum bezzfn bezzy up upendif upzzr &upzzup  student-no pic x . 01 name pic x . 01 age pic xx. 01 sex pic x. procedure division. perform get-id. perform process-student-data until student-no = '9'. stop run. procesQ zzran Bzzd+[I  xquit+D  zzyup,0Rz $zzr   rloopX   zzpop` )   zzfn )!>   zzrpt|}   zzshape   zzrank   zzname[  6zzc)02+ nt-no. get-name. display 'Enter name'. move spaces to name. accept name. get-age. display 'Enter age'. move spaces to age. accept age. get-sex. display 'Enter sex (M or F)'. accept sex.stop run. procesB unt is a global variable.&qpr*  blacks/ xHw*  countz/  u/% ^  '   target/   zzws1+   zzhelp   *zzup #  <zzcommand  0zznl   student-data. 02 student-no pic x. 02 name pic x. 02 age pic xx. 02 sex pic x. procedure division. perform get-id. perform process-student-data until student-no = '@  new column.&+xX x/% )+5 <>xu/% '"A+< BЄ+5A-+!$<$mastermind *$<<OVxc/% '"A+< B+5A+!upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzzzfile bzzzze hzzzzcreate nzzloop tzzquit zzguess x8 zz mastermindzP z 6 :m:m: 3+w}OLwuR0 } zbe}~~~ ~xh8X~~h~xHup~X}~ }~~z position cursor.&f n/% ^q  n[/% ^ n%/ % )0 I>. )D )!J )DFnd/%'0 '"A+< B+5A@+!< BP+5A(+!]Dn/ % )0I>. )Z )!ux o  8 guesses the player has made that exist;* DtHNHNo/that stand in the correct position in the guess, and the number?*K kH..tQ/outputs message for an invalid guess%&.DFo/the number of blacks, or letter guesses the0cdefgh, ex. bcdae7* CnI/ % )0 )I@+ #nR/ % )$& tyh-u+$u/$ )0 5 )!E'ln  w0}8{0 }vȃvpz؃zz !< #blacks> *<7$ )y, yo1 t zyyxr0qqXpq( p ph pX rxpHm"p=/ )0' p+/*) @Fp"/if you wish to quit, type K+5A6+!$n/%sorry, you have run it{ zzdth y| yhtd i a aguw guz guget mzP mput k l lwide lrpt ldgu lname xtX xdhtdn xdgetNTZ`flrx~Ƅ̄҄؄ބ &,28>DJr!KNx~/% '"Bp+5Ae+$<$guesses are 5 of abcdefgh, ex. eghaf$*p8K  rulesq pl   newgame z`XxQ/main routine.O&q oXu/$'0 )DFo/randomly chosen, with no repetitions, f~zz~8~(~~H(~ w  x8|`zPx y(oym|Hv uw}{ uhx(v t8|y }x }hto(n    " ( . 4 : @ F L HN qrrttw@s#%houHm:     /  whites  /6tl/%($@X+.%hold it one second.&mpf/CFtc/%guesses are to be five letters from ab# player has made;* D..p4/.$ '"C +5A:+%move cursor if 2nd column&.U46u/% Ak+Z5 )!U U>. )Dabcdefgh*!!> )g4  returnp  endfgh*FFu/% )0 )$ )[B0 +!> '"C #quitK when KguessQK appears.7*`@ p/*c INp/in the solution but are not in the proper position in the guess,@* guesInv/%+.'.p/are reported after each guess.* 'DFo/of whites, or letter $ eof/ -.n /% )0@?+%number of guesses&/- describe0 oin)cf  }xyH |{|8{xȃ{w x'!>c!&x/% n*]@+F'!> ) out of guesses. you lose..* :n@/ % )ZB4+!> )   lose:13R2 n7/ % )ZA+!> )  win DFn/%'0 '"A+< B+5A@+!< Bp+5A)+!TD16n./ %whites> *< 7$ )y( xdescribe upzzr &upzzup ,upzznl 2upzzc 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzzzfile bzzzze hzzzzcreate nzzloop tzzquPV\bhntz„Ȅ΄Ԅڄ "(.4 3 $ rom the letters a_h.;*WDDFo/to match the five letters, in order, which the computer has;*/DEFo/ Jmastermind is a game of thought which requires the player<*<E y8z v /% ^ #&u/% ) % R X ^ d j p v |            Ą ʄ Є ք ܄      $*06<BH# function editor :the !G! editor". ?put changes the function form to a variable. each line of the 5function should start with a lamp symbol :" to avoid symbol )090123456789abcdef*" A+5B+!B )<-. }{؃{*{@B- rpt )Zc{/%'0-+s$&{/$decimal to hex conversion&$..}/% )0B +C0123456789abcdef*89 ).# $:I U   vv ?dget get and put are functions which aid in the creation of text such as the variables prefixed by !d! in this ws :like the one you are t of the variables of this workspace which begins with theletter d is the description of the function whose name is obtained by removing the d. tained dgu  dhtdBp -. } f80c htd KfK 65535 htd dth 3 15 129 255 63500 330z` DE|   htdpq$&z/$ )"@+#@+0 *)a$ k     guwzzx/{ cnf)  zzws1+   zzhelp into numbers. examples> dth 3 15 129 255 63500 03 *ssage  zztypeK   Nzzsh ^  Hzzb zzran Bzzd+[I  xquit+D  zzyup,0Rz $zzr   rloopXZ   zzpop` )   zzfn )!>   zzrpt|}   zzshape    put KdguK when finished editing 1 *v describe Ddhtd  zzi zztype zzget zzname  zzmassage zzrank zzshape zzpop zzrpt zzend zzchar zznum zzfn zzy up1 table overflows. put assumes this and strips $off the first character of each row. examples> get Kdgu!&zi/$ )0@ +E$($ )! get56zr/$($ )%fn&16|/%'0R+ $&|/$hex to decimal conversion&$  wide/ -. }0|||C- dthlooking at". =get changes the variable dgu , for example, into a function 6called dgu which can then be edited with the regular apl |0|h"z-z{/$2 )<[x*$var&#  dget'/ 66 x{(}X{Dz6z/$($ )%fn& z/$($ )%var& .Lexz/$ )0*<$2 )*<>{/% 3 15 129 255 63500 B&z   put0/  name   = describe each   *zzup #  <zzcommand  0zznl  fzze V/  `zzfilev   Zzzwsidz  lzzcreate  endif )!   zzchar)<   zznum*!>   zzendx }X  zzi zn zzma 0f 081 0f E zzrank   zzname[  6zzc)02+ zzn  zzget  zzxack! zzunpack- zzwh2 zzunpack zzx zzw zzhelp zzws zzn Athe functions htd and dth concern hexadecimal representations Aof numbers. dth produces 4_digit hexadecimal representations of ]the elements in its argument :which may be a vector". htd convertssuch representations back upendif upzzr &upzzup ,upzznl 2upzzc 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzzzfile bzzzze hzzzzcreate nzzloop tzzquK 1 dgu now display and edit dgu> Gdgu;L' . C )lv( / describe36{/$ )0$@ +I$G@B@BCȄ#+$B$ )$x3BFz/$ )0 )"@y+Z )!>85 )%first letter matches.&55iB   %&v/% )0 )<$ )$enter data> * % v0 /% ^$ '0no such name.*nr(! xv@  reset5*  one$Z5 )x/% )0 )$nameQ *"  diffpop  |P:|+$v/% )/  lookupf(  ^ 6 :n:m: 3+w}OY}uR7" } }~~ ~xh8X~~h~xHup~X}~ }~~#)%remaining letters match.&+Rv/% )0 )<5 )$  data  "&x/% +Z5 )!>[++Z58" &v/% )0 )$enter name> *^  v:/$ )0 5 )!E'$x  p  enter t p1datar p2 y j{ jdiff jnone jonerH jpackq jin1 tt tdescribem0 tdpacka` tdentergh "tdinl .tdoinr 4tddiffzzzwsid \zz@W+$Z5 )!>$ )< )( r/$ ^02  r/$ )0 )$ )$ ) &din)*MNx/% )0 )" )" )$I,$85 )$UZ- )!$>$ )%check characters&MAFx/% )0 )$ )!Z5 )!$>$8+I5 ) %check lengthzzchar zznum zzfn zzy up upendif upzzr &upzzup ,upzznl 2upzzc 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzed by removing the d. k&&| /$ )0 @ +E )!J+E )&$& |Ѓ|%y$#&{Y/$ )0$ )05$ )0$ )0+2[0#cf  z }yЃzȃ| )   zzfn )!>   zzrpt|}   zzshape   zzrank   zzname[  6zzc)02+ zzn  zzget  zzxack! zzunpack- zzw 2 zzunpack  R X ^ d j p v |            Ą ʄ Є ք ܄      $*06<BHG/$ ^*x)  oin33  zzws1+   zzhelp   *zzup #  <zzcommand  0zznl  fzzej V/  `zzfilev   Zzzwsidz  lzzcreate  endif )!   zzchar)< {u v1/$'0 ) eof/  v/%*   unpack { v/% )0 )<=5 )pz x/$ ^$*  pack* rX fv/% )0 )< ~zz~8~(~~H(~ {}y|}H ia}guz|XmzPyk6l|{z0yxtXz@nzy(tH  z    " ( . 4 : @ F L) rpt/INz/$ )0 )Y@G+I 5 )!J5 )!> ) %not too close to the end.&etterI-. |x}(zHy(%-"&v/% +Z5 )!>+ng l"vx(  | y!&xPV\bhntz„Ȅ΄Ԅڄ "(.4 3 $& A{P ~~ z |{yx0wwxwwh vЃ wX { GwH~  none 3   namesmho RVz/$ )0 )" )I,+I85 )$UZ-$ )!> zzfile bzzzze hzzzzcreate nzzloop tzzquit a z{ zunpackvh zenter xx xlookupz in b brpt{@ bresetv boinrh bnamesq p1|`}y|0 {Ѓ 3cDFx/% ^$ '0 )"$ )" )$I$8J>. )"@>+$I )$ D(.x/% '0more than one such name.* R]:0(y/% )8x/% )xx/% )(.x/% zzx zzw zzhelp zzws zzn zzi zztype zzget zzname  zzmassage zzrank zzshape zzpop zzrpt zzend NTZ`flrx~Ƅ̄҄؄ބ &,28>DJ5  zznum*!>   zzendx }X  zzi z8n zzmassage  zztypeK   Nzzsh ^  Hzzb zzran Bzzd+[I  xquit+D  zzyup,0Rz $zzr   rloopX   zzpop` enter name> smith, p. enter data> treasurer enter name> lookup  e before enter " enter +accepts successive items of names and data. 6lookup prints data associated with each name entered. . example>  rial number :1 to 9", month, day, 9and year, and a single_number encoding of the same data. . p[pack 2314 7 17 68 p # $:I U    = denter uthe functions enter, lookup and reset illustrate a method of constructing and using lists of variable length data, representing e KabaK in1 KnowabababababababaK 4 8 12 16 \TV 0$doin output a prompt< input the  2311 9 21 72 pack unpack 92137142 92137142 pack 1 1 31 1  w[KtheK t[Kthe men then went home.K w in t 1 9 HN tXw wsssHscharacH |Hs$C$ & this is one linewilson)0 )E HN 6ddiff !difference of a numeric vectoroin H ces in the second argument ?are to be determined. the result is a vector of indices of the >first letter of each occurrence. the function in determines all occurrences, whereas ;in1 determines only all non_overlappingoccurrences by firsif there is one.&+ 8gnr#/% )0@+I 5 )!\ )$ )!8@+%find the 2nd member of the first overlapped pair.2&% )0@gr  the s in1er of   dent2erzzs PV Fs;sldf;fsksdfkfs;dkf;lsd;fs;' nameQ smith, p. treasurer nameQ foo, f. no such name. nam reset enter enter name> wilson, j. enter data> president  86063867 unpack p 2314 7 17 68 unpack pack 2311 9 21 72 hach list by a vector of characters and a vectorof indices. enter and lookup each request input :by " 4until an empty vector :return key alone" is entered. . reset resets lists :us9 responseT  8ddiff[zzs  = dpack the functions pack and unpack illustrate the use of theencode and decode functions in transforming between a four_ number encod ing of> se 30 unpack 30 1 1 31 1 'xn8  2doinopd8  BBR w in1 t 1 9 KabaK in KnowabababababababaK 4 6 8 10 12 14 16  C8C2*n  dpack*@d 26ra/$ )0$G@B@BCȄ +$C$ )J@+* 2INr5/% )0 H 85 )!D )!> )%drop the second member of the pair.$&)!> Ir>/% )8>r,/% )\5 )!>+ %. @t applying the function in and then suppressingall overlaps. . examples> Lldkf;lsldf;fskdfsfunny stuff about wilsondfsfunP = describe veach of the variables of this workspace which begins with theletter d is the description of the function whose name is obtaineQ nr\^ $D din ?the functions in and in1 take two arguments< the first is a %word :i.e., a vector" whose occurren^ 6 :y`:m: 3+w}OYzuR 6% } z }~~ ~xh8X~~h~xHup~X}~ }~~ i z8n zzmassage  zztypeK   Nzzsh ^  Hzzb zzran Bzzd+[I  xquit+D  zzyup,0Rz $zzr   rloopXD   zzpop` )   zzfn )!>   zzrpt|}   W/ *searching a text string,**o3..{E/_ _%*...{</workspace name contents%*.36{/ Esorting, text edit aid.**x(3     zzws1zzws zzn zzi zztype zzget zzname  zzmassage zzrank zzshape zzpop zzrpt zzend zzchar zznum zzfn  zzz@z}P} |||X |( { { }zyy]y`oHn46{{/apl.examples3 > number system conversions,+*o4;>{r/apl.examples2 -zzloop tzzquit{ zzdescribezztype zzget zzname  zzmassage zzrank zzshape zzpop zzrpt zzend zzchar zznum zzfn# $:I U  ) !&{/apl.mastermind > a game.*pH!46{/ system commands from apl.+*4=>{/apl.dos >> aid in using the cbm disk operating4*=:>{/apl.files > 3 simple file \6 :a`:m: 3+w}pOY| uR !! } z }~~ ~xh8X~~h~xHup~X}~ }~~NTZ`flrx~Ƅ̄҄؄ބ &,28>DJ @ X ^ d j p v |            Ą ʄ Є ք ܄      $*06<BH2~zz~8~(~~H(~  {z         „ Ȅ ΄ Ԅ ڄ            " ( . 4 : @ F L[ zzshape   zzrank   zzname[  6zzc)02+ zzn  zzget  zzxack! zzunpack- zzwR2 zzunpack zzx zzw zzhelp +   zzhelp   *zzup #  <zzcommand  0zznl  fzze V/  `zzfilev   Zzzwsidz  lzzcreate  endif )!   zzchar)<   zznum*!>   zzendx }X  zz zzy up upendif upzzr &upzzup ,upzznl 2upzzc 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzzzfile bzzzze hzzzzcreate n(> mathematical/arithmetic examples.2* ;'.{i/ length data.*P 'CF{`/ +constructing and using lists of variable:*=C?F{N/apl.examples1 > packing data into single numbers, 6*EqT?36{PV\bhntz„Ȅ΄Ԅڄ "(.4 3 $!cover functions!.1*nS:>>{*/ other workspaces distributed with waterloo microapl.5*> {3/*8 @F{!/this workspace simply indicates the contents of several7* opera@ describeK 2 { ~zz~8~(~~H(~ :az{|@ vhz(xx{zinbz8{@{`v}rhryqp1tyrp2yj{{y{prH|qtptt|m0sa`tghw Flqrm L ( RPV\bhntz„Ȅ΄Ԅڄ "(.4 3 $NTZ`flrx~Ƅ̄҄؄ބ &,28>DJ R X ^ d j p v |            Ą ʄ Є ք ܄      $*06<BHA* h@TUTORIAL12Aapl.indexapl.examples1*apl.examples24apl.examples3 apl.files apl.dosapl.mastermindcbl01 cbl42 cbl43 wscreate wsconv dfconvK cbl02cbl03cbl04 cbl05 cbl06 cbl07 cbl08cbl09KK  cbl10cbl11cbl12 cbl13 cbl14 cbl15 cbl16 cbl18KK  cbl17  cbl19  cbl20 cbl21  cbl23  cbl22 cbl24 cbl25KK cbl26cbl27cbl28cbl29cbl30 cbl31cbl32cbl33 1,0J" KC)& ` @`PJPJ)PjJP *)PaеPH: * *)J JJf jf jJ )YYYE::ЈhTK cbl34 cbl35 cbl36 cbl37  cbl38 cbl39cbl40cbl41KhShRR41 1RJlRESE:`z ; <8t壍t ,    L[L 6 :X:m: 3+w}HOY}huR% } zu }~~~ ~xh8X~~h~xHup~X}~ }~~$ etXa@t] u0 vXt | ^  p           Ą ʄ Є ք ܄      $*06<BH PV\bhntz„Ȅ΄Ԅڄ "(.4 3 $ement vector> the first two elements are points at which the given function has values of opposite signs< the third element /is a tolerance for the acceptance of the zero.  y[2 4 1 po x KgK zero @2 5 .01 @0.58581543 g @0.58581543 Hproduce a2n by 2 matrix of all possible pairs of elements from In. athe functon fc shows an alternate method which yields the same pairs but in a different order.  ab ac ad bc :unctions poly , pol , po and polyb each evaluate a =polynomial :or polynomials" whose coefficients are determined by the first argument, and whose point :or points" of evaluationis determined by the second argument. the coefficients are in asc;olyb scalar right argument only :uses decode/base value". po 4applies to arguments of any rank. the vectors along 2the first axis of the first argument are the coef_ 3ficients of the polynomials which are evaluated for  D:bin 5" po I6 j`pv N D dbin Ethe function bin produces all binomial coefficients up to order n.. ~zz~8~(~~H(~ jmzzhgc |p{nz}xxH{h}8}}wcaxpox({{xzx|Pxw(y@ufcty0r}fb}my`{ytisypou uhHsNTZ`flrx~Ƅ̄҄؄ބ &,28>DJ# $:I U   DF fHdzero }the function zero finds a zero of the function whose name is given by the left argument. the right argument is a three el example> Lcr KgK y[g x  @0.082 D Z=dcomb 4the function comb employs recursive definition to  9the function lfc employs fc to generate letter pairs. example> lfc 4 bd cd  T@ dpoly the f$ending order of associated powers. . !poly scalar right argument only. pol 0scalar right argument only :uses inner product". p $each element of the second argument. examples to try> 1 2 3 4 polyb 3 3 1 2 4 po 1 2 3 4 5 6  example> bin 3 1 0 0 0 1 1 0 0  the functions gcd and gc each employ the euclidean algorithm to produce the greatest common divisor. gcd takes two scalar _arguments, whereas gc takes a single argument which is expectedto be a two_element vector.  examples 84 gcd 90 6 90  gcv 90 84 6 gcv 90 84 105 3 0function sign.'&j`Dm/% )[Q ()!>J+ OVm/$fn values must have opposite signs at x;1', x;2'0*$ 4)$ +ZK>.K ") 5xOm/% .)0 K ")!8 K ()!/ m/$ ^4 36m/% ()02 )< m*%fn value at midpoi iables. . example> truth 2 0 0  0 1 2 3 4 5 6 7 z = describe peach of the variables of this workspace which begins with theletter d is the description of the function whose n+!<+!5 < )!<< 8 )J@+!M,+< )+Q  Pdbinz/ m/$ )0 )"A@,+z/  Vdpoly[zzs 66 uuux#t6v/$ )0 8 )!I,8 )H  hdzero[zzs t   66 vvtЃv0w6+.v#/$ )0 A3+< )K )!$5$ < )!<< )kH+&m/$ )0 )"@A)+cnfh&v/$ )0 8 )!I, )5(+gpkv  0&&v,/$ )09 )"A(+#Y )!> )&*.xA/$ )0 $ )ON+I85< )$!$IK-$ ) * lfc*!> |` - {Hw58+x[s/$ '0 )QVt/$ )0 5 )!I )J@s  @  >dtruthzzs   ddiff+D   \dcomb*/ 9>m/$x [] :2 initial guesses", :tolerance required"/&H9&t/$ )ZA+!>+ ' Dcondition&&t/$ )0@A+5@A+&e =>n/% )%f x;1' and f x;2' still of opposite sign.*&p=m   " ( .69 yPxm016y/$ )0 $ )O,+I8@1+55 )$!IK- )+551..m/% )0 I>. )!LA+%midpoint. &. /$ )0 )$ )J@+++.}/$ )0N9 +<8 )!R,5+<8 )++wA/$ )0 )C: )r zXwHIK-xX  N  comb    polyb )E w8   zeroBP  y h66 z {X} |!y6&&{/$ )0I>. )K$ )O+I85< )&  poly zD/% )0 ) $zx  pol.x/% @+]5 )!> ) z;/ )z2/% )0 )@ xj/% )0N>. ) z)/$ ^   xynfE {3|+O{ *!&z/% )0: )"@&+< )zzx!16|/$ )09 )5A+!B+1messageb   zzws1+   zzhelp   *zzup #  <zzcommand  0zznl  fzze V/  `zzfilev   Zzzwsidz  lzzcreate  endif )!   zzchar)<   zznum*!> w>   zzrpt|}   zzshape   zzrank   zzname[  6zzc)02+ zzn  zzget  zzxack! zzunpack- zzw62 zzunpack zzx zzwzzchar zznum zzfn zzy up upendif upzzr &upzzup ,upzznl 2upzzc 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzzzfioly x|P xlfcw( xpolybu fct fccombr fcdescribe f b bmessagem bzero btol "y (t .is 4iunlesso :idtruth @i conditionhH6 :x0:m: 3+w}OYuR4 } {}~~~x ~hX(H~x~X~h8~up~H}} }~~ R X ^ d j p v |            Ą ʄ Є ք ܄      $*06<BHPV\bhntz„Ȅ΄Ԅڄ "(.4 3 $i  8unless + 36|i/$ )0abcdefghijklmnopqrstuvwxyz*" )$ )zx3#&x|/% )0 )< )] +!> ))0#(.z/% )"A+\+!> )5*(?F { |@|{0z؃{؇?5% )0 )$Q$ )x8  z/$ ^"  gcv?/ |z#z  *  truth = | P tol )EzM/% )\$+!> )qxs/% )0 )Q )I8A+O )+I8+1 }1xp8z/% )0Q>. )8 rptBpM+    xa/$ ^16/  2  gcdA@Hz describeE bin*!> } 0    zzendx }X  zzi z8n zzmassage  zztypeK   Nzzsh ^  Hzzb zzran Bzzd+[I  xquit+D  zzyup,0Rz $zzr   rloopX(   zzpop` )   zzfn )! zzhelp ddiff zzws zzn zzi zztype zzget zzname  zzmassage zzrank zzshape zzpop zzrpt zzend le bzzzze hzzzzcreate nzzloop tzzquit m zzh gc|p gctruth nz ngcdxH ngcv nrpt} nbin w c ax pox( popol{x popN Fidgcde Lidbina@ Ridpoly] XidcombX didzerom zzh gc|p gctruth nz ngcdxH ngcv nrpt} nbin w c ax pox( popol{x poph~zz~(~~~8~x0y|}Hx}8{}}Xx@}}|h Ԅ   ڄ „ Ȅ ΄            " ( . 4 : @ F L NTZ`flrx~Ƅ̄҄؄ބ &,28>DJ# $:I U     ~name  ;describe vthe functions read, write and erase illustrate the useof individual disk files to store apl arrays of arbitrary H of the array y on the disk :drive 0 ofunit 8" under the name !foo!. the statement q[ read KfooK 9gets it back and assigns it to q . to get rid of !foo!> erase KfooK , |P- putR}3/$($@+P|P{/$ )$($@0+Z5$ )0{ +{/$($@$+{  write/ } {/$ )0($@+++ | |?E  described  zzws1+   zzhelp   *zzup #  <zzcommand  0zznl  fzzer V/  `zzfilev   Zzzwsidz  lzzcreate  endif )!   zzchar)<     zzfn )!>   zzrpt|}   zzshape   zzrank   zzname[  6zzc)02+ 2  zzn  zzget  zzxack! zzunpack- zzw2 zzunprpt zzend zzchar zznum zzfn zzy up upendif upzzr &upzzup ,upzznl 2upzzc 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz^6 :x:m: 3+w}OYuR% } }~~x ~hX(H~x~X~h8~up~H}} }~~ R X ^ d j p v |            Ą ʄ Є ք ܄      $*06<BHPV\bhntz„Ȅ΄Ԅڄ "(.4 3 $ copy entire disk A* KINz/$ dos Kn1>mydisk,35K KnewK a disk ?* IKN{/$ dos Ks0>garbageK scratch a file 7A*8rKCFz/$ :dos can only be used with a singlesize and shape. for example, the statement y write KfooK would store a copy 4to put !foo! on drive 1 of unit 9 :if you have one"> y write Kdisk9/1.fooK & -. |@| |&|/ ($ )$}!/$ )$($@+|P{P| -. |x|؃}h;|- get|{P  erase    errorP }*/$ )$($@.+}P{     read -zznum*!>   zzendx }X  zzi z8n zzmassage  zztypeK   Nzzsh ^  Hzzb zzran Bzzd+[I  xquit+D  zzyup,0Rz $zzr   rloopX   zzpop` ) ack zzx zzw zzhelp put zzws zzn zzi zztype zzget zzname  zzmassage zzrank zzshape zzpop zzn Vzzzzwsid \zzzzfile bzzzze hzzzzcreate nzzloop tzzquit zname y| yerase x xget{ xread xerrorx@ xdescribe} xwritep zzD~zz~(~~~8~ z}z`}x zc      „ Ȅ ΄ Ԅ ڄ            " ( . 4 : @ F LNTZ`flrx~Ƅ̄҄؄ބ &,28>DJ# $:I U   IN{#/$ dos Kv0K verify :KcollectK" ?* $IKNz/$ dos Kc1>myws%0>yourwsK copy file:s" A*ireKKNz/$ dos Kc1%0K , :2_drive" disk unit"9*xq@CHN |{{}({x}P}Huv  }|xz|yxy(x؃{(| |( yȃ x/uKNz/$ dos K& 7KN{/$ dos Kr0>newname%oldoneK rename a file CA*steK%&z/$examples of the use of dos>* % z/$ * zp /KN{/$ dos Kd0%1K duplicate a disk A*nf*K$  <zzcommand  0zznl  fzze V/  `zzfilev   Zzzwsidz  lzzcreate  endif )!   zzchar)<   zznum*!>   zzendx }X  zzi z$n zzmassage  zztyEzzname[  6zzc)02+ 2  zzn  zzget  zzxack! zzunpack- zzwh2 zzunpack zzx zzw zzhelp zzws zzn upendif upzzr &upzzup ,upzznl 2upzzc 8up zzcommand >upzzd Dupzzb Jupzzsh Pzz Vzzzzwsid \zzzzfile bzzzze hzzzzcreate nzzloop tzzqu identification division. program-id. EXAMPLE-1. environment division. configuration section. source-computer. IBM-4331. @object-computer. IBM-4331. data division. procedure division. stop run.mind** Display a Name on the Terminal.* identification division. program-id. EXAMPLE-2. environment division. configuration fsection. source-computer. IBM-4331. object-computer. IBM-4331. data division. procedure division. display 'James'. ** Accept Data from the Terminal.* identification division. program-id. EXAMPLE-3. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 name picture xx** Introduce Perform Verb.* identification division. program-id. EXAMPLE-4. environment division. configuration section.w source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 name picture x. ** Perform Verb with Until Clause.* identification division. program-id. EXAMPLE-5. environment division. configuration {section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 name pic xc0>big%0>small1,1>small2K catenate files A*CK?Fz/$ )"@"+0IVSDCRN*"ivsdcrn*8 )"@8+)"n`?#&z/$ )" )Z%*!>85 )0=* =#7>zy/$send a command to the disk operating system.-& z/$($@@+n#&z/$ )" )Z>*!>85 )0:*K=K#&&z/$ ie8-15. *< )!$($@+& dos 3 345H  describe z'E  zzws1+   zzhelp   *zzup peK   Nzzsh ^  Hzzb zzran Bzzd+[I  xquit+D  zzyup,0Rz $zzr   rloopXn   zzpop` )   zzfn )!>   zzrpt|}   zzshape   zzrank    zzi zztype zzget zzname  zzmassage zzrank zzshape zzpop zzrpt zzend zzchar zznum zzfn zzy up0itz zzdescribez` zzdos ct zzname  zzmassage zzrank zzshape zzpop zzrpt zzend zzchar zznum zzfn zzy up. procedure division. perform get-name. perform process-name until name = 'stop '. stop run. get-name. +display 'Enter a name up to 5 characters'. move spaces to name. accept name. process-name. display stop run.~x. procedure division. (display 'Enter a name of 5 characters'. accept name. display name. stop run. apl.files apl.dosapl.mastermindcbl01 procedure division. perform get-name. perform display-name. stop run. get-name. +display 'Enter a name up to 5 characters'. move spaces to name. accept name. display-name. display name.cbl01 ** Read a Number of Fields from the Terminal* and Print a Small Report.* identification division. program-id. EXAMPLE-9. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. work irst-line. 02 filler pic x(8) value is 'number '. 02 out-student-no pic x. 01 second-line. 02 filler pic x(5) value is 'name'. 02 out-name pic x(5). 01 third-line. 02 filler pic x(4) ! run. process-student-data. perform get-name. perform get-age. perform get-sex. !perform edit-and-display-record. perform get-id. get-id. display 'Enter student number (9 to stop)'. move spaces to student-no. dit-and-display-record. #move student-no to out-student-no. move name to out-name. move age to out-age. move sex to out-sex. display heading-line. display first-line. display second-line. display third-line.-no. ** Define a File to Hold the Student Records.* identification division. program-id. EXAMPLE-10. environment division. counfiguration section. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select  name. perform get-name.ause.* identification division. program-id. EXAMPLE-5. environment division. configuration section. sourmce-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 name pic x x. 02 name pic x. 02 age pic xx. 02 sex pic x. procedure division. nstop run.on. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select*** Write Student Records into a File.* identification division. program-id. EXAMPLE-11. environment division. configuration section. source-computer. IBM-4331. object-)g-storage section. 01 student-data. 02 student-no pic x. 02 name pic x. 02 age pic xx. 02 sex pic x.  student-data. close student-file. "stop run. process-student-data. perform get-name. perform get-age. perform get-sex. (write student-record from student-data. perform get-id. get-id. display 'Enter student numbe,ing-storage section. 01 student-data. 02 student-no pic x. 02 name pic x. 02 age pic xx. 02 sex pic x. 01 heading-line. 602 filler pic x(12) value is 'Student Data'. 01 fvalue is 'age '. 02 out-age pic xx. 02 filler pic x(5) value is ' sex '. 02 out-sex pic x. procedure division. perform get-id. perform process-student-data until student-no = '9'. stop accept student-no. get-name. display 'Enter name'. move spaces to name. accept name. get-age. display 'Enter age'. move spaces to age. accept age. get-sex. display 'Enter sex (M or F)'. accept sex. er (9 to stop)'. move spaces to student-no. accept student-no. get-name. display 'Enter name'. move spaces to name. accept name. get-age. display 'Enter age'. move spaces to age. accept age. get-sex. d student-file Kassign to 'students'. data division. file section. fd student-file 1label records are standard. 01 student-record. F02 filler pic x(60). working-storage section. 01 student-data. 02 student-no pic/isplay 'Enter sex (M or F)'. ,accept sex.op run. process-student-data. perform get-name. perform get-age. perform get-sex. (write student-record from student-data. perform get-id. get-id. display 'Enter student numbe** Read and Print the Student Records.* identification division. program-id. EXAMPLE-12. environment division. configurantion section. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select studen=computer. IBM-4331. input-output section. file-control. select student-file Iassign to 'students'. data division. file section. fd student-file 1label records are standard. 01 student-record. 02 filler pic x(60). workin  procedure division. open output student-file. perform get-id. perform process-student-data until student-no = '9'. move '9' to student-no. write student-record from  ** Print a Report on the Printer.* identification division. program-id. EXAMPLE-18. environment division. configuration isection. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-fil 6value of '' is output-file-name. 01 display-record. j02 filler pic x(80). working-storage section. 01 output-file-name pic x(12). 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age  pic x. 01 report-heading. 02 filler pic x value is spaces. 02 filler pic x(20) value is spaces. 02 filler &pic x(20) value is 'Student Reports'. 02 filler .pic x(39) value is spaces. 01 first-line. 02c x(5) value is ' alg'. 02 out-algebra pic x. 02 filler pic x(5) value is ' gmt'. 02 out-geometry pic x. 02 filler pic x(5) value is ' phy'. 02 out-physics pic x. 02 filler pic x(5) valu inter'. !move spaces to output-file-name. accept output-file-name. open input student-file. open output screen. )write display-record from report-heading after advancing 1 lines. &write display-record from blank-line data. 6perform read-student-record. display-student-data. #move student-no to out-student-no. move name to out-name. %write display-record from first-line after advancing 1 lines. move algebra to out-algebra. move g 1after advancing 1 lines. read-student-record. $read student-file into student-data Hat end move high-values to student-no.e display-record from first-line after advancing 1 lines. move algebra to out-algebra. move g t-file Kassign to 'students'. data division. file section. fd student-file 1label records are standard. 01 student-record. F02 filler pic x(60). working-storage section. 01 student-data. 02 student-no pic x.… close student-file. #stop run. process-student-data. display student-data. 5perform read-student-record. read-student-record. @read student-file into student-data.tion. 01 student-data. 02 student-no pic x.** Input a File Name.* identification division. program-id. EXAMPLE-17. environment division. configuration section. so]urce-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file ae assign to 'textfile'. select screen Cassign to ''. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen label records are standard pic xx. 02 sex pic x. 02 class pic x. 02 school pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english  filler pic x value is spaces. 02 out-student-no pic x(4). 02 filler pic x(10) value is spaces. 02 out-name pic x(20). 01 second-line. 02 filler pic x value is spaces. 02 filler pie is ' chm'. 02 out-chemistry pic x. 02 filler pic x(5) value is ' eng'. 02 out-english pic x. 01 blank-line 2pic x(80) value is spaces. procedure division. 0display 'enter output file name - terminal or pr after advancing 1 lines. perform read-student-record. perform process-student-data until student-no = high-values. close student-file screen. #stop run. process-student-data. perform display-student-eometry to out-geometry. move physics to out-physics. !move chemistry to out-chemistry. move english to out-english. &write display-record from second-line after advancing 1 lines %write display-record from blank-line ssign to 'textfile'. select screen Cassign to ''. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen label records are standard value o 02 name pic x. 02 age pic xx. 02 sex pic x. procedure division. open input student-file. perform read-student-record. perform process-student-data until student-no = '9'. 10) value is spaces. 02 out-name pic x(20). 01 second-line. 02 filler pic x(5) value is ' alg'. 02 out-algebra pic x. 02 filler pic x(5) value is ' gmt'. 02 out-geometry pic x. 02 filler 1 x(80) value is spaces. procedure division. 8display 'enter output file name - terminal or printer'. !move spaces to output-file-name. accept output-file-name. open input student-file. open output screen. write display-reco ata. perform display-student-data. 6perform read-student-record. display-student-data. #move student-no to out-student-no. move name to out-name. &write display-record from first-line. move algebra to out-algebra. move Otudent-file into student-data write display-record from blank-line. read-student-record. read s screen. #stop run. process-student-data. perform display-student-data. 6perform read-student-record. display-student-data. if algebra < '050' move 'failed' to pass-fail else move 'passed' to pass-fail. to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen %label records are standard. 01 dispchool pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english pic x. 01 report-heading. 02 filler pic x(20) value is spaces.  pic x(5) value is spaces. 02 out-algebra pic x. 02 filler pic x(5) value is spaces. 02 pass-fail pic x(10). 01 blank-line 2pic x(80) value is spaces. procedure division. open input student-file. . 02 sex pic x. 02 class pic x. 02 school pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english pic x.  ** Compound Conditions.* identification division. program-id. EXAMPLE-24. environment division. configuration section. _source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file  01 display-record. F02 filler pic x(80). working-storage section. 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x.  s. 02 filler pic x(30) )value is 'Class 2 & 4 - Algebra Report'. 02 filler .pic x(40) value is spaces. 01 first-line. 02 out-student-no pic x(4). 02 filler pic x(10) value is spaces. 02 out-name p input student-file. open output screen. *write display-record from report-heading. &write display-record from blank-line. perform read-student-record. perform process-student-data until student-no = high-values. clos #move student-no to out-student-no. move name to out-name. move algebra to out-algebra. @write display-record from display-line. read-student-record. $read student-file into student-data #at end move high-values to student-lay-student-data. #move student-no to out-student-no. move name to out-name. move class to out-class. move algebra to out-algebra. >write display-record from first-line. read-student-record. read student-file into student-d** Simple Arithmetic (Integer Numbers).* identification division. program-id. EXAMPLE-25. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 a pic giving f. display 'a ' a. display 'b ' b. display ' '. display 'c ' c. display 'd ' d. display 'e ' e. display 'f ' f. ^stop run.object-computer. IBM-4331. data division. working-storage section. 01 a pic  ** Simple Arithmetic (With Decimal Places).* identification division. program-id. EXAMPLE-26. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. data division. working-storage section. 01 a 'pic 99v99 value is 12.34. 01 b pic 9v91 value is 123.456. 01 c pic 9(7). 01 d pic 9v9. 01 e pic 9(5)v9. 01 f pic 9v9. procedure division. add a b giving c. subtract a from b giving d. multiply a by b giving e.  assign to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen label records are standard.  02 school pic x. 02 algebra pic x. 02 geometry pic x. 02 physics pic x. 02 chemistry pic x. 02 english pic x. 01 report-heading. 02 filler pic x(20) value is space ic x(20). 02 filler pic x(5) value is spaces. 02 out-class pic x. 02 filler pic xx value is spaces. 02 out-algebra pic x. 01 blank-line 2pic x(80) value is spaces. procedure division. opene student-file screen. #stop run. process-student-data. if "(algebra > '074' and class = '2') or "(algebra < '050' and class = '4') perform display-student-data. $perform read-student-record. dispno.creen. #stop run. process-student-data. perform display-student-data. 6perform read-student-record. display-student-data. if algebra < '050' move 'failed' to pass-fail else move 'passed' to pass-fail. 5ata =at end move high-values to student-no.process-student-data. if "(algebra > '074' and class = '2') or "(algebra < '050' and class = '4') perform display-student-data. $perform read-student-record. disp9(4) value is 1234. 01 b pic 9(6) value is 123456. 01 c pic 9(7). 01 d pic 9(6). 01 e pic 9(10). 01 f pic 9(3).  procedure division. add a b giving c. subtract a from b giving d. multiply a by b giving e. divide a into b divide a into b giving f. display 'a ' a. display 'b ' b. display ' '. display 'c ' c. display 'd ' d. display 'e ' e. display 'f ' f. Kstop run.. IBM-4331. data division. working-storage section. 01 a  ** Calculate Student Averages.* identification division. program-id. EXAMPLE-33. environment division. configuration secftion. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file  dard. 01 display-record. E02 filler pic x(80). working-storage section. 01 student-total pic 9(5). 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex  02 filler pic x(20) value is spaces. 02 filler 'pic x(30) value is 'Student Averages'. 02 filler .pic x(30) value is spaces. 01 first-line. 02 out-student-no pic x(4). 02 filler pic x(5) value is spaces.  2pic x(80) value is spaces. procedure division. open input student-file. open output screen. *write display-record from report-heading. &write display-record from blank-line. perform read-student-record. perform proces-student-marks. move zero to student-total. add algebra to student-total. add geometry to student-total. add physics to student-total. add chemistry to student-total. add english to student-total. divide student-total btry. move english to out-english. &write display-record from first-line. >write display-record from blank-line. read-student-record. $read student-file into student-data 7at end move high-values to student-no. student-total b** Calculate Class Algebra Averages.* identification division. program-id. EXAMPLE-34. environment division. configuratilon section. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-#e standard. 01 display-record. @02 filler pic x(80). working-storage section. 01 totals. 02 total-1 pic 9(5). 02 total-2 pic 9(5). 02 total-3 pic 9(5). 02 count-1 pic 9(5). 02 count-2  pic x. 02 algebra pic 9. 02 geometry pic 9. 02 physics pic 9. 02 chemistry pic 9. 02 english pic 9. 01 report-heading. 02 filler pic x(20) value is spaces. 02 filler * pic x(30) value is 'Algebra Averages'. 02 filler /pic x(30) value is spaces. 01 school-line. 02 filler pic x(8) value is 'School'. 02 out-school pic 9. 02 filler #pic x(12) value is ' Average is '. 02 o assign to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen label records are stan pic x. 02 class pic x. 02 school pic x. 02 algebra pic 9. 02 geometry pic 9. 02 physics pic 9. 02 chemistry pic 9. 02 english pic 9. 01 report-heading.  02 out-name pic x(20). 02 out-algebra pic z(4)9. 02 out-geometry pic z(4)9. 02 out-physics pic z(4)9. 02 out-chemistry pic z(4)9. 02 out-english pic z(4)9. 02 out-average pic z(5).9. 01 blank-line s-student-data until student-no = high-values. close student-file screen. #stop run. process-student-data. perform process-student-marks. perform display-student-data. 'perform read-student-record. process3y 5 giving out-average. display-student-data. #move student-no to out-student-no. move name to out-name. move algebra to out-algebra. move geometry to out-geometry. move physics to out-physics. move chemistry to out-chemis ut-average pic z(5).9. 01 blank-line 2pic x(80) value is spaces. procedure division. open input student-file. open output screen. *write display-record from report-heading. &write display-record from blank-line. perfile assign to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen label records ar pic 9(5). 02 count-3 pic 9(5). 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x. 02 school  ** Redefines Clause.* identification division. program-id. EXAMPLE-37. environment division. configuration section. sou\rce-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file as display-record. 902 filler pic x(80). working-storage section. 01 i pic 9. 01 totals-table. 02 total pic 9(5) occurs 3 times. =02 counts pic 9(5) occurs 3 times. 01 school-table-data. 02 filler pic x(10) value is 'Ce 2 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x. 02 school pic x. 02 algebra pic 9. 02 geometry pic 9. 02 physics pic 9. 02 c 2 filler $pic x(13) value is ' Average for '. 02 out-school pic x(10). 02 filler pic x(4) value is ' is '. 02 out-average pic z(5).9. 01 blank-line 2pic x(80) value is spaces. procedure division. opetudent-no = high-values. perform display-averages varying i from 1 by 1 until i > 3. close student-file screen. #stop run. process-student-data. perform process-student-marks. perform read-student-r*om school-line. read-student-record. $read student-file into student-data *at end move high-values to student-no.le screen. #stop run. process-student-data. perform process-student-marks. perform read-student-rform read-student-record. move zeros to totals. perform process-student-data until student-no = high-values. perform display-averages close student-file screen. #stop run. process-student-data. perform e add algebra to total-3 'add 1 to count-3. display-averages. move 1 to out-school. .divide total-1 by count-1 giving out-average. 'write display-record from school-line. move 2 to out-school. divide total-2 by 6data Dat end move high-values to student-no.ount-3. display-averages. move 1 to out-school. .divide total-1 by count-1 giving out-average. 'write display-record from school-line. move 2 to out-school. divide total-2 by ** School Course Averages* Data-names with Two Subscripts.* identification division. program-id. EXAMPLE-38. environment division. configuration section. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-controsign to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. #02 filler pic x(60). fd screen label records are standard. 01 ntral'. (02 filler pic x(10) value is 'Western'. Z02 filler pic x(10) value is 'Southern'. 01 school-table redefines school-table-data. >02 school-data pic x(10) occurs 3 times. 01 student-data. 02 student-no pic x. 0 hemistry pic 9. 02 english pic 9. 01 report-heading. 02 filler pic x(20) value is spaces. 02 filler 'pic x(30) value is 'Algebra Averages'. 02 filler /pic x(30) value is spaces. 01 school-line. 0n input student-file. open output screen. *write display-record from report-heading. &write display-record from blank-line. perform read-student-record. move zeros to totals-table. perform process-student-data until s#ecord. process-student-marks. move school to i. add algebra to total(i). )add 1 to counts(i). display-averages. #move school-data(i) to out-school. 1divide total(i) by counts(i) giving out-average. write display-record frl. select student-file assign to 'textfile'. select screen Kassign to 'terminal'. data division. file section. fd student-file 1label records are standard. 01 student-record. !02 filler pic x(60). fd screeprocess-student-marks. 7perform read-student-record. process-student-marks. if school = '1' add algebra to total-1 add 1 to count-1 else if school = '2' add algebra to total-2 add 1 to count-2 elscount-2 giving out-average. 'write display-record from school-line. move 3 to out-school. .divide total-3 by count-3 giving out-average. ?write display-record from school-line. read-student-record. read student-file into student- open output screen. *write display-record from report-heading. &write display-record from blank-line. perform read-student-record. move zeros to summary-table. perform process-student-data !until student-no = high-values.  marks. move school to i. move class to j. 4add 1 to count-by-class(i, j). display-averages. #move school-data(i) to out-school. perform move-counts varying j from 1 by 1 until j > 4. write display-record f ** Create Demonstration File.* identification division. program-id. EXAMPLE-43. environment division. configuration secteion. source-computer. IBM-4331. object-computer. IBM-4331. input-output section. file-control. select student-file "er pic x(60). 01 demo-file. 02 demo-data. 03 filler pic x(60) value is '1234Smith SA 14m1307510 75065084'. 03 filler pic x(60) value is '1236Jones TO 14m22076078055057078'.  JW 14m21068075067087'. 03 filler pic x(60) value is '1242Welch JW 14m31075075076075075'. 03 filler pic x(60) value is '1243Dirksen PH 14m42074085054068084'. 03 filler pic x40491097036'. 03 filler pic x(60) value is '1266Taylor YOU13f33095083072066055'. 03 filler pic x(60) value is '1268Allen T 13f21098084073065059'. 03 filler pic x(60) value is n 1label records are standard. 01 display-record. 902 filler pic x(80). working-storage section. 01 i pic 9. 01 j !pic 9. 01 school-table-data. (02 filler pic x(10) value is 'Central'. "02 filler pic x(10) value is 'Westtimes. 01 student-data. 02 student-no pic x. 02 name pic x(20). 02 age pic xx. 02 sex pic x. 02 class pic x. 02 school pic x. 02 algebra pic 9. 0 02 filler /pic x(30) value is spaces. 01 school-line. 02 out-school pic x(10). 02 out-counts +pic z(4)9 occurs 4 times. 01 blank-line 2pic x(80) value is spaces. procedure division. open input student-file.  03 filler pic x(60) value is '1388Beatle RA 15f11065062073076087'. 03 filler pic x(60) value is '1390Cruikshank TR 15f33055064077076085'. 03 filler pic x(60) value is '1393Hoppe perform display-averages varying i from 1 by 1 until i > 3. close student-file screen. #stop run. process-student-data. perform process-student-marks. 0perform read-student-record. process-student-#rom school-line. move-counts. Dmove count-by-class(i, j) to out-counts(j). read-student-record. $read student-file into student-data -at end move high-values to student-no.arks. 0perform read-student-record. process-student- Kassign to 'textfile'. data division. file section. fd student-file 1label records are standard. 01 student-record. B02 filler pic x(60). working-storage section. 01 rec-number pic 9. 01 student-data. 02 fill 03 filler pic x(60) value is '1238Winterbourne MSW14m31078088056067088'. 03 filler pic x(60) value is '1239Harrison K 14m42022087065087068'. 03 filler pic x(60) value is '1240Graham (60) value is '1245Cowan D 15f33055066077088099'. 03 filler pic x(60) value is '1249Sullivan J 15f42044055066077088'. 03 filler pic x(60) value is '1256Kitchen MPP14m4307 '1270Xerxes X 13f13099088077066055'. 03 filler pic x(60) value is 0'1272Zimmerman-CormierABC13f32095085078061057'. 03 filler pic x(60) value is '1375Quantas FLY15m22066066066066066'. ern'. Z02 filler pic x(10) value is 'Southern'. 01 school-table redefines school-table-data. ?02 school-data pic x(10) occurs 3 times. 01 summary-table. #02 count-by-school occurs 3 times. $03 count-by-class pic 9(5) occurs 4 2 geometry pic 9. 02 physics pic 9. 02 chemistry pic 9. 02 english pic 9. 01 report-heading. 02 filler pic x(20) value is spaces. 02 filler 'pic x(30) value is 'Enrollment Table'.  2ov22v#Q ~^n>N.~~ ~~~~~>~Nl~~n~^~1}~~~~}}}}}~}}^} r BUN15f23045069037026035'. #02 demo-info redefines demo-data. >03 demo-rec pic x(60) occurs 18 times. procedure division. open output student-file. perform write-demo varying rec-number from 1 by 1 u {V z {z{Fz{{zz{6{zVzzzvz%zfz6v{&zFz&yy^y~wv.yyyyuyN|ryvvynwNyqVtnxu>q~:q6pyxv>un u-ttN)s  sĻ yAosQ+oS|cc33!N4 s |@ q|Z`flrx~Ƅ̄҄؄ބ &, ;{SS P  c* x6wwփw^xnppfpu pVf&cuㄣ3J#  vVun'%]\33h   ! s |@(q|%sZ vW ]ħ @ ]%%s6. /# 9 9  G%sQ vW ]ħ @j]% u% ' Iu)% ' %+ '# '   -% #-'%%#)@#)Iu"%s?vW ]ħ @ ]%(uㄣ' -%'T jv| 33onon 33)j9 s -%u-%u)6 rr>trƃtqރrtv xF r^ w v^w&yqtt>p5  + #'   -("s v]ħ @!粧]S" n33-% 33/b33g sQx 3s 唻]| ]]WSS]S]]W]x3 t33r ,33 4  % JA] B 33}n/ }}>}N}  }|~.}. | /||||^-||~|n||N|.|>{|{{{{fntil rec-number > 18. close student-file. stop run. write-demo. +move demo-rec(rec-number) to student-data. @write student-record from student-data. 15f33055064077076085'. 03 filler pic x(60) value is '1393Hoppewvxwxy>vx|u~vvt)t^rrք܄Є $*06<BHNT"s-vj]ħ @]ħ",s~ |w|YA!篑33c |o,;sv t  0s ڳ冣;-%  -#'' ]j]Ā0,s㣚 S@ qS| ܣA% , sQ: 3# 9%c9-% @ ;;{SS P 33# 駣 ֣@;{ @#BuㄣT' % '' #+ 9)%'''  -% 9 B u !uㄣ$%c9-% ' 9#!uャvW ]ħ @"]%O ?f&4z3[33QDG\(>=e93 h33[v3%sc vW Ч]ħ @%PE,Gu%'#)'% #+ #'%) '-篑33c |qS,(su S@ qS| ܣA@.)%(*sv%c9]j J @)*.s$v- ;]W *]ħ @.r徻 yA@'篦 %sH vW ]ħ @ V%r  33 33%1%+#% - -#'   33) 33#'9 33/'9 # / 3u#'; 1 133%'  33/'; )'  $# %% *'% 0-- 6--) <v % ' l &' % 833#  %  ' 4  iFiF /# iF V % ' /'Q"sl v ]ħ @"]ħ"  ##1# EIB @l  #' #  'f      '#/  '   33#  / /   /%  /  /  - -33 % -33  -+ -33+#% -# -33#' &-33/' ,{ 2%+  8   >   D' J P6 ` P`  l )'% %# ov - 4{vovo1o- B   H' 8vs. <  6%+ 233 ##T $33#'  *33/'  #S  tu~  + # % %  %EI %? % % #' % ## %  % % %33% '%9 %  %/'%/#% '"%u(%33 .%33 ##r4%33# :%=@%G  F-- X--#%y  4-- | L--'` :--) ı  @--)  .'%x   %  33%'3 33#';sS ")' : 33#% ϻ 33)%A 33#'9   / #K  D #  B    C  -  @  {  - ~ #^ '> / 33-% # '  33 ### 33KK -- B-- H--' N--/ T--#% Z#' ` f l/ r  x ~   %    %  #   )%       /  33#    %fv     #ƃ-  ' n  %'+ % ~%'f r#k^<  f+# % %'  z )'k^ ;  q. x %# ` %# P T ### {  ### V \ %#  b+# % h )'% n# t %#  z%' %#  )' ' %'+   %'   #  '    % '#/   33 L 33%'#' 33# % 33 %v   /A  A@    Ȅ;  % 9 33+#%^    )% '   %, # 4  R--/v  ^#'xބfF%AL%ER% % X%33^%33d%33j%33-%p%33v%3|%33/%33%'#'%3# %'%%33%;)33!33)33 '#/  =  (# %%# 33/'9sS  - ]   33/';A # '  33%1%+#% 33  -#'  33 ###)  33  33-%   / 3+w 'KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK