identification division. program-id. gen-indexed-mastr. author. bill rogers. * compile and run this program to generate the indexed * master file which you will update with the transaction * file created by program gen-2. * you may wish to modify the "assign" clause in the environment * division to specify a disk and/or path location in which * this program will create its output. environment division. input-output section. file-control. select out-file assign to 'imastr.dat' organization is indexed access mode is dynamic record key is out-accnt-number. data division. file section. fd out-file data record is out-item. 01 out-item. 02 out-accnt-number pic x(5). 02 out-customer-name pic x(25). 02 out-balance pic s9(8)v99. working-storage section. 01 data-text. 02 pic x(40) value '00001Leo Veenstra 0000500000'. 02 pic x(40) value '00002Wilbur Uecker 0001000000'. 02 pic x(40) value '00003Baxter Stevens 0007500000'. 02 pic x(40) value '00004Chuck Tascone 0000100000'. 02 pic x(40) value '00005Mary Rice 0000250000'. 02 pic x(40) value '00006J.C. Hasper 0000155000'. 01 data-table redefines data-text. 02 data-item occurs 6 times. 03 data-accnt-number pic 9(5). 03 data-customer-name pic x(25). 03 data-balance pic s9(8)v99. 01 x pic 9(4) comp. procedure division. mainline. open output out-file. perform the-loop varying x from 1 by 1 until x > 6. close out-file. stop run. the-loop. move data-accnt-number (x) to out-accnt-number. move data-customer-name (x) to out-customer-name. move data-balance (x) to out-balance. write out-item invalid key display 'unexpected error'.