*> Create an indexed file *> open output an indexed file call "idxfile.dat" display "Create new indexed file" perform set-fcd move OP-OPEN-OUTPUT to opcode perform call-file-handler perform display-file-status.
This code performs the three sections that you coded in the previous steps. The operation code is set so that when call-file-handler is performed, the details in the FCD result in an indexed file, named idxfile.dat, is created.
*> Write 5 records increasing record length by 1 each time move all "A" to record-data move 0 to record-key move 5 to fcd-current-rec-len move OP-WRITE to opcode perform 5 times add 1 to record-key add 1 to fcd-current-rec-len perform call-file-handler end-perform.
This paragraph writes (using op-code OP-WRITE) five records to the open file.
*> Now close the file move OP-CLOSE to opcode perform call-file-handler perform display-file-status display "file closed".
Now the op-code changes to OP-CLOSE and the file is closed, and a file-status check is performed to confirm that the file has been closed successfully.
Now that you have created and populated an indexed file, the next steps demonstrate how to open it and update it.