Appendix - Load Program

load_microfocus_files: proc() options(main);
 
%replace MAX_REC_LEN               by 100;       
%replace MAX_REC_LEN_SV            by 102;       
%replace INPUT_TITLE               by 'fixed_cisam.dat';       
%replace OUTPUT_TITLE              by 'microfocusIndexed.dat';       
%include ‘vsamrec.in’;

 dcl inputfile    file record input env(f recsize( MAX_REC_LEN_SV ));
 dcl outputfile    file record 
     env(vsam  recsize( MAX_REC_LEN ) keyloc(11) keylength(10));
 dcl 1 fixed_buf based(addr(in_rec)),
       5 fixed_buf_len  fixed bin(15),
       5 fixed_buf_data char( MAX_REC_LEN );
 dcl in_rec    char( MAX_REC_LEN ) varying;
 on endfile(inputfile) goto done; 
 open file(inputfile) title(INPUT_TITLE);
 open file(outputfile) title(OUTPUT_TITLE) keyed sequential output;
 read file(inputfile) into(fixed_buf);
 do while(1);
    string(vsam_rec) = in_rec;
    write file(outputfile) from (vsam_rec) keyfrom(last_name);
    read file(inputfile) into(fixed_buf);
 end;
done:
 close file(inputfile);
 close file(outputfile);
end;