-- $Source: /commtar/monoBANK/CICS_INTF/fc_c_6.ada,v $ -- $Revision: 1.1 $ $Date: 88/03/15 18:09:28 $ $Author: chris $ with CICS_test_reporter; use CICS_test_reporter; with File_control_testing_utility; use File_control_testing_utility; with Host_character_pkg; use Host_character_pkg; with CICS_exceptions; use CICS_exceptions; ---------------- procedure fc_c_6 ---------------- is use Numbered_line_file_pkg; package NLF renames Numbered_line_file; Host_rec : Host_numbered_line_record; Rec : Numbered_line_record; Key : Count_type; Alphanums : constant string := "abcdefghijklmonpqrstuvwxyz" & "ABCDEFGHIJKLMONPQRSTUVWXYZ" & "1234567890" ; Symbols : constant string := "~!@#$%^&*()_+:::""|>,.?" & "`-=[];'\<,./ " ; Blank_line : constant string := (Rec.line'range => ' '); begin Start_module("fc_c_6", "host character set manipulation for Data Type " & "Files"); declare begin Start_test("fc_c_6_a", "write and read record using host strings"); Key := Pad(integer'image(1), Key'length); Host_rec.Count := To_host_string(Key); Host_rec.Line := To_host_string( Pad(Alphanums,Rec.line'length) ); NLF.Write(File=>Recfile, From=>Host_rec, Key=>To_host_string(Key)); NLF.Read(File=>Recfile, Element=>Host_rec, Key=>To_host_string(Key), Update=>TRUE); if Pad(Alphanums,Rec.line'length) /= To_string(Host_rec.line) then Fail_test; else Pass_test; end if; NLF.Delete(File=>Recfile); exception when Not_open => Unexpected_exception("Not_open"); when Not_Found => Unexpected_exception("Not_found"); when Duplicate_key => Unexpected_exception("Duplicate_key"); when Duplicate_record => Unexpected_exception("Duplicate_record"); when End_file => Unexpected_exception("End_file"); when Others => Unexpected_exception("undocumented exception"); end; declare begin Start_test("fc_c_6_b", "write and read record using host characters"); Key := Pad(integer'image(1), Key'length); Host_rec.Count := To_host_string(Key); Host_rec.Line := To_host_string(Blank_line); For i in Alphanums'range loop Host_rec.line(i) := To_host_character(Alphanums(i)); end loop; NLF.Write(File=>Recfile, From=>Host_rec, Key=>To_host_string(Key)); NLF.Read(File=>Recfile, Element=>Host_rec, Key=>To_host_string(Key), Update=>TRUE); For i in Alphanums'range loop if Alphanums(i) /= To_character(Host_rec.line(i)) then Fail_test; exit; end if; end loop; NLF.Delete(File=>Recfile); Host_rec.Line := To_host_string(Blank_line); For i in Symbols'range loop Host_rec.line(i) := To_host_character(Symbols(i)); end loop; NLF.Write(File=>Recfile, From=>Host_rec, Key=>To_host_string(Key)); NLF.Read(File=>Recfile, Element=>Host_rec, Key=>To_host_string(Key), Update=>TRUE); For i in Symbols'range loop if Symbols(i) /= To_character(Host_rec.line(i)) then Fail_test; exit; end if; end loop; NLF.Delete(File=>Recfile); Pass_test; exception when Not_open => Unexpected_exception("Not_open"); when Not_Found => Unexpected_exception("Not_found"); when Duplicate_key => Unexpected_exception("Duplicate_key"); when Duplicate_record => Unexpected_exception("Duplicate_record"); when End_file => Unexpected_exception("End_file"); when Others => Unexpected_exception("undocumented exception"); end; declare begin Start_test("fc_c_6_c", "write and read record using padded host " & "strings"); Key := Pad(integer'image(1), Key'length); Host_rec.Count := To_host_string(Key); Host_rec.Line := To_padded_host_string(Alphanums, Host_rec.Line'length); NLF.Write(File=>Recfile, From=>Host_rec, Key=>To_host_string(Key)); NLF.Read(File=>Recfile, Element=>Host_rec, Key=>To_host_string(Key), Update=>TRUE); if Alphanums /= To_unpadded_string(Host_rec.line) then Fail_test; else Pass_test; end if; NLF.Delete(File=>Recfile); exception when Not_open => Unexpected_exception("Not_open"); when Not_Found => Unexpected_exception("Not_found"); when Duplicate_key => Unexpected_exception("Duplicate_key"); when Duplicate_record => Unexpected_exception("Duplicate_record"); when End_file => Unexpected_exception("End_file"); when Others => Unexpected_exception("undocumented exception"); end; End_module; end;